Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit 9d67c1c

Browse files
Jozef VolakJozefiel
authored andcommitted
Dependency update:
- Pydantic v2 dependency update - Update graphql-pydantic-converter
1 parent 48202fd commit 9d67c1c

File tree

46 files changed

+4577
-3507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4577
-3507
lines changed

inventory/python/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 1.0.0
2+
- Upgrade pydantic version to v2

inventory/python/frinx_worker/inventory/__init__.py

Lines changed: 137 additions & 123 deletions
Large diffs are not rendered by default.

inventory/python/frinx_worker/inventory/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
from dataclasses import dataclass
22
from typing import Any
3+
from typing import Optional
34
from typing import TypeAlias
45

56
import requests
67
from frinx.common.frinx_rest import INVENTORY_HEADERS
78
from frinx.common.frinx_rest import INVENTORY_URL_BASE
89
from frinx.common.type_aliases import DictAny
910

10-
CoursorGroup: TypeAlias = dict[str, list[dict[str, str]]]
11-
CoursorGroups: TypeAlias = dict[str, dict[str, list[dict[str, str]]]]
11+
CursorGroup: TypeAlias = dict[str, list[dict[str, str]]]
12+
CursorGroups: TypeAlias = dict[str, dict[str, list[dict[str, str]]]]
1213

1314

1415
@dataclass
@@ -20,7 +21,7 @@ class InventoryOutput:
2021

2122
def execute_inventory_query(
2223
query: str,
23-
variables: DictAny | None = None,
24+
variables: Optional[DictAny] = None,
2425
inventory_url_base: str = INVENTORY_URL_BASE
2526
) -> InventoryOutput:
2627
"""

inventory/python/frinx_worker/inventory/workflows/__init__.py

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class InstallAllFromInventory(WorkflowImpl):
2323
version: int = 1
2424
description: str = 'Install all devices from device inventory or by label'
2525
labels: list[str] = ['INVENTORY']
26-
timeout_seconds = 3600
26+
timeout_seconds: int = 3600
2727

2828
class WorkflowInput(WorkflowImpl.WorkflowInput):
2929
labels: WorkflowInputField = WorkflowInputField(
@@ -42,15 +42,19 @@ def workflow_builder(self, workflow_inputs: WorkflowInput) -> None:
4242
name=InventoryService.InventoryGetLabelsId,
4343
task_reference_name='get_labels',
4444
input_parameters=SimpleTaskInputParameters(
45-
labels=workflow_inputs.labels.wf_input
45+
root=dict(
46+
labels=workflow_inputs.labels.wf_input
47+
)
4648
)
4749
)
4850

4951
get_pages_cursors = SimpleTask(
5052
name=InventoryService.InventoryGetPagesCursors,
5153
task_reference_name='get_pages_cursors',
5254
input_parameters=SimpleTaskInputParameters(
53-
labels=get_labels.output_ref('labels_id')
55+
root=dict(
56+
labels=get_labels.output_ref('labels_id')
57+
)
5458
)
5559
)
5660

@@ -68,8 +72,10 @@ def workflow_builder(self, workflow_inputs: WorkflowInput) -> None:
6872
name=InventoryService.InventoryGetPagesCursorsForkTasks,
6973
task_reference_name='get_pages_cursors_fork_task',
7074
input_parameters=SimpleTaskInputParameters(
71-
task=InventoryService.InventoryInstallInBatch().WorkerDefinition().name,
72-
cursors_groups=convert_to_string.output_ref('result'),
75+
root=dict(
76+
task=InventoryService.InventoryInstallInBatch().WorkerDefinition().name,
77+
cursors_groups=convert_to_string.output_ref('result')
78+
)
7379
)
7480
)
7581

@@ -122,14 +128,14 @@ def workflow_builder(self, workflow_inputs: WorkflowInput) -> None:
122128

123129
self.output_parameters = self.WorkflowOutput(
124130
response_body=join_results.output_ref('result.output')
125-
).dict()
131+
).model_dump()
126132

127133
class InstallInBatch(WorkflowImpl):
128134
name: str = 'INVENTORY_install_in_batch'
129135
version: int = 1
130136
description: str = 'Install devices in batch'
131137
labels: list[str] = ['INVENTORY']
132-
timeout_seconds = 3600
138+
timeout_seconds: int = 3600
133139

134140
class WorkflowInput(WorkflowImpl.WorkflowInput):
135141
devices: WorkflowInputField = WorkflowInputField(
@@ -148,7 +154,9 @@ def workflow_builder(self, workflow_inputs: WorkflowInput) -> None:
148154
name=InventoryService.InventoryInstallInBatch,
149155
task_reference_name='install_in_batch',
150156
input_parameters=SimpleTaskInputParameters(
151-
devices=workflow_inputs.devices.wf_input
157+
root=dict(
158+
devices=workflow_inputs.devices.wf_input
159+
)
152160
)
153161
)
154162
)
@@ -158,7 +166,7 @@ class UninstallAllFromInventory(WorkflowImpl):
158166
version: int = 1
159167
description: str = 'Uninstall all devices from device inventory or by label'
160168
labels: list[str] = ['INVENTORY']
161-
timeout_seconds = 3600
169+
timeout_seconds: int = 3600
162170

163171
class WorkflowInput(WorkflowImpl.WorkflowInput):
164172
labels: WorkflowInputField = WorkflowInputField(
@@ -177,15 +185,19 @@ def workflow_builder(self, workflow_inputs: WorkflowInput) -> None:
177185
name=InventoryService.InventoryGetLabelsId,
178186
task_reference_name='get_labels',
179187
input_parameters=SimpleTaskInputParameters(
180-
labels=workflow_inputs.labels.wf_input
188+
root=dict(
189+
labels=workflow_inputs.labels.wf_input
190+
)
181191
)
182192
)
183193

184194
get_pages_cursors = SimpleTask(
185195
name=InventoryService.InventoryGetPagesCursors,
186196
task_reference_name='get_pages_cursors',
187197
input_parameters=SimpleTaskInputParameters(
188-
labels=get_labels.output_ref('labels_id')
198+
root=dict(
199+
labels=get_labels.output_ref('labels_id')
200+
)
189201
)
190202
)
191203

@@ -203,8 +215,10 @@ def workflow_builder(self, workflow_inputs: WorkflowInput) -> None:
203215
name=InventoryService.InventoryGetPagesCursorsForkTasks,
204216
task_reference_name='get_pages_cursors_fork_task',
205217
input_parameters=SimpleTaskInputParameters(
206-
task='INVENTORY_uninstall_in_batch',
207-
cursors_groups=convert_to_string.output_ref('result'),
218+
root=dict(
219+
task='INVENTORY_uninstall_in_batch',
220+
cursors_groups=convert_to_string.output_ref('result')
221+
)
208222
)
209223
)
210224

@@ -257,14 +271,14 @@ def workflow_builder(self, workflow_inputs: WorkflowInput) -> None:
257271

258272
self.output_parameters = self.WorkflowOutput(
259273
response_body=join_results.output_ref('result.output')
260-
).dict()
274+
).model_dump()
261275

262276
class UninstallInBatch(WorkflowImpl):
263277
name: str = 'INVENTORY_uninstall_in_batch'
264278
version: int = 1
265279
description: str = 'Uninstall devices in batch'
266280
labels: list[str] = ['INVENTORY']
267-
timeout_seconds = 3600
281+
timeout_seconds: int = 3600
268282

269283
class WorkflowInput(WorkflowImpl.WorkflowInput):
270284
devices: WorkflowInputField = WorkflowInputField(
@@ -283,7 +297,9 @@ def workflow_builder(self, workflow_inputs: WorkflowInput) -> None:
283297
name=InventoryService.InventoryUninstallInBatch,
284298
task_reference_name='uninstall_in_batch',
285299
input_parameters=SimpleTaskInputParameters(
286-
devices=workflow_inputs.devices.wf_input
300+
root=dict(
301+
devices=workflow_inputs.devices.wf_input
302+
)
287303
)
288304
)
289305
)

0 commit comments

Comments
 (0)