Skip to content

Commit 10a8a26

Browse files
authored
Merge pull request #5936 from opsmill/pog-upgrade-prefect
Upgrade Prefect 3.2.11 and install prefect redis
2 parents 4a56083 + 5ebf483 commit 10a8a26

File tree

10 files changed

+99
-69
lines changed

10 files changed

+99
-69
lines changed

backend/infrahub/computed_attribute/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async def process_transform(
115115
service=service,
116116
repository_kind=str(transform.repository.peer.typename),
117117
commit=repo_node.commit.value,
118-
)
118+
) # type: ignore[misc]
119119

120120
data = await service.client.query_gql_query(
121121
name=transform.query.peer.name.value,
@@ -131,7 +131,7 @@ async def process_transform(
131131
location=f"{transform.file_path.value}::{transform.class_name.value}",
132132
data=data,
133133
client=service.client,
134-
)
134+
) # type: ignore[misc]
135135

136136
await service.client.execute_graphql(
137137
query=UPDATE_ATTRIBUTE,

backend/infrahub/git/integrator.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -171,27 +171,27 @@ async def import_objects_from_files(
171171
self.create_commit_worktree(commit)
172172
await self._update_sync_status(branch_name=infrahub_branch_name, status=RepositorySyncStatus.SYNCING)
173173

174-
config_file = await self.get_repository_config(branch_name=infrahub_branch_name, commit=commit)
174+
config_file = await self.get_repository_config(branch_name=infrahub_branch_name, commit=commit) # type: ignore[misc]
175175
sync_status = RepositorySyncStatus.IN_SYNC if config_file else RepositorySyncStatus.ERROR_IMPORT
176176
error: Exception | None = None
177177

178178
try:
179179
if config_file:
180-
await self.import_schema_files(branch_name=infrahub_branch_name, commit=commit, config_file=config_file)
180+
await self.import_schema_files(branch_name=infrahub_branch_name, commit=commit, config_file=config_file) # type: ignore[misc]
181181

182182
await self.import_all_graphql_query(
183183
branch_name=infrahub_branch_name, commit=commit, config_file=config_file
184-
)
184+
) # type: ignore[misc]
185185

186186
await self.import_all_python_files( # type: ignore[call-overload]
187187
branch_name=infrahub_branch_name, commit=commit, config_file=config_file
188-
)
188+
) # type: ignore[misc]
189189
await self.import_jinja2_transforms(
190190
branch_name=infrahub_branch_name, commit=commit, config_file=config_file
191-
)
191+
) # type: ignore[misc]
192192
await self.import_artifact_definitions(
193193
branch_name=infrahub_branch_name, commit=commit, config_file=config_file
194-
)
194+
) # type: ignore[misc]
195195

196196
except Exception as exc:
197197
sync_status = RepositorySyncStatus.ERROR_IMPORT
@@ -636,7 +636,7 @@ async def import_python_check_definitions(
636636
module=module,
637637
file_path=file_info.relative_path_file,
638638
check_definition=check,
639-
)
639+
) # type: ignore[misc]
640640
)
641641

642642
local_check_definitions = {check.name: check for check in checks}
@@ -797,7 +797,7 @@ async def import_python_transforms(
797797
module=module,
798798
file_path=file_info.relative_path_file,
799799
transform=transform,
800-
)
800+
) # type: ignore[misc]
801801
)
802802

803803
local_transform_definitions = {transform.name: transform for transform in transforms}
@@ -1070,9 +1070,9 @@ async def import_all_python_files(
10701070
) -> None:
10711071
await add_tags(branches=[branch_name], nodes=[str(self.id)])
10721072

1073-
await self.import_python_check_definitions(branch_name=branch_name, commit=commit, config_file=config_file)
1074-
await self.import_python_transforms(branch_name=branch_name, commit=commit, config_file=config_file)
1075-
await self.import_generator_definitions(branch_name=branch_name, commit=commit, config_file=config_file)
1073+
await self.import_python_check_definitions(branch_name=branch_name, commit=commit, config_file=config_file) # type: ignore[misc]
1074+
await self.import_python_transforms(branch_name=branch_name, commit=commit, config_file=config_file) # type: ignore[misc]
1075+
await self.import_generator_definitions(branch_name=branch_name, commit=commit, config_file=config_file) # type: ignore[misc]
10761076

10771077
@task(name="jinja2-template-render", task_run_name="Render Jinja2 template", cache_policy=NONE) # type: ignore[arg-type]
10781078
async def render_jinja2_template(self, commit: str, location: str, data: dict) -> str:
@@ -1227,7 +1227,7 @@ async def artifact_generate(
12271227
if transformation.typename == InfrahubKind.TRANSFORMJINJA2:
12281228
artifact_content = await self.render_jinja2_template.with_options(
12291229
timeout_seconds=transformation.timeout.value
1230-
)(commit=commit, location=transformation.template_path.value, data=response)
1230+
)(commit=commit, location=transformation.template_path.value, data=response) # type: ignore[misc]
12311231
elif transformation.typename == InfrahubKind.TRANSFORMPYTHON:
12321232
transformation_location = f"{transformation.file_path.value}::{transformation.class_name.value}"
12331233
artifact_content = await self.execute_python_transform.with_options(
@@ -1238,7 +1238,7 @@ async def artifact_generate(
12381238
location=transformation_location,
12391239
data=response,
12401240
client=self.sdk,
1241-
)
1241+
) # type: ignore[misc]
12421242

12431243
if definition.content_type.value == ContentType.APPLICATION_JSON.value and isinstance(artifact_content, dict):
12441244
artifact_content_str = ujson.dumps(artifact_content, indent=2)
@@ -1289,15 +1289,15 @@ async def render_artifact(
12891289
if message.transform_type == InfrahubKind.TRANSFORMJINJA2:
12901290
artifact_content = await self.render_jinja2_template.with_options(timeout_seconds=message.timeout)(
12911291
commit=message.commit, location=message.transform_location, data=response
1292-
)
1292+
) # type: ignore[misc]
12931293
elif message.transform_type == InfrahubKind.TRANSFORMPYTHON:
12941294
artifact_content = await self.execute_python_transform.with_options(timeout_seconds=message.timeout)(
12951295
branch_name=message.branch_name,
12961296
commit=message.commit,
12971297
location=message.transform_location,
12981298
data=response,
12991299
client=self.sdk,
1300-
)
1300+
) # type: ignore[misc]
13011301

13021302
if message.content_type == ContentType.APPLICATION_JSON.value and isinstance(artifact_content, dict):
13031303
artifact_content_str = ujson.dumps(artifact_content, indent=2)

backend/infrahub/git/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ async def run_user_check(model: UserCheckData, service: InfrahubServices) -> Val
822822
client=service.client,
823823
commit=model.commit,
824824
params=model.variables,
825-
)
825+
) # type: ignore[misc]
826826
if check_run.passed:
827827
conclusion = ValidatorConclusion.SUCCESS
828828
severity = "info"

backend/infrahub/transformations/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async def transform_python(message: TransformPythonData, service: InfrahubServic
3030
location=message.transform_location,
3131
data=message.data,
3232
client=service.client,
33-
)
33+
) # type: ignore[misc]
3434

3535
return transformed_data
3636

@@ -49,6 +49,6 @@ async def transform_render_jinja2_template(message: TransformJinjaTemplateData,
4949

5050
rendered_template = await repo.render_jinja2_template.with_options(timeout_seconds=message.timeout)(
5151
commit=message.commit, location=message.template_location, data={"data": message.data}
52-
)
52+
) # type: ignore[misc]
5353

5454
return rendered_template

backend/infrahub/webhook/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ async def _prepare_payload(self, data: dict[str, Any], context: EventContext, se
214214
location=f"{self.transform_file}::{self.transform_class}",
215215
data={"data": data, **context.model_dump()},
216216
client=service.client,
217-
)
217+
) # type: ignore[misc]
218218

219219
@classmethod
220220
def from_object(cls, obj: CoreCustomWebhook, transform: CoreTransformPython) -> Self:

backend/infrahub/webhook/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async def configure_webhook_all(service: InfrahubServices) -> None:
114114
triggers=triggers,
115115
trigger_type=TriggerType.WEBHOOK,
116116
deprecated_triggers=[AUTOMATION_NAME_RUN],
117-
)
117+
) # type: ignore[misc]
118118

119119
log.info(f"{len(triggers)} Webhooks automation configuration completed")
120120

backend/tests/helpers/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def start_prefect_server_container(
4444

4545
prefect_base = Path(Path(__file__).parent.resolve() / "./../../infrahub/prefect_server")
4646
container = (
47-
DockerContainer(image="prefecthq/prefect:3.1.14-python3.12")
47+
DockerContainer(image="prefecthq/prefect:3.2.11-python3.12")
4848
.with_command("uvicorn --host 0.0.0.0 --port 4200 --factory prefect_server.app:create_infrahub_prefect")
4949
.with_exposed_ports(PORT_PREFECT)
5050
.with_volume_mapping(host=str(prefect_base), container="/opt/prefect/prefect_server", mode="ro")

backend/tests/integration/git/test_git_repository.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,39 +117,39 @@ async def repo(
117117

118118
async def test_import_schema_files(self, db: InfrahubDatabase, client: InfrahubClient, repo: InfrahubRepository):
119119
commit = repo.get_commit_value(branch_name="main")
120-
config_file = await repo.get_repository_config(branch_name="main", commit=commit)
120+
config_file = await repo.get_repository_config(branch_name="main", commit=commit) # type: ignore[misc]
121121
assert config_file
122-
await repo.import_schema_files(branch_name="main", commit=commit, config_file=config_file)
122+
await repo.import_schema_files(branch_name="main", commit=commit, config_file=config_file) # type: ignore[misc]
123123

124124
assert await client.schema.get(kind="DemoEdgeFabric", refresh=True)
125125

126126
async def test_import_schema_files_from_directory(
127127
self, db: InfrahubDatabase, client: InfrahubClient, repo: InfrahubRepository
128128
):
129129
commit = repo.get_commit_value(branch_name="main")
130-
config_file = await repo.get_repository_config(branch_name="main", commit=commit)
130+
config_file = await repo.get_repository_config(branch_name="main", commit=commit) # type: ignore[misc]
131131
assert config_file
132132

133133
config_file.schemas = [Path("schemas")]
134-
await repo.import_schema_files(branch_name="main", commit=commit, config_file=config_file)
134+
await repo.import_schema_files(branch_name="main", commit=commit, config_file=config_file) # type: ignore[misc]
135135

136136
assert await client.schema.get(kind="DemoEdgeFabric", refresh=True)
137137

138138
async def test_import_all_graphql_query(
139139
self, db: InfrahubDatabase, client: InfrahubClient, repo: InfrahubRepository
140140
):
141141
commit = repo.get_commit_value(branch_name="main")
142-
config_file = await repo.get_repository_config(branch_name="main", commit=commit)
142+
config_file = await repo.get_repository_config(branch_name="main", commit=commit) # type: ignore[misc]
143143
assert config_file
144144

145-
await repo.import_all_graphql_query(branch_name="main", commit=commit, config_file=config_file)
145+
await repo.import_all_graphql_query(branch_name="main", commit=commit, config_file=config_file) # type: ignore[misc]
146146

147147
queries = await client.all(kind=CoreGraphQLQuery)
148148
assert len(queries) == 5
149149

150150
# Validate if the function is idempotent, another import just after the first one shouldn't change anything
151151
nbr_relationships_before = await count_relationships(db=db)
152-
await repo.import_all_graphql_query(branch_name="main", commit=commit, config_file=config_file)
152+
await repo.import_all_graphql_query(branch_name="main", commit=commit, config_file=config_file) # type: ignore[misc]
153153
assert await count_relationships(db=db) == nbr_relationships_before
154154

155155
# 1. Modify an object to validate if its being properly updated
@@ -167,7 +167,7 @@ async def test_import_all_graphql_query(
167167
)
168168
await obj.save(db=db)
169169

170-
await repo.import_all_graphql_query(branch_name="main", commit=commit, config_file=config_file)
170+
await repo.import_all_graphql_query(branch_name="main", commit=commit, config_file=config_file) # type: ignore[misc]
171171

172172
modified_query = await client.get(kind=CoreGraphQLQuery, id=queries[0].id)
173173
assert modified_query.query.value == value_before_change
@@ -179,7 +179,7 @@ async def test_import_all_python_files(
179179
self, db: InfrahubDatabase, client: InfrahubClient, repo: InfrahubRepository, query_99
180180
):
181181
commit = repo.get_commit_value(branch_name="main")
182-
config_file = await repo.get_repository_config(branch_name="main", commit=commit)
182+
config_file = await repo.get_repository_config(branch_name="main", commit=commit) # type: ignore[misc]
183183
assert config_file
184184

185185
await repo.import_all_python_files(branch_name="main", commit=commit, config_file=config_file) # type: ignore[call-overload]
@@ -256,16 +256,16 @@ async def test_import_all_yaml_files(
256256
self, db: InfrahubDatabase, client: InfrahubClient, repo: InfrahubRepository, query_99
257257
):
258258
commit = repo.get_commit_value(branch_name="main")
259-
config_file = await repo.get_repository_config(branch_name="main", commit=commit)
259+
config_file = await repo.get_repository_config(branch_name="main", commit=commit) # type: ignore[misc]
260260
assert config_file
261-
await repo.import_jinja2_transforms(branch_name="main", commit=commit, config_file=config_file)
261+
await repo.import_jinja2_transforms(branch_name="main", commit=commit, config_file=config_file) # type: ignore[misc]
262262

263263
rfiles = await client.all(kind=CoreTransformJinja2)
264264
assert len(rfiles) == 2
265265

266266
# Validate if the function is idempotent, another import just after the first one shouldn't change anything
267267
nbr_relationships_before = await count_relationships(db=db)
268-
await repo.import_jinja2_transforms(branch_name="main", commit=commit, config_file=config_file)
268+
await repo.import_jinja2_transforms(branch_name="main", commit=commit, config_file=config_file) # type: ignore[misc]
269269
assert await count_relationships(db=db) == nbr_relationships_before
270270

271271
# 1. Modify an object to validate if its being properly updated
@@ -286,7 +286,7 @@ async def test_import_all_yaml_files(
286286
)
287287
await obj.save(db=db)
288288

289-
await repo.import_jinja2_transforms(branch_name="main", commit=commit, config_file=config_file)
289+
await repo.import_jinja2_transforms(branch_name="main", commit=commit, config_file=config_file) # type: ignore[misc]
290290

291291
modified_rfile = await client.get(kind=CoreTransformJinja2, id=rfiles[0].id)
292292
assert modified_rfile.template_path.value == rfile_template_path_value_before_change

0 commit comments

Comments
 (0)