pinexq-client 0.3.0.20240620.2__py3-none-any.whl → 0.4.0.2024.717.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. pinexq_client/core/enterapi.py +8 -9
  2. pinexq_client/core/exceptions.py +73 -2
  3. pinexq_client/core/hco/action_hco.py +12 -22
  4. pinexq_client/core/hco/action_with_parameters_hco.py +15 -21
  5. pinexq_client/core/hco/download_link_hco.py +2 -3
  6. pinexq_client/core/hco/hco_base.py +2 -3
  7. pinexq_client/core/hco/link_hco.py +10 -9
  8. pinexq_client/core/hco/unavailable.py +17 -0
  9. pinexq_client/core/hco/upload_action_hco.py +11 -10
  10. pinexq_client/core/model/error.py +5 -1
  11. pinexq_client/core/sirenaccess.py +18 -27
  12. pinexq_client/job_management/enterjma.py +2 -4
  13. pinexq_client/job_management/hcos/entrypoint_hco.py +36 -35
  14. pinexq_client/job_management/hcos/input_dataslot_hco.py +53 -51
  15. pinexq_client/job_management/hcos/job_hco.py +121 -120
  16. pinexq_client/job_management/hcos/job_query_result_hco.py +72 -47
  17. pinexq_client/job_management/hcos/jobsroot_hco.py +44 -42
  18. pinexq_client/job_management/hcos/output_dataslot_hco.py +1 -1
  19. pinexq_client/job_management/hcos/processing_step_hco.py +71 -70
  20. pinexq_client/job_management/hcos/processingstep_query_result_hco.py +76 -51
  21. pinexq_client/job_management/hcos/processingsteproot_hco.py +44 -43
  22. pinexq_client/job_management/hcos/workdata_hco.py +81 -80
  23. pinexq_client/job_management/hcos/workdata_query_result_hco.py +75 -52
  24. pinexq_client/job_management/hcos/workdataroot_hco.py +53 -52
  25. pinexq_client/job_management/tool/job.py +104 -7
  26. pinexq_client/job_management/tool/job_group.py +140 -0
  27. pinexq_client/job_management/tool/workdata.py +8 -0
  28. {pinexq_client-0.3.0.20240620.2.dist-info → pinexq_client-0.4.0.2024.717.1.dist-info}/METADATA +1 -1
  29. pinexq_client-0.4.0.2024.717.1.dist-info/RECORD +52 -0
  30. {pinexq_client-0.3.0.20240620.2.dist-info → pinexq_client-0.4.0.2024.717.1.dist-info}/WHEEL +1 -1
  31. pinexq_client-0.3.0.20240620.2.dist-info/RECORD +0 -50
  32. {pinexq_client-0.3.0.20240620.2.dist-info → pinexq_client-0.4.0.2024.717.1.dist-info}/licenses/LICENSE +0 -0
@@ -5,6 +5,7 @@ import httpx
5
5
 
6
6
  from pinexq_client.core.hco.hco_base import Hco
7
7
  from pinexq_client.core.hco.link_hco import LinkHco
8
+ from pinexq_client.core.hco.unavailable import UnavailableLink
8
9
  from pinexq_client.job_management.hcos.info_hco import InfoLink
9
10
  from pinexq_client.job_management.hcos.jobsroot_hco import JobsRootLink
10
11
  from pinexq_client.job_management.hcos.processingsteproot_hco import ProcessingStepsRootLink
@@ -14,44 +15,44 @@ from pinexq_client.job_management.model.sirenentities import EntryPointEntity
14
15
 
15
16
 
16
17
  class EntryPointLink(LinkHco):
17
- def navigate(self) -> 'EntryPointHco':
18
- return EntryPointHco.from_entity(self._navigate_internal(EntryPointEntity), self._client)
18
+ def navigate(self) -> 'EntryPointHco':
19
+ return EntryPointHco.from_entity(self._navigate_internal(EntryPointEntity), self._client)
19
20
 
20
21
 
21
22
  class EntrypointRelations(StrEnum):
22
- JOBS_ROOT = "JobsRoot"
23
- WORKDATA_ROOT = "WorkDataRoot"
24
- PROCESSINGSTEPS_ROOT = "ProcessingStepsRoot"
25
- INFO = "Info"
26
- ADMIN = "Admin"
23
+ JOBS_ROOT = "JobsRoot"
24
+ WORKDATA_ROOT = "WorkDataRoot"
25
+ PROCESSINGSTEPS_ROOT = "ProcessingStepsRoot"
26
+ INFO = "Info"
27
+ ADMIN = "Admin"
27
28
 
28
29
 
29
30
  class EntryPointHco(Hco[EntryPointEntity]):
30
- self_link: EntryPointLink
31
- job_root_link: JobsRootLink
32
- work_data_root_link: WorkDataRootLink
33
- processing_step_root_link: ProcessingStepsRootLink
34
- info_link: InfoLink
35
-
36
- admin_link: LinkHco | None
37
-
38
- @classmethod
39
- def from_entity(cls, entity: EntryPointEntity, client: httpx.Client) -> Self:
40
- instance = cls(client, entity)
41
- Hco.check_classes(instance._entity.class_, ["EntryPoint"])
42
-
43
- instance.self_link = EntryPointLink.from_entity(
44
- instance._client, instance._entity, Relations.SELF)
45
- instance.info_link = InfoLink.from_entity(
46
- instance._client, instance._entity, EntrypointRelations.INFO)
47
- instance.job_root_link = JobsRootLink.from_entity(
48
- instance._client, instance._entity, EntrypointRelations.JOBS_ROOT)
49
- instance.work_data_root_link = WorkDataRootLink.from_entity(
50
- instance._client, instance._entity, EntrypointRelations.WORKDATA_ROOT)
51
- instance.processing_step_root_link = ProcessingStepsRootLink.from_entity(
52
- instance._client, instance._entity, EntrypointRelations.PROCESSINGSTEPS_ROOT)
53
-
54
- instance.admin_link = LinkHco.from_entity_optional(
55
- instance._client, instance._entity, EntrypointRelations.ADMIN)
56
-
57
- return instance
31
+ self_link: EntryPointLink
32
+ job_root_link: JobsRootLink
33
+ work_data_root_link: WorkDataRootLink
34
+ processing_step_root_link: ProcessingStepsRootLink
35
+ info_link: InfoLink
36
+
37
+ admin_link: LinkHco | UnavailableLink
38
+
39
+ @classmethod
40
+ def from_entity(cls, entity: EntryPointEntity, client: httpx.Client) -> Self:
41
+ instance = cls(client, entity)
42
+ Hco.check_classes(instance._entity.class_, ["EntryPoint"])
43
+
44
+ instance.self_link = EntryPointLink.from_entity(
45
+ instance._client, instance._entity, Relations.SELF)
46
+ instance.info_link = InfoLink.from_entity(
47
+ instance._client, instance._entity, EntrypointRelations.INFO)
48
+ instance.job_root_link = JobsRootLink.from_entity(
49
+ instance._client, instance._entity, EntrypointRelations.JOBS_ROOT)
50
+ instance.work_data_root_link = WorkDataRootLink.from_entity(
51
+ instance._client, instance._entity, EntrypointRelations.WORKDATA_ROOT)
52
+ instance.processing_step_root_link = ProcessingStepsRootLink.from_entity(
53
+ instance._client, instance._entity, EntrypointRelations.PROCESSINGSTEPS_ROOT)
54
+
55
+ instance.admin_link = LinkHco.from_entity_optional(
56
+ instance._client, instance._entity, EntrypointRelations.ADMIN)
57
+
58
+ return instance
@@ -7,76 +7,78 @@ from pinexq_client.core.hco.action_hco import ActionHco
7
7
  from pinexq_client.core.hco.action_with_parameters_hco import ActionWithParametersHco
8
8
  from pinexq_client.core.hco.hco_base import Hco, Property
9
9
  from pinexq_client.core.hco.link_hco import LinkHco
10
+ from pinexq_client.core.hco.unavailable import UnavailableAction
10
11
  from pinexq_client.core.hco.upload_action_hco import UploadAction, UploadParameters
11
12
  from pinexq_client.job_management.hcos.workdata_hco import WorkDataLink, WorkDataHco
12
13
  from pinexq_client.job_management.known_relations import Relations
13
14
  from pinexq_client.job_management.model.open_api_generated import SelectWorkDataForDataSlotParameters, \
14
- SelectWorkDataCollectionForDataSlotParameters
15
+ SelectWorkDataCollectionForDataSlotParameters
15
16
  from pinexq_client.job_management.model.sirenentities import InputDataSlotEntity, WorkDataEntity
16
17
 
17
18
 
18
19
  class InputDataSlotLink(LinkHco):
19
- def navigate(self) -> 'InputDataSlotHco':
20
- return InputDataSlotHco.from_entity(self._navigate_internal(InputDataSlotEntity), self._client)
20
+ def navigate(self) -> 'InputDataSlotHco':
21
+ return InputDataSlotHco.from_entity(self._navigate_internal(InputDataSlotEntity), self._client)
21
22
 
22
23
 
23
24
  class InputDataSlotSelectWorkDataAction(ActionWithParametersHco[SelectWorkDataForDataSlotParameters]):
24
- def execute(self, parameters: SelectWorkDataForDataSlotParameters):
25
- self._execute(parameters)
25
+ def execute(self, parameters: SelectWorkDataForDataSlotParameters):
26
+ self._execute(parameters)
26
27
 
27
28
 
28
- class InputDataSlotSelectWorkDataCollectionAction(ActionWithParametersHco[SelectWorkDataCollectionForDataSlotParameters]):
29
- def execute(self, parameters: SelectWorkDataCollectionForDataSlotParameters):
30
- self._execute(parameters)
29
+ class InputDataSlotSelectWorkDataCollectionAction(
30
+ ActionWithParametersHco[SelectWorkDataCollectionForDataSlotParameters]):
31
+ def execute(self, parameters: SelectWorkDataCollectionForDataSlotParameters):
32
+ self._execute(parameters)
31
33
 
32
34
 
33
35
  class InputDataSlotUploadWorkDataAction(UploadAction):
34
- def execute(self, parameters: UploadParameters) -> WorkDataLink:
35
- url = self._upload(parameters)
36
- link = Link.from_url(url, [str(Relations.CREATED_RESSOURCE)], "Uploaded workdata", MediaTypes.SIREN)
37
- return WorkDataLink.from_link(self._client, link)
36
+ def execute(self, parameters: UploadParameters) -> WorkDataLink:
37
+ url = self._upload(parameters)
38
+ link = Link.from_url(url, [str(Relations.CREATED_RESSOURCE)], "Uploaded workdata", MediaTypes.SIREN)
39
+ return WorkDataLink.from_link(self._client, link)
38
40
 
39
41
 
40
42
  class InputDataSlotClearDataAction(ActionHco):
41
- def execute(self):
42
- self._execute_internal()
43
+ def execute(self):
44
+ self._execute_internal()
43
45
 
44
46
 
45
47
  class InputDataSlotHco(Hco[InputDataSlotEntity]):
46
- is_configured: bool | None = Property()
47
- title: str | None = Property()
48
- description: str | None = Property()
49
- media_type: str | None = Property()
50
- selected_workdatas: list[WorkDataHco] | None
51
-
52
- select_workdata_action: InputDataSlotSelectWorkDataAction | None
53
- select_workdata_collection_action: InputDataSlotSelectWorkDataCollectionAction | None
54
- clear_workdata_action: InputDataSlotClearDataAction | None
55
-
56
- @classmethod
57
- def from_entity(cls, entity: InputDataSlotEntity, client: httpx.Client) -> Self:
58
- instance = cls(client, entity)
59
- Hco.check_classes(instance._entity.class_, ["InputDataSlot"])
60
-
61
- # actions
62
- instance.select_workdata_action = InputDataSlotSelectWorkDataAction.from_entity_optional(
63
- client, instance._entity, "SelectWorkData")
64
- instance.select_workdata_collection_action = InputDataSlotSelectWorkDataCollectionAction.from_entity_optional(
65
- client, instance._entity, "SelectWorkDataCollection")
66
- instance.clear_workdata_action = InputDataSlotClearDataAction.from_entity_optional(
67
- client, instance._entity, "Clear")
68
-
69
- instance._extract_workdata()
70
-
71
- return instance
72
-
73
- def _extract_workdata(self):
74
- self.selected_workdatas = []
75
-
76
- workdatas: list[WorkDataEntity] = self._entity.find_all_entities_with_relation(Relations.SELECTED,
77
- WorkDataEntity)
78
- if not workdatas:
79
- return
80
-
81
- self.selected_workdatas = [WorkDataHco.from_entity(workdata, self._client)
82
- for workdata in workdatas]
48
+ is_configured: bool | None = Property()
49
+ title: str | None = Property()
50
+ description: str | None = Property()
51
+ media_type: str | None = Property()
52
+ selected_workdatas: list[WorkDataHco]
53
+
54
+ select_workdata_action: InputDataSlotSelectWorkDataAction | UnavailableAction
55
+ select_workdata_collection_action: InputDataSlotSelectWorkDataCollectionAction | UnavailableAction
56
+ clear_workdata_action: InputDataSlotClearDataAction | UnavailableAction
57
+
58
+ @classmethod
59
+ def from_entity(cls, entity: InputDataSlotEntity, client: httpx.Client) -> Self:
60
+ instance = cls(client, entity)
61
+ Hco.check_classes(instance._entity.class_, ["InputDataSlot"])
62
+
63
+ # actions
64
+ instance.select_workdata_action = InputDataSlotSelectWorkDataAction.from_entity_optional(
65
+ client, instance._entity, "SelectWorkData")
66
+ instance.select_workdata_collection_action = InputDataSlotSelectWorkDataCollectionAction.from_entity_optional(
67
+ client, instance._entity, "SelectWorkDataCollection")
68
+ instance.clear_workdata_action = InputDataSlotClearDataAction.from_entity_optional(
69
+ client, instance._entity, "Clear")
70
+
71
+ instance._extract_workdata()
72
+
73
+ return instance
74
+
75
+ def _extract_workdata(self):
76
+ self.selected_workdatas = []
77
+
78
+ workdatas: list[WorkDataEntity] = self._entity.find_all_entities_with_relation(Relations.SELECTED,
79
+ WorkDataEntity)
80
+ if not workdatas:
81
+ return
82
+
83
+ self.selected_workdatas = [WorkDataHco.from_entity(workdata, self._client)
84
+ for workdata in workdatas]
@@ -8,175 +8,176 @@ from pinexq_client.core.hco.action_hco import ActionHco
8
8
  from pinexq_client.core.hco.action_with_parameters_hco import ActionWithParametersHco
9
9
  from pinexq_client.core.hco.hco_base import Hco, Property
10
10
  from pinexq_client.core.hco.link_hco import LinkHco
11
+ from pinexq_client.core.hco.unavailable import UnavailableAction, UnavailableLink
11
12
  from pinexq_client.job_management.hcos import InputDataSlotHco
12
13
  from pinexq_client.job_management.hcos.output_dataslot_hco import OutputDataSlotHco
13
14
  from pinexq_client.job_management.hcos.processing_step_hco import ProcessingStepLink
14
15
  from pinexq_client.job_management.known_relations import Relations
15
16
  from pinexq_client.job_management.model.open_api_generated import JobStates, ProcessingView, RenameJobParameters, \
16
- SelectProcessingParameters, SetJobTagsParameters
17
+ SelectProcessingParameters, SetJobTagsParameters
17
18
  from pinexq_client.job_management.model.sirenentities import JobEntity, InputDataSlotEntity, OutputDataSlotEntity
18
19
 
19
20
 
20
21
  class JobRenameAction(ActionWithParametersHco[RenameJobParameters]):
21
- def execute(self, parameters: RenameJobParameters):
22
- self._execute(parameters)
22
+ def execute(self, parameters: RenameJobParameters):
23
+ self._execute(parameters)
23
24
 
24
- def default_parameters(self) -> RenameJobParameters:
25
- return self._get_default_parameters(RenameJobParameters, RenameJobParameters())
25
+ def default_parameters(self) -> RenameJobParameters:
26
+ return self._get_default_parameters(RenameJobParameters, RenameJobParameters())
26
27
 
27
28
 
28
29
  class JobSelectProcessingAction(ActionWithParametersHco[SelectProcessingParameters]):
29
- def execute(self, parameters: SelectProcessingParameters):
30
- self._execute(parameters)
30
+ def execute(self, parameters: SelectProcessingParameters):
31
+ self._execute(parameters)
31
32
 
32
- def default_parameters(self) -> SelectProcessingParameters:
33
- return self._get_default_parameters(SelectProcessingParameters, SelectProcessingParameters())
33
+ def default_parameters(self) -> SelectProcessingParameters:
34
+ return self._get_default_parameters(SelectProcessingParameters, SelectProcessingParameters())
34
35
 
35
36
 
36
37
  class JobHideAction(ActionHco):
37
- def execute(self):
38
- self._execute_internal()
38
+ def execute(self):
39
+ self._execute_internal()
39
40
 
40
41
 
41
42
  class JobUnHideAction(ActionHco):
42
- def execute(self):
43
- self._execute_internal()
43
+ def execute(self):
44
+ self._execute_internal()
44
45
 
45
46
 
46
47
  class JobDeleteAction(ActionHco):
47
- def execute(self):
48
- self._execute_internal()
48
+ def execute(self):
49
+ self._execute_internal()
49
50
 
50
51
 
51
52
  class JobAllowOutputDataDeletionAction(ActionHco):
52
- def execute(self):
53
- self._execute_internal()
53
+ def execute(self):
54
+ self._execute_internal()
54
55
 
55
56
 
56
57
  class JobDisAllowOutputDataDeletionAction(ActionHco):
57
- def execute(self):
58
- self._execute_internal()
58
+ def execute(self):
59
+ self._execute_internal()
59
60
 
60
61
 
61
62
  class GenericProcessingConfigureParameters(BaseModel):
62
- """Generic parameter model, that can be set with any dictionary"""
63
- model_config = ConfigDict(extra='allow')
63
+ """Generic parameter model, that can be set with any dictionary"""
64
+ model_config = ConfigDict(extra='allow')
64
65
 
65
66
 
66
67
  class JobConfigureProcessingAction(ActionWithParametersHco[GenericProcessingConfigureParameters]):
67
- def execute(self, parameters: GenericProcessingConfigureParameters):
68
- self._execute(parameters)
68
+ def execute(self, parameters: GenericProcessingConfigureParameters):
69
+ self._execute(parameters)
69
70
 
70
- def default_parameters(self) -> GenericProcessingConfigureParameters:
71
- return self._get_default_parameters(GenericProcessingConfigureParameters,
72
- GenericProcessingConfigureParameters())
71
+ def default_parameters(self) -> GenericProcessingConfigureParameters:
72
+ return self._get_default_parameters(GenericProcessingConfigureParameters,
73
+ GenericProcessingConfigureParameters())
73
74
 
74
75
 
75
76
  class JobStartProcessingAction(ActionHco):
76
- def execute(self):
77
- self._execute_internal()
77
+ def execute(self):
78
+ self._execute_internal()
78
79
 
79
80
 
80
81
  class JobLink(LinkHco):
81
- def navigate(self) -> 'JobHco':
82
- return JobHco.from_entity(self._navigate_internal(JobEntity), self._client)
82
+ def navigate(self) -> 'JobHco':
83
+ return JobHco.from_entity(self._navigate_internal(JobEntity), self._client)
83
84
 
84
85
 
85
86
  class ParentJobLink(LinkHco):
86
- def navigate(self) -> 'JobHco':
87
- return JobHco.from_entity(self._navigate_internal(JobEntity), self._client)
87
+ def navigate(self) -> 'JobHco':
88
+ return JobHco.from_entity(self._navigate_internal(JobEntity), self._client)
88
89
 
89
90
 
90
91
  class JobEditTagsAction(ActionWithParametersHco[SetJobTagsParameters]):
91
- def execute(self, parameters: SetJobTagsParameters):
92
- self._execute(parameters)
92
+ def execute(self, parameters: SetJobTagsParameters):
93
+ self._execute(parameters)
93
94
 
94
- def default_parameters(self) -> SetJobTagsParameters:
95
- # todo check why we have to manually set tags
96
- return self._get_default_parameters(SetJobTagsParameters, SetJobTagsParameters(tags=[]))
95
+ def default_parameters(self) -> SetJobTagsParameters:
96
+ # todo check why we have to manually set tags
97
+ return self._get_default_parameters(SetJobTagsParameters, SetJobTagsParameters(tags=[]))
97
98
 
98
99
 
99
100
  class JobHco(Hco[JobEntity]):
100
- name: str = Property()
101
- state: JobStates = Property()
102
- hidden: bool = Property()
103
- tags: list[str] | None = Property()
104
- output_is_deletable: bool = Property()
105
- created_at: datetime = Property()
106
- completed_at: datetime = Property()
107
- error_description: str = Property()
108
- processing: ProcessingView = Property()
109
- result: str = Property()
110
-
111
- self_link: JobLink
112
- parent_link: ParentJobLink | None
113
- selected_processing_step_link: ProcessingStepLink | None
114
-
115
- rename_action: JobRenameAction
116
- select_processing_action: JobSelectProcessingAction
117
- configure_processing_action: JobConfigureProcessingAction
118
- start_processing_action: JobStartProcessingAction
119
- hide_action: JobHideAction
120
- unhide_action: JobUnHideAction
121
- delete_action: JobDeleteAction
122
- allow_output_data_deletion_action: JobAllowOutputDataDeletionAction
123
- disallow_output_data_deletion_action: JobDisAllowOutputDataDeletionAction
124
- edit_tags_action: JobEditTagsAction | None
125
-
126
- input_dataslots: List[InputDataSlotHco]
127
- output_dataslots: List[OutputDataSlotHco]
128
-
129
- @classmethod
130
- def from_entity(cls, entity: JobEntity, client: httpx.Client) -> Self:
131
- instance = cls(client, entity)
132
-
133
- Hco.check_classes(instance._entity.class_, ["Job"])
134
-
135
- instance.self_link = JobLink.from_entity(
136
- instance._client, instance._entity, Relations.SELF)
137
- instance.parent_link = ParentJobLink.from_entity_optional(
138
- instance._client, instance._entity, Relations.PARENT_JOB)
139
- instance.selected_processing_step_link = ProcessingStepLink.from_entity_optional(
140
- instance._client, instance._entity, Relations.SELECTED_PROCESSING_STEP)
141
-
142
- # actions
143
- instance.hide_action = JobHideAction.from_entity_optional(
144
- client, instance._entity, "Hide")
145
- instance.unhide_action = JobUnHideAction.from_entity_optional(
146
- client, instance._entity, "UnHide")
147
- instance.delete_action = JobDeleteAction.from_entity_optional(
148
- client, instance._entity, "Delete")
149
- instance.rename_action = JobRenameAction.from_entity_optional(
150
- client, instance._entity, "Rename")
151
- instance.select_processing_action = JobSelectProcessingAction.from_entity_optional(
152
- client, instance._entity, "SelectProcessing")
153
- instance.configure_processing_action = JobConfigureProcessingAction.from_entity_optional(
154
- client, instance._entity, "ConfigureProcessing")
155
- instance.start_processing_action = JobStartProcessingAction.from_entity_optional(
156
- client, instance._entity, "StartProcessing")
157
- instance.allow_output_data_deletion_action = JobAllowOutputDataDeletionAction.from_entity_optional(
158
- client, instance._entity, "AllowOutputDataDeletion")
159
- instance.disallow_output_data_deletion_action = JobDisAllowOutputDataDeletionAction.from_entity_optional(
160
- client, instance._entity, "DisallowOutputDataDeletion")
161
- instance.edit_tags_action = JobEditTagsAction.from_entity_optional(
162
- client, instance._entity, "EditTags")
163
-
164
- # entities
165
- instance._extract_input_dataslots()
166
- instance._extract_output_dataslots()
167
-
168
- return instance
169
-
170
- def _extract_input_dataslots(self):
171
- self.input_dataslots = []
172
- input_dataslots = self._entity.find_all_entities_with_relation(Relations.INPUT_DATASLOT, InputDataSlotEntity)
173
- for input_dataslot in input_dataslots:
174
- input_dataslot_hco: InputDataSlotHco = InputDataSlotHco.from_entity(input_dataslot, self._client)
175
- self.input_dataslots.append(input_dataslot_hco)
176
-
177
- def _extract_output_dataslots(self):
178
- self.output_dataslots = []
179
- output_dataslots = self._entity.find_all_entities_with_relation(Relations.OUTPUT_DATASLOT, OutputDataSlotEntity)
180
- for output_dataslot in output_dataslots:
181
- output_dataslot_hco: OutputDataSlotHco = OutputDataSlotHco.from_entity(output_dataslot, self._client)
182
- self.output_dataslots.append(output_dataslot_hco)
101
+ name: str = Property()
102
+ state: JobStates = Property()
103
+ hidden: bool = Property()
104
+ tags: list[str] | None = Property()
105
+ output_is_deletable: bool = Property()
106
+ created_at: datetime = Property()
107
+ completed_at: datetime = Property()
108
+ error_description: str = Property()
109
+ processing: ProcessingView = Property()
110
+ result: str = Property()
111
+
112
+ self_link: JobLink
113
+ parent_link: ParentJobLink | UnavailableLink
114
+ selected_processing_step_link: ProcessingStepLink | UnavailableLink
115
+
116
+ rename_action: JobRenameAction | UnavailableAction
117
+ select_processing_action: JobSelectProcessingAction | UnavailableAction
118
+ configure_processing_action: JobConfigureProcessingAction | UnavailableAction
119
+ start_processing_action: JobStartProcessingAction | UnavailableAction
120
+ hide_action: JobHideAction | UnavailableAction
121
+ unhide_action: JobUnHideAction | UnavailableAction
122
+ delete_action: JobDeleteAction | UnavailableAction
123
+ allow_output_data_deletion_action: JobAllowOutputDataDeletionAction | UnavailableAction
124
+ disallow_output_data_deletion_action: JobDisAllowOutputDataDeletionAction | UnavailableAction
125
+ edit_tags_action: JobEditTagsAction | UnavailableAction
126
+
127
+ input_dataslots: List[InputDataSlotHco]
128
+ output_dataslots: List[OutputDataSlotHco]
129
+
130
+ @classmethod
131
+ def from_entity(cls, entity: JobEntity, client: httpx.Client) -> Self:
132
+ instance = cls(client, entity)
133
+
134
+ Hco.check_classes(instance._entity.class_, ["Job"])
135
+
136
+ instance.self_link = JobLink.from_entity(
137
+ instance._client, instance._entity, Relations.SELF)
138
+ instance.parent_link = ParentJobLink.from_entity_optional(
139
+ instance._client, instance._entity, Relations.PARENT_JOB)
140
+ instance.selected_processing_step_link = ProcessingStepLink.from_entity_optional(
141
+ instance._client, instance._entity, Relations.SELECTED_PROCESSING_STEP)
142
+
143
+ # actions
144
+ instance.hide_action = JobHideAction.from_entity_optional(
145
+ client, instance._entity, "Hide")
146
+ instance.unhide_action = JobUnHideAction.from_entity_optional(
147
+ client, instance._entity, "UnHide")
148
+ instance.delete_action = JobDeleteAction.from_entity_optional(
149
+ client, instance._entity, "Delete")
150
+ instance.rename_action = JobRenameAction.from_entity_optional(
151
+ client, instance._entity, "Rename")
152
+ instance.select_processing_action = JobSelectProcessingAction.from_entity_optional(
153
+ client, instance._entity, "SelectProcessing")
154
+ instance.configure_processing_action = JobConfigureProcessingAction.from_entity_optional(
155
+ client, instance._entity, "ConfigureProcessing")
156
+ instance.start_processing_action = JobStartProcessingAction.from_entity_optional(
157
+ client, instance._entity, "StartProcessing")
158
+ instance.allow_output_data_deletion_action = JobAllowOutputDataDeletionAction.from_entity_optional(
159
+ client, instance._entity, "AllowOutputDataDeletion")
160
+ instance.disallow_output_data_deletion_action = JobDisAllowOutputDataDeletionAction.from_entity_optional(
161
+ client, instance._entity, "DisallowOutputDataDeletion")
162
+ instance.edit_tags_action = JobEditTagsAction.from_entity_optional(
163
+ client, instance._entity, "EditTags")
164
+
165
+ # entities
166
+ instance._extract_input_dataslots()
167
+ instance._extract_output_dataslots()
168
+
169
+ return instance
170
+
171
+ def _extract_input_dataslots(self):
172
+ self.input_dataslots = []
173
+ input_dataslots = self._entity.find_all_entities_with_relation(Relations.INPUT_DATASLOT, InputDataSlotEntity)
174
+ for input_dataslot in input_dataslots:
175
+ input_dataslot_hco: InputDataSlotHco = InputDataSlotHco.from_entity(input_dataslot, self._client)
176
+ self.input_dataslots.append(input_dataslot_hco)
177
+
178
+ def _extract_output_dataslots(self):
179
+ self.output_dataslots = []
180
+ output_dataslots = self._entity.find_all_entities_with_relation(Relations.OUTPUT_DATASLOT, OutputDataSlotEntity)
181
+ for output_dataslot in output_dataslots:
182
+ output_dataslot_hco: OutputDataSlotHco = OutputDataSlotHco.from_entity(output_dataslot, self._client)
183
+ self.output_dataslots.append(output_dataslot_hco)