pinexq-client 0.3.0.2024.610.1__py3-none-any.whl → 0.3.0.20240620.2__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.
- pinexq_client/job_management/__init__.py +2 -2
- pinexq_client/job_management/enterjma.py +1 -1
- pinexq_client/job_management/hcos/input_dataslot_hco.py +2 -2
- pinexq_client/job_management/hcos/job_hco.py +8 -0
- pinexq_client/job_management/hcos/job_query_result_hco.py +1 -0
- pinexq_client/job_management/hcos/output_dataslot_hco.py +2 -2
- pinexq_client/job_management/hcos/processing_step_hco.py +49 -6
- pinexq_client/job_management/hcos/processingstep_query_result_hco.py +2 -1
- pinexq_client/job_management/hcos/workdata_query_result_hco.py +2 -1
- pinexq_client/job_management/model/open_api_generated.py +39 -16
- pinexq_client/job_management/tool/__init__.py +2 -0
- pinexq_client/job_management/tool/job.py +132 -54
- pinexq_client/job_management/tool/processing_step.py +182 -0
- pinexq_client/job_management/tool/workdata.py +148 -0
- {pinexq_client-0.3.0.2024.610.1.dist-info → pinexq_client-0.3.0.20240620.2.dist-info}/METADATA +2 -2
- {pinexq_client-0.3.0.2024.610.1.dist-info → pinexq_client-0.3.0.20240620.2.dist-info}/RECORD +18 -17
- {pinexq_client-0.3.0.2024.610.1.dist-info → pinexq_client-0.3.0.20240620.2.dist-info}/WHEEL +1 -1
- pinexq_client/job_management/ideas.md +0 -28
- {pinexq_client-0.3.0.2024.610.1.dist-info → pinexq_client-0.3.0.20240620.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -35,7 +35,7 @@ def enter_jma(
|
|
|
35
35
|
jma_version = [int(i) for i in str.split(info.api_version, '.')]
|
|
36
36
|
if not _version_match_major_minor(jma_version, client_version):
|
|
37
37
|
LOG.warning(
|
|
38
|
-
f"Version mismatch between '
|
|
38
|
+
f"Version mismatch between 'pinexq_client' (v{'.'.join(map(str ,client_version))}) "
|
|
39
39
|
f"and 'JobManagementAPI' (v{'.'.join(map(str, jma_version))})! "
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -78,5 +78,5 @@ class InputDataSlotHco(Hco[InputDataSlotEntity]):
|
|
|
78
78
|
if not workdatas:
|
|
79
79
|
return
|
|
80
80
|
|
|
81
|
-
self.selected_workdatas =
|
|
82
|
-
|
|
81
|
+
self.selected_workdatas = [WorkDataHco.from_entity(workdata, self._client)
|
|
82
|
+
for workdata in workdatas]
|
|
@@ -43,6 +43,11 @@ class JobUnHideAction(ActionHco):
|
|
|
43
43
|
self._execute_internal()
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
class JobDeleteAction(ActionHco):
|
|
47
|
+
def execute(self):
|
|
48
|
+
self._execute_internal()
|
|
49
|
+
|
|
50
|
+
|
|
46
51
|
class JobAllowOutputDataDeletionAction(ActionHco):
|
|
47
52
|
def execute(self):
|
|
48
53
|
self._execute_internal()
|
|
@@ -113,6 +118,7 @@ class JobHco(Hco[JobEntity]):
|
|
|
113
118
|
start_processing_action: JobStartProcessingAction
|
|
114
119
|
hide_action: JobHideAction
|
|
115
120
|
unhide_action: JobUnHideAction
|
|
121
|
+
delete_action: JobDeleteAction
|
|
116
122
|
allow_output_data_deletion_action: JobAllowOutputDataDeletionAction
|
|
117
123
|
disallow_output_data_deletion_action: JobDisAllowOutputDataDeletionAction
|
|
118
124
|
edit_tags_action: JobEditTagsAction | None
|
|
@@ -138,6 +144,8 @@ class JobHco(Hco[JobEntity]):
|
|
|
138
144
|
client, instance._entity, "Hide")
|
|
139
145
|
instance.unhide_action = JobUnHideAction.from_entity_optional(
|
|
140
146
|
client, instance._entity, "UnHide")
|
|
147
|
+
instance.delete_action = JobDeleteAction.from_entity_optional(
|
|
148
|
+
client, instance._entity, "Delete")
|
|
141
149
|
instance.rename_action = JobRenameAction.from_entity_optional(
|
|
142
150
|
client, instance._entity, "Rename")
|
|
143
151
|
instance.select_processing_action = JobSelectProcessingAction.from_entity_optional(
|
|
@@ -30,6 +30,7 @@ class JobQueryResultHco(Hco[JobQueryResultEntity]):
|
|
|
30
30
|
total_entities: int = Property()
|
|
31
31
|
current_entities_count: int = Property()
|
|
32
32
|
jobs: List[JobHco]
|
|
33
|
+
remaining_tags: List[str] | None = Property()
|
|
33
34
|
|
|
34
35
|
@classmethod
|
|
35
36
|
def from_entity(cls, client: httpx.Client, entity: JobQueryResultEntity) -> 'JobQueryResultHco':
|
|
@@ -40,5 +40,5 @@ class OutputDataSlotHco(Hco[OutputDataSlotEntity]):
|
|
|
40
40
|
if not workdatas:
|
|
41
41
|
return
|
|
42
42
|
|
|
43
|
-
self.assigned_workdatas =
|
|
44
|
-
|
|
43
|
+
self.assigned_workdatas = [WorkDataHco.from_entity(workdata, self._client)
|
|
44
|
+
for workdata in workdatas]
|
|
@@ -2,12 +2,17 @@ from datetime import datetime
|
|
|
2
2
|
from typing import List, Self
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
|
+
from pydantic import BaseModel, ConfigDict
|
|
5
6
|
|
|
7
|
+
from pinexq_client.core import upload_json
|
|
8
|
+
from pinexq_client.core.hco.action_hco import ActionHco
|
|
6
9
|
from pinexq_client.core.hco.action_with_parameters_hco import ActionWithParametersHco
|
|
7
10
|
from pinexq_client.core.hco.download_link_hco import DownloadLinkHco
|
|
8
11
|
from pinexq_client.core.hco.hco_base import Hco, Property
|
|
9
12
|
from pinexq_client.core.hco.link_hco import LinkHco
|
|
13
|
+
from pinexq_client.core.hco.upload_action_hco import UploadAction, UploadParameters
|
|
10
14
|
from pinexq_client.job_management.known_relations import Relations
|
|
15
|
+
from pinexq_client.job_management.model import EditProcessingStepParameters
|
|
11
16
|
from pinexq_client.job_management.model.open_api_generated import DataSpecificationHto, \
|
|
12
17
|
SetProcessingStepTagsParameters
|
|
13
18
|
from pinexq_client.job_management.model.sirenentities import ProcessingStepEntity
|
|
@@ -27,6 +32,38 @@ class ProcessingStepEditTagsAction(ActionWithParametersHco[SetProcessingStepTags
|
|
|
27
32
|
return self._get_default_parameters(SetProcessingStepTagsParameters, SetProcessingStepTagsParameters(tags=[]))
|
|
28
33
|
|
|
29
34
|
|
|
35
|
+
class ProcessingStepEditPropertiesAction(ActionWithParametersHco[EditProcessingStepParameters]):
|
|
36
|
+
def execute(self, parameters: EditProcessingStepParameters):
|
|
37
|
+
self._execute(parameters)
|
|
38
|
+
|
|
39
|
+
def default_parameters(self) -> EditProcessingStepParameters:
|
|
40
|
+
return self._get_default_parameters(EditProcessingStepParameters, EditProcessingStepParameters())
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class GenericProcessingConfigureParameters(BaseModel):
|
|
44
|
+
"""Generic parameter model, that can be set with any dictionary"""
|
|
45
|
+
model_config = ConfigDict(extra='allow')
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ConfigureDefaultParametersAction(ActionWithParametersHco[GenericProcessingConfigureParameters]):
|
|
49
|
+
def execute(self, parameters: GenericProcessingConfigureParameters):
|
|
50
|
+
self._execute(parameters)
|
|
51
|
+
|
|
52
|
+
def default_parameters(self) -> GenericProcessingConfigureParameters:
|
|
53
|
+
return self._get_default_parameters(GenericProcessingConfigureParameters,
|
|
54
|
+
GenericProcessingConfigureParameters())
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class ClearDefaultParametersAction(ActionHco):
|
|
58
|
+
def execute(self):
|
|
59
|
+
self._execute_internal()
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class UploadConfigurationAction(UploadAction):
|
|
63
|
+
def execute(self, parameters: UploadParameters):
|
|
64
|
+
upload_json(self._client, self._action, parameters.json_, parameters.filename)
|
|
65
|
+
|
|
66
|
+
|
|
30
67
|
class ProcessingStepHco(Hco[ProcessingStepEntity]):
|
|
31
68
|
title: str = Property()
|
|
32
69
|
version: str | None = Property()
|
|
@@ -46,6 +83,10 @@ class ProcessingStepHco(Hco[ProcessingStepEntity]):
|
|
|
46
83
|
input_data_slot_specification: List[DataSpecificationHto] | None = Property()
|
|
47
84
|
output_data_slot_specification: List[DataSpecificationHto] | None = Property()
|
|
48
85
|
edit_tags_action: ProcessingStepEditTagsAction | None
|
|
86
|
+
edit_properties_action: ProcessingStepEditPropertiesAction | None
|
|
87
|
+
configure_default_parameters_action: ConfigureDefaultParametersAction | None
|
|
88
|
+
clear_default_parameters_action: ClearDefaultParametersAction | None
|
|
89
|
+
upload_configuration_action: UploadConfigurationAction | None
|
|
49
90
|
|
|
50
91
|
self_link: ProcessingStepLink
|
|
51
92
|
download_link: DownloadLinkHco
|
|
@@ -60,12 +101,14 @@ class ProcessingStepHco(Hco[ProcessingStepEntity]):
|
|
|
60
101
|
|
|
61
102
|
# todo tests
|
|
62
103
|
|
|
63
|
-
# actions
|
|
64
|
-
# todo
|
|
65
|
-
# "EditProperties"
|
|
66
|
-
# "Upload"
|
|
67
|
-
# "ConfigureDefaultParameters"
|
|
68
|
-
# "ClearDefaultParameters"
|
|
69
104
|
instance.edit_tags_action = ProcessingStepEditTagsAction.from_entity_optional(
|
|
70
105
|
client, instance._entity, "EditTags")
|
|
106
|
+
instance.edit_properties_action = ProcessingStepEditPropertiesAction.from_entity_optional(
|
|
107
|
+
client, instance._entity, "EditProperties")
|
|
108
|
+
instance.configure_default_parameters_action = ConfigureDefaultParametersAction.from_entity_optional(
|
|
109
|
+
client, instance._entity, "ConfigureDefaultParameters")
|
|
110
|
+
instance.clear_default_parameters_action = ClearDefaultParametersAction.from_entity_optional(
|
|
111
|
+
client, instance._entity, "ClearDefaultParameters")
|
|
112
|
+
instance.upload_configuration_action = UploadConfigurationAction.from_entity_optional(
|
|
113
|
+
client, instance._entity, "Upload")
|
|
71
114
|
return instance
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Self
|
|
1
|
+
from typing import Self, List
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
|
|
@@ -28,6 +28,7 @@ class ProcessingStepQueryResultHco(Hco[ProcessingStepQueryResultEntity]):
|
|
|
28
28
|
total_entities: int = Property()
|
|
29
29
|
current_entities_count: int = Property()
|
|
30
30
|
processing_steps: list[ProcessingStepHco]
|
|
31
|
+
remaining_tags: List[str] | None = Property()
|
|
31
32
|
|
|
32
33
|
self_link: ProcessingStepQueryResultLink
|
|
33
34
|
all_link: ProcessingStepQueryResultPaginationLink | None
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Self
|
|
1
|
+
from typing import Self, List
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
|
|
@@ -25,6 +25,7 @@ class WorkDataQueryResultHco(Hco[WorkDataQueryResultEntity]):
|
|
|
25
25
|
total_entities: int = Property()
|
|
26
26
|
current_entities_count: int = Property()
|
|
27
27
|
workdatas: list[WorkDataHco]
|
|
28
|
+
remaining_tags: List[str] | None = Property()
|
|
28
29
|
|
|
29
30
|
self_link: WorkDataQueryResultLink
|
|
30
31
|
all_link: WorkDataQueryResultPaginationLink | None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
2
|
# filename: openapi.json
|
|
3
|
-
# timestamp: 2024-
|
|
3
|
+
# timestamp: 2024-06-17T15:26:52+00:00
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
@@ -18,20 +18,7 @@ class AdminJobQueryResultHtoOpenApiProperties(BaseModel):
|
|
|
18
18
|
total_entities: int | None = Field(None, alias='TotalEntities')
|
|
19
19
|
current_entities_count: int | None = Field(None, alias='CurrentEntitiesCount')
|
|
20
20
|
previous_entities_count: int | None = Field(None, alias='PreviousEntitiesCount')
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class AdminProcessingStepFilterParameter(BaseModel):
|
|
24
|
-
model_config = ConfigDict(
|
|
25
|
-
extra='allow',
|
|
26
|
-
populate_by_name=True,
|
|
27
|
-
)
|
|
28
|
-
function_name_contains: str | None = Field(None, alias='FunctionNameContains')
|
|
29
|
-
title_contains: str | None = Field(None, alias='TitleContains')
|
|
30
|
-
version: str | None = Field(None, alias='Version')
|
|
31
|
-
description_contains: str | None = Field(None, alias='DescriptionContains')
|
|
32
|
-
tags_by_and: List[str] | None = Field(None, alias='TagsByAnd')
|
|
33
|
-
tags_by_or: List[str] | None = Field(None, alias='TagsByOr')
|
|
34
|
-
is_public: bool | None = Field(None, alias='IsPublic')
|
|
21
|
+
remaining_tags: List[str] | None = Field(None, alias='RemainingTags')
|
|
35
22
|
|
|
36
23
|
|
|
37
24
|
class AdminProcessingStepQueryResultHtoOpenApiProperties(BaseModel):
|
|
@@ -42,6 +29,7 @@ class AdminProcessingStepQueryResultHtoOpenApiProperties(BaseModel):
|
|
|
42
29
|
total_entities: int | None = Field(None, alias='TotalEntities')
|
|
43
30
|
current_entities_count: int | None = Field(None, alias='CurrentEntitiesCount')
|
|
44
31
|
previous_entities_count: int | None = Field(None, alias='PreviousEntitiesCount')
|
|
32
|
+
remaining_tags: List[str] | None = Field(None, alias='RemainingTags')
|
|
45
33
|
|
|
46
34
|
|
|
47
35
|
class AdminWorkDataQueryResultHtoOpenApiProperties(BaseModel):
|
|
@@ -52,6 +40,7 @@ class AdminWorkDataQueryResultHtoOpenApiProperties(BaseModel):
|
|
|
52
40
|
total_entities: int | None = Field(None, alias='TotalEntities')
|
|
53
41
|
current_entities_count: int | None = Field(None, alias='CurrentEntitiesCount')
|
|
54
42
|
previous_entities_count: int | None = Field(None, alias='PreviousEntitiesCount')
|
|
43
|
+
remaining_tags: List[str] | None = Field(None, alias='RemainingTags')
|
|
55
44
|
|
|
56
45
|
|
|
57
46
|
class CreateJobParameters(BaseModel):
|
|
@@ -131,6 +120,11 @@ class FieldModel(BaseModel):
|
|
|
131
120
|
allow_multiple: bool | None = Field(None, alias='allowMultiple')
|
|
132
121
|
|
|
133
122
|
|
|
123
|
+
class FunctionNameMatchTypes(Enum):
|
|
124
|
+
contains = 'Contains'
|
|
125
|
+
match_exact = 'MatchExact'
|
|
126
|
+
|
|
127
|
+
|
|
134
128
|
class InfoHtoOpenApiProperties(BaseModel):
|
|
135
129
|
model_config = ConfigDict(
|
|
136
130
|
extra='allow',
|
|
@@ -149,6 +143,7 @@ class JobQueryResultHtoOpenApiProperties(BaseModel):
|
|
|
149
143
|
total_entities: int | None = Field(None, alias='TotalEntities')
|
|
150
144
|
current_entities_count: int | None = Field(None, alias='CurrentEntitiesCount')
|
|
151
145
|
previous_entities_count: int | None = Field(None, alias='PreviousEntitiesCount')
|
|
146
|
+
remaining_tags: List[str] | None = Field(None, alias='RemainingTags')
|
|
152
147
|
|
|
153
148
|
|
|
154
149
|
class JobSortProperties(Enum):
|
|
@@ -223,7 +218,10 @@ class ProcessingStepFilterParameter(BaseModel):
|
|
|
223
218
|
extra='allow',
|
|
224
219
|
populate_by_name=True,
|
|
225
220
|
)
|
|
226
|
-
|
|
221
|
+
function_name: str | None = Field(None, alias='FunctionName')
|
|
222
|
+
function_name_match_type: FunctionNameMatchTypes | None = Field(
|
|
223
|
+
None, alias='FunctionNameMatchType'
|
|
224
|
+
)
|
|
227
225
|
title_contains: str | None = Field(None, alias='TitleContains')
|
|
228
226
|
version: str | None = Field(None, alias='Version')
|
|
229
227
|
description_contains: str | None = Field(None, alias='DescriptionContains')
|
|
@@ -278,6 +276,7 @@ class ProcessingStepQueryResultHtoOpenApiProperties(BaseModel):
|
|
|
278
276
|
total_entities: int | None = Field(None, alias='TotalEntities')
|
|
279
277
|
current_entities_count: int | None = Field(None, alias='CurrentEntitiesCount')
|
|
280
278
|
previous_entities_count: int | None = Field(None, alias='PreviousEntitiesCount')
|
|
279
|
+
remaining_tags: List[str] | None = Field(None, alias='RemainingTags')
|
|
281
280
|
|
|
282
281
|
|
|
283
282
|
class ProcessingStepRootHtoOpenApiProperties(BaseModel):
|
|
@@ -418,6 +417,7 @@ class WorkDataQueryResultHtoOpenApiProperties(BaseModel):
|
|
|
418
417
|
total_entities: int | None = Field(None, alias='TotalEntities')
|
|
419
418
|
current_entities_count: int | None = Field(None, alias='CurrentEntitiesCount')
|
|
420
419
|
previous_entities_count: int | None = Field(None, alias='PreviousEntitiesCount')
|
|
420
|
+
remaining_tags: List[str] | None = Field(None, alias='RemainingTags')
|
|
421
421
|
|
|
422
422
|
|
|
423
423
|
class WorkDataRootHtoOpenApiProperties(BaseModel):
|
|
@@ -504,6 +504,23 @@ class AdminJobQueryResultHtoOpenApi(BaseModel):
|
|
|
504
504
|
links: List[Link] | None = None
|
|
505
505
|
|
|
506
506
|
|
|
507
|
+
class AdminProcessingStepFilterParameter(BaseModel):
|
|
508
|
+
model_config = ConfigDict(
|
|
509
|
+
extra='allow',
|
|
510
|
+
populate_by_name=True,
|
|
511
|
+
)
|
|
512
|
+
function_name: str | None = Field(None, alias='FunctionName')
|
|
513
|
+
function_name_match_type: FunctionNameMatchTypes | None = Field(
|
|
514
|
+
None, alias='FunctionNameMatchType'
|
|
515
|
+
)
|
|
516
|
+
title_contains: str | None = Field(None, alias='TitleContains')
|
|
517
|
+
version: str | None = Field(None, alias='Version')
|
|
518
|
+
description_contains: str | None = Field(None, alias='DescriptionContains')
|
|
519
|
+
tags_by_and: List[str] | None = Field(None, alias='TagsByAnd')
|
|
520
|
+
tags_by_or: List[str] | None = Field(None, alias='TagsByOr')
|
|
521
|
+
is_public: bool | None = Field(None, alias='IsPublic')
|
|
522
|
+
|
|
523
|
+
|
|
507
524
|
class AdminProcessingStepQueryResultHtoOpenApi(BaseModel):
|
|
508
525
|
model_config = ConfigDict(
|
|
509
526
|
extra='allow',
|
|
@@ -542,6 +559,7 @@ class AdminWorkDataQueryParameters(BaseModel):
|
|
|
542
559
|
pagination: Pagination | None = Field(None, alias='Pagination')
|
|
543
560
|
sort_by: WorkDataSortPropertiesSortParameter | None = Field(None, alias='SortBy')
|
|
544
561
|
filter: AdminWorkDataFilterParameter | None = Field(None, alias='Filter')
|
|
562
|
+
include_remaining_tags: bool | None = Field(None, alias='IncludeRemainingTags')
|
|
545
563
|
|
|
546
564
|
|
|
547
565
|
class AdminWorkDataQueryResultHtoOpenApi(BaseModel):
|
|
@@ -779,6 +797,7 @@ class WorkDataQueryParameters(BaseModel):
|
|
|
779
797
|
pagination: Pagination | None = Field(None, alias='Pagination')
|
|
780
798
|
sort_by: WorkDataSortPropertiesSortParameter | None = Field(None, alias='SortBy')
|
|
781
799
|
filter: WorkDataFilterParameter | None = Field(None, alias='Filter')
|
|
800
|
+
include_remaining_tags: bool | None = Field(None, alias='IncludeRemainingTags')
|
|
782
801
|
|
|
783
802
|
|
|
784
803
|
class WorkDataQueryResultHtoOpenApi(BaseModel):
|
|
@@ -828,6 +847,7 @@ class AdminJobQueryParameters(BaseModel):
|
|
|
828
847
|
pagination: Pagination | None = Field(None, alias='Pagination')
|
|
829
848
|
sort_by: JobSortPropertiesSortParameter | None = Field(None, alias='SortBy')
|
|
830
849
|
filter: AdminJobFilterParameter | None = Field(None, alias='Filter')
|
|
850
|
+
include_remaining_tags: bool | None = Field(None, alias='IncludeRemainingTags')
|
|
831
851
|
|
|
832
852
|
|
|
833
853
|
class AdminProcessingStepQueryParameters(BaseModel):
|
|
@@ -840,6 +860,7 @@ class AdminProcessingStepQueryParameters(BaseModel):
|
|
|
840
860
|
None, alias='SortBy'
|
|
841
861
|
)
|
|
842
862
|
filter: AdminProcessingStepFilterParameter | None = Field(None, alias='Filter')
|
|
863
|
+
include_remaining_tags: bool | None = Field(None, alias='IncludeRemainingTags')
|
|
843
864
|
|
|
844
865
|
|
|
845
866
|
class JobHtoOpenApi(BaseModel):
|
|
@@ -863,6 +884,7 @@ class JobQueryParameters(BaseModel):
|
|
|
863
884
|
pagination: Pagination | None = Field(None, alias='Pagination')
|
|
864
885
|
sort_by: JobSortPropertiesSortParameter | None = Field(None, alias='SortBy')
|
|
865
886
|
filter: JobFilterParameter | None = Field(None, alias='Filter')
|
|
887
|
+
include_remaining_tags: bool | None = Field(None, alias='IncludeRemainingTags')
|
|
866
888
|
|
|
867
889
|
|
|
868
890
|
class ProcessingStepQueryParameters(BaseModel):
|
|
@@ -875,6 +897,7 @@ class ProcessingStepQueryParameters(BaseModel):
|
|
|
875
897
|
None, alias='SortBy'
|
|
876
898
|
)
|
|
877
899
|
filter: ProcessingStepFilterParameter | None = Field(None, alias='Filter')
|
|
900
|
+
include_remaining_tags: bool | None = Field(None, alias='IncludeRemainingTags')
|
|
878
901
|
|
|
879
902
|
|
|
880
903
|
class WorkDataHtoOpenApi(BaseModel):
|
|
@@ -7,11 +7,11 @@ from httpx import URL
|
|
|
7
7
|
from pinexq_client.core import Link, MediaTypes
|
|
8
8
|
from pinexq_client.core.polling import wait_until, PollingException
|
|
9
9
|
from pinexq_client.job_management.enterjma import enter_jma
|
|
10
|
-
from pinexq_client.job_management.hcos import WorkDataLink
|
|
10
|
+
from pinexq_client.job_management.hcos import WorkDataLink, ProcessingStepLink, InputDataSlotHco, OutputDataSlotHco
|
|
11
11
|
from pinexq_client.job_management.hcos.entrypoint_hco import EntryPointHco
|
|
12
12
|
from pinexq_client.job_management.hcos.job_hco import (
|
|
13
|
-
JobHco,
|
|
14
13
|
GenericProcessingConfigureParameters,
|
|
14
|
+
JobHco,
|
|
15
15
|
JobLink,
|
|
16
16
|
)
|
|
17
17
|
from pinexq_client.job_management.hcos.job_query_result_hco import JobQueryResultHco
|
|
@@ -22,16 +22,22 @@ from pinexq_client.job_management.hcos.processingsteproot_hco import (
|
|
|
22
22
|
from pinexq_client.job_management.known_relations import Relations
|
|
23
23
|
from pinexq_client.job_management.model import (
|
|
24
24
|
CreateJobParameters,
|
|
25
|
-
ProcessingStepQueryParameters,
|
|
26
|
-
ProcessingStepFilterParameter,
|
|
27
|
-
SelectProcessingParameters,
|
|
28
|
-
JobStates,
|
|
29
25
|
CreateSubJobParameters,
|
|
26
|
+
FunctionNameMatchTypes,
|
|
27
|
+
JobFilterParameter,
|
|
30
28
|
JobQueryParameters,
|
|
31
29
|
JobSortPropertiesSortParameter,
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
JobStates,
|
|
31
|
+
ProcessingStepFilterParameter,
|
|
32
|
+
ProcessingStepQueryParameters,
|
|
33
|
+
ProcessingView,
|
|
34
|
+
SelectProcessingParameters,
|
|
35
|
+
SelectWorkDataCollectionForDataSlotParameters,
|
|
36
|
+
SelectWorkDataForDataSlotParameters,
|
|
37
|
+
SetJobTagsParameters,
|
|
34
38
|
)
|
|
39
|
+
from pinexq_client.job_management.tool.processing_step import ProcessingStep
|
|
40
|
+
from pinexq_client.job_management.tool.workdata import WorkData
|
|
35
41
|
|
|
36
42
|
|
|
37
43
|
class Job:
|
|
@@ -88,6 +94,21 @@ class Job:
|
|
|
88
94
|
def _get_by_link(self, job_link: JobLink):
|
|
89
95
|
self._job = job_link.navigate()
|
|
90
96
|
|
|
97
|
+
@classmethod
|
|
98
|
+
def from_hco(cls, client: httpx.Client, job: JobHco) -> Self:
|
|
99
|
+
"""Initializes a `Job` object from an existing JobHco object.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
client: An httpx.Client instance initialized with the api-host-url as `base_url`
|
|
103
|
+
job: The 'JobHco' to initialize this job from.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
The newly created job as `Job` object.
|
|
107
|
+
"""
|
|
108
|
+
job_instance = cls(client)
|
|
109
|
+
job_instance._job = job
|
|
110
|
+
return job_instance
|
|
111
|
+
|
|
91
112
|
@classmethod
|
|
92
113
|
def from_url(cls, client: httpx.Client, job_url: URL) -> Self:
|
|
93
114
|
"""Initializes a `Job` object from an existing job given by its link as URL.
|
|
@@ -144,31 +165,43 @@ class Job:
|
|
|
144
165
|
self.refresh()
|
|
145
166
|
return self._job.state
|
|
146
167
|
|
|
147
|
-
def select_processing(
|
|
168
|
+
def select_processing(
|
|
169
|
+
self,
|
|
170
|
+
function_name: str | None = None,
|
|
171
|
+
processing_step_link: ProcessingStepLink | None = None,
|
|
172
|
+
processing_step_instance: ProcessingStep | None = None
|
|
173
|
+
) -> Self:
|
|
148
174
|
"""Set the processing step for this job given by name. This will query all
|
|
149
175
|
processing steps of this name from the server and select the first result.
|
|
150
176
|
|
|
151
177
|
Args:
|
|
152
|
-
|
|
178
|
+
function_name: Name of the processing step as string
|
|
179
|
+
processing_step_link: A ProcessingStepLink instance pointing to the resource
|
|
180
|
+
processing_step_instance: A ProcessingStep (not the Hco) instance
|
|
153
181
|
|
|
154
182
|
Returns:
|
|
155
183
|
This `Job` object
|
|
156
184
|
"""
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
185
|
+
if sum(p is not None for p in [function_name, processing_step_link, processing_step_instance]) != 1:
|
|
186
|
+
raise ValueError("Exactly one parameter must be provided")
|
|
187
|
+
|
|
188
|
+
if processing_step_link is not None:
|
|
189
|
+
processing_url = processing_step_link.get_url()
|
|
190
|
+
elif processing_step_instance is not None:
|
|
191
|
+
processing_url = processing_step_instance.self_link().get_url()
|
|
192
|
+
else:
|
|
193
|
+
# ToDo: provide more parameters to query a processing step
|
|
194
|
+
query_param = ProcessingStepQueryParameters(
|
|
195
|
+
filter=ProcessingStepFilterParameter(
|
|
196
|
+
function_name=function_name,
|
|
197
|
+
function_name_match_type=FunctionNameMatchTypes.match_exact
|
|
198
|
+
)
|
|
161
199
|
)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if len(candidates) > 1:
|
|
168
|
-
raise AttributeError(f"Multiple results querying processing step '{processing_step}'!")
|
|
169
|
-
assert len(candidates) == 1
|
|
170
|
-
# Todo: For now we choose the first and only result. Make this more flexible?
|
|
171
|
-
processing_url = candidates[0].self_link.get_url()
|
|
200
|
+
query_result = self._processing_step_root.query_action.execute(query_param)
|
|
201
|
+
if len(query_result.processing_steps) != 1:
|
|
202
|
+
raise AttributeError(f"No processing step with the name '{function_name}' registered!")
|
|
203
|
+
# Todo: For now we choose the first and only result. Make this more flexible?
|
|
204
|
+
processing_url = query_result.processing_steps[0].self_link.get_url()
|
|
172
205
|
|
|
173
206
|
self._job.select_processing_action.execute(
|
|
174
207
|
SelectProcessingParameters(processing_step_url=str(processing_url))
|
|
@@ -251,40 +284,68 @@ class Job:
|
|
|
251
284
|
|
|
252
285
|
return self
|
|
253
286
|
|
|
254
|
-
def assign_input_dataslot(
|
|
287
|
+
def assign_input_dataslot(
|
|
288
|
+
self,
|
|
289
|
+
index: int,
|
|
290
|
+
work_data_link: WorkDataLink | None = None,
|
|
291
|
+
work_data_instance: WorkData | None = None
|
|
292
|
+
) -> Self:
|
|
255
293
|
"""Assign WorkData to DataSlots.
|
|
256
294
|
|
|
257
295
|
Args:
|
|
258
296
|
index: The numerical index of the dataslot.
|
|
259
|
-
|
|
297
|
+
work_data_link: WorkData given by its URL
|
|
298
|
+
work_data_instance: WorkData instance
|
|
260
299
|
|
|
261
300
|
Returns:
|
|
262
301
|
This `Job` object
|
|
263
302
|
"""
|
|
303
|
+
if sum(p is not None for p in [work_data_link, work_data_instance]) != 1:
|
|
304
|
+
raise ValueError("Exactly one parameter must be provided")
|
|
305
|
+
|
|
306
|
+
if work_data_instance is not None:
|
|
307
|
+
work_data = work_data_instance.self_link()
|
|
308
|
+
else:
|
|
309
|
+
work_data = work_data_link
|
|
310
|
+
|
|
264
311
|
dataslot = self._job.input_dataslots[index]
|
|
265
312
|
dataslot.select_workdata_action.execute(
|
|
266
313
|
parameters=SelectWorkDataForDataSlotParameters(
|
|
267
|
-
work_data_url=str(
|
|
314
|
+
work_data_url=str(work_data.get_url())
|
|
268
315
|
)
|
|
269
316
|
)
|
|
270
317
|
self.refresh()
|
|
271
318
|
|
|
272
319
|
return self
|
|
273
320
|
|
|
274
|
-
def assign_collection_input_dataslot(
|
|
321
|
+
def assign_collection_input_dataslot(
|
|
322
|
+
self,
|
|
323
|
+
index: int,
|
|
324
|
+
work_data_links: list[WorkDataLink] | None = None,
|
|
325
|
+
work_data_instances: list[WorkData] | None = None
|
|
326
|
+
) -> Self:
|
|
275
327
|
"""Assign WorkData to DataSlots.
|
|
276
328
|
|
|
277
329
|
Args:
|
|
278
330
|
index: The numerical index of the dataslot.
|
|
279
|
-
|
|
331
|
+
work_data_links: WorkData collection given by their URLs
|
|
332
|
+
work_data_instances: Collection of WorkData instances
|
|
280
333
|
|
|
281
334
|
Returns:
|
|
282
335
|
This `Job` object
|
|
283
336
|
"""
|
|
337
|
+
if sum(p is not None for p in [work_data_links, work_data_instances]) != 1:
|
|
338
|
+
raise ValueError("Exactly one parameter must be provided")
|
|
339
|
+
|
|
340
|
+
if work_data_instances is not None:
|
|
341
|
+
work_datas = [work_data_instance.self_link() for work_data_instance in work_data_instances]
|
|
342
|
+
else:
|
|
343
|
+
work_datas = work_data_links
|
|
344
|
+
|
|
284
345
|
dataslot = self._job.input_dataslots[index]
|
|
285
346
|
dataslot.select_workdata_collection_action.execute(
|
|
286
347
|
parameters=SelectWorkDataCollectionForDataSlotParameters(
|
|
287
|
-
work_data_urls=
|
|
348
|
+
work_data_urls=[str(workdata_link.get_url()) for workdata_link in work_datas]
|
|
288
349
|
)
|
|
289
350
|
)
|
|
290
351
|
self.refresh()
|
|
@@ -351,7 +412,7 @@ class Job:
|
|
|
351
412
|
"""Wait for all sub-jobs to reach the state 'completed'.
|
|
352
413
|
|
|
353
414
|
This function will block execution until the state is reached or raise an exception
|
|
354
|
-
if the operation timed out or a sub-job returned an error.
|
|
415
|
+
if the operation timed out or a sub-job returned an error. Only started jobs will be watched.
|
|
355
416
|
|
|
356
417
|
Args:
|
|
357
418
|
timeout_ms: Timeout to wait for the sub-jobs to reach the next state.
|
|
@@ -369,13 +430,10 @@ class Job:
|
|
|
369
430
|
timeout_ms=timeout_ms,
|
|
370
431
|
timeout_message=f"Timeout while waiting for sub-jobs to complete! [timeout: {timeout_ms}ms]",
|
|
371
432
|
)
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
timeout_ms=timeout_ms,
|
|
377
|
-
timeout_message=f"Timeout while waiting for sub-jobs to complete! [timeout: {timeout_ms}ms]",
|
|
378
|
-
)
|
|
433
|
+
|
|
434
|
+
error_count = self.sub_jobs_in_state(JobStates.error)
|
|
435
|
+
if error_count > 0:
|
|
436
|
+
raise PollingException(f"{f':Sub-jobs returned an error! {error_count} sub-jobs in state error .'}")
|
|
379
437
|
return self
|
|
380
438
|
|
|
381
439
|
def hide(self) -> Self:
|
|
@@ -388,55 +446,75 @@ class Job:
|
|
|
388
446
|
self.refresh()
|
|
389
447
|
return self
|
|
390
448
|
|
|
391
|
-
def
|
|
449
|
+
def delete(self) -> Self:
|
|
450
|
+
"""Delete this job.
|
|
451
|
+
|
|
452
|
+
Returns:
|
|
453
|
+
This `Job` object
|
|
454
|
+
"""
|
|
455
|
+
self._job.delete_action.execute()
|
|
456
|
+
return self
|
|
457
|
+
|
|
458
|
+
def unhide(self) -> Self:
|
|
392
459
|
"""Reveal this job again.
|
|
393
460
|
|
|
394
461
|
Returns:
|
|
395
|
-
This `Job` object
|
|
462
|
+
This `Job` object
|
|
463
|
+
"""
|
|
396
464
|
self._job.unhide_action.execute()
|
|
397
465
|
self.refresh()
|
|
398
466
|
return self
|
|
399
467
|
|
|
400
|
-
def allow_output_data_deletion(self):
|
|
468
|
+
def allow_output_data_deletion(self) -> Self:
|
|
401
469
|
"""Mark all output workdata from this job as "deletable".
|
|
402
470
|
|
|
403
471
|
Returns:
|
|
404
|
-
This `Job` object
|
|
472
|
+
This `Job` object
|
|
473
|
+
"""
|
|
405
474
|
self._job.allow_output_data_deletion_action.execute()
|
|
406
475
|
self.refresh()
|
|
407
476
|
return self
|
|
408
477
|
|
|
409
|
-
def disallow_output_data_deletion(self):
|
|
478
|
+
def disallow_output_data_deletion(self) -> Self:
|
|
410
479
|
"""Mark all output workdata from this job as "not deletable".
|
|
411
480
|
|
|
412
481
|
Returns:
|
|
413
|
-
This `Job` object
|
|
482
|
+
This `Job` object
|
|
483
|
+
"""
|
|
414
484
|
self._job.disallow_output_data_deletion_action.execute()
|
|
415
485
|
self.refresh()
|
|
416
486
|
return self
|
|
417
487
|
|
|
418
|
-
def set_tags(self, tags: list[str]):
|
|
488
|
+
def set_tags(self, tags: list[str]) -> Self:
|
|
419
489
|
"""Set tags to the job.
|
|
420
490
|
|
|
421
491
|
Returns:
|
|
422
|
-
This `Job` object
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
492
|
+
This `Job` object
|
|
493
|
+
"""
|
|
494
|
+
self._job.edit_tags_action.execute(
|
|
495
|
+
SetJobTagsParameters(tags=tags)
|
|
496
|
+
)
|
|
426
497
|
self.refresh()
|
|
427
498
|
return self
|
|
428
499
|
|
|
429
|
-
|
|
430
|
-
def get_input_data_slots(self):
|
|
500
|
+
def get_input_data_slots(self) -> list[InputDataSlotHco]:
|
|
431
501
|
"""Returns list of InputDataSlotHco objects.
|
|
432
502
|
|
|
433
503
|
Returns:
|
|
434
|
-
`list[InputDataSlotHco]` object
|
|
504
|
+
`list[InputDataSlotHco]` object
|
|
505
|
+
"""
|
|
435
506
|
return self._job.input_dataslots
|
|
436
507
|
|
|
437
|
-
def get_output_data_slots(self):
|
|
508
|
+
def get_output_data_slots(self) -> list[OutputDataSlotHco]:
|
|
438
509
|
"""Returns list of OutputDataSlotHco objects.
|
|
439
510
|
|
|
440
511
|
Returns:
|
|
441
|
-
`list[OutputDataSlotHco]` object
|
|
512
|
+
`list[OutputDataSlotHco]` object
|
|
513
|
+
"""
|
|
442
514
|
return self._job.output_dataslots
|
|
515
|
+
|
|
516
|
+
def get_processing_info(self) -> ProcessingView:
|
|
517
|
+
return self._job.processing
|
|
518
|
+
|
|
519
|
+
def self_link(self) -> JobLink:
|
|
520
|
+
return self._job.self_link
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
from typing import Any, Self
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
from httpx import URL
|
|
5
|
+
|
|
6
|
+
from pinexq_client.core import Link, MediaTypes
|
|
7
|
+
from pinexq_client.core.hco.upload_action_hco import UploadParameters
|
|
8
|
+
from pinexq_client.job_management.enterjma import enter_jma
|
|
9
|
+
from pinexq_client.job_management.hcos import ProcessingStepHco, ProcessingStepLink
|
|
10
|
+
from pinexq_client.job_management.hcos.entrypoint_hco import EntryPointHco
|
|
11
|
+
from pinexq_client.job_management.hcos.job_hco import GenericProcessingConfigureParameters
|
|
12
|
+
from pinexq_client.job_management.hcos.processingsteproot_hco import ProcessingStepsRootHco
|
|
13
|
+
from pinexq_client.job_management.known_relations import Relations
|
|
14
|
+
from pinexq_client.job_management.model import (
|
|
15
|
+
CreateProcessingStepParameters,
|
|
16
|
+
EditProcessingStepParameters,
|
|
17
|
+
SetProcessingStepTagsParameters,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ProcessingStep:
|
|
22
|
+
"""Convenience wrapper for handling ProcessingStepHcos in the JobManagement-Api.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
_client: httpx.Client
|
|
26
|
+
_entrypoint: EntryPointHco
|
|
27
|
+
_processing_steps_root: ProcessingStepsRootHco
|
|
28
|
+
_processing_step: ProcessingStepHco | None = None
|
|
29
|
+
|
|
30
|
+
def __init__(self, client: httpx.Client):
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
client: An httpx.Client instance initialized with the api-host-url as `base_url`
|
|
35
|
+
"""
|
|
36
|
+
self._client = client
|
|
37
|
+
self._entrypoint = enter_jma(client)
|
|
38
|
+
self._processing_steps_root = self._entrypoint.processing_step_root_link.navigate()
|
|
39
|
+
|
|
40
|
+
def create(self, title: str, function_name: str) -> Self:
|
|
41
|
+
"""
|
|
42
|
+
Creates a new ProcessingStep by name.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
title: Title of the ProcessingStep to be created
|
|
46
|
+
function_name: Function name of the ProcessingStep to be created
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
The newly created ProcessingStep as `ProcessingStep` object
|
|
50
|
+
"""
|
|
51
|
+
processing_step_hco = self._processing_steps_root.register_new_action.execute(CreateProcessingStepParameters(
|
|
52
|
+
title=title,
|
|
53
|
+
function_name=function_name
|
|
54
|
+
))
|
|
55
|
+
self._processing_step = processing_step_hco
|
|
56
|
+
return self
|
|
57
|
+
|
|
58
|
+
def _get_by_link(self, processing_step_link: ProcessingStepLink):
|
|
59
|
+
self._processing_step = processing_step_link.navigate()
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def from_hco(cls, client: httpx.Client, processing_step: ProcessingStepHco) -> Self:
|
|
63
|
+
"""Initializes a `ProcessingStep` object from an existing ProcessingStepHco object.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
client: An httpx.Client instance initialized with the api-host-url as `base_url`
|
|
67
|
+
processing_step: The 'ProcessingStepHco' to initialize this ProcessingStep from.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
The newly created processing step as `ProcessingStep` object.
|
|
71
|
+
"""
|
|
72
|
+
processing_step_instance = cls(client)
|
|
73
|
+
processing_step_instance._processing_step = processing_step
|
|
74
|
+
return processing_step_instance
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_url(cls, client: httpx.Client, processing_step_url: URL) -> Self:
|
|
78
|
+
"""Initializes a `ProcessingStep` object from an existing processing step given by its link as URL.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
client: An httpx.Client instance initialized with the api-host-url as `base_url`
|
|
82
|
+
processing_step_url: The URL of the processing step
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
The newly created processing step as `ProcessingStep` object
|
|
86
|
+
"""
|
|
87
|
+
link = Link.from_url(
|
|
88
|
+
processing_step_url,
|
|
89
|
+
[str(Relations.CREATED_RESSOURCE)],
|
|
90
|
+
"Created processing step",
|
|
91
|
+
MediaTypes.SIREN,
|
|
92
|
+
)
|
|
93
|
+
processing_step_instance = cls(client)
|
|
94
|
+
processing_step_instance._get_by_link(ProcessingStepLink.from_link(client, link))
|
|
95
|
+
return processing_step_instance
|
|
96
|
+
|
|
97
|
+
def refresh(self) -> Self:
|
|
98
|
+
"""Updates the processing step from the server
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
This `ProcessingStep` object, but with updated properties.
|
|
102
|
+
"""
|
|
103
|
+
self._processing_step = self._processing_step.self_link.navigate()
|
|
104
|
+
return self
|
|
105
|
+
|
|
106
|
+
def set_tags(self, tags: list[str]) -> Self:
|
|
107
|
+
"""Set tags to the processing step.
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
This `ProcessingStep` object"""
|
|
111
|
+
self._processing_step.edit_tags_action.execute(SetProcessingStepTagsParameters(
|
|
112
|
+
tags=tags
|
|
113
|
+
))
|
|
114
|
+
self.refresh()
|
|
115
|
+
return self
|
|
116
|
+
|
|
117
|
+
def edit_properties(
|
|
118
|
+
self,
|
|
119
|
+
*,
|
|
120
|
+
new_title: str | None = None,
|
|
121
|
+
new_function_name: str | None = None,
|
|
122
|
+
is_public: bool | None = None
|
|
123
|
+
) -> Self:
|
|
124
|
+
"""Edit processing step properties.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
This `ProcessingStep` object"""
|
|
128
|
+
self._processing_step.edit_properties_action.execute(EditProcessingStepParameters(
|
|
129
|
+
title=new_title,
|
|
130
|
+
function_name=new_function_name,
|
|
131
|
+
is_public=is_public
|
|
132
|
+
))
|
|
133
|
+
self.refresh()
|
|
134
|
+
return self
|
|
135
|
+
|
|
136
|
+
def configure_default_parameters(self, **parameters: Any) -> Self:
|
|
137
|
+
"""Set the parameters to run the processing step with.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
**parameters: Any keyword parameters provided will be forwarded as parameters
|
|
141
|
+
to the processing step function.
|
|
142
|
+
|
|
143
|
+
Returns:
|
|
144
|
+
This `ProcessingStep` object
|
|
145
|
+
"""
|
|
146
|
+
self._processing_step.configure_default_parameters_action.execute(
|
|
147
|
+
GenericProcessingConfigureParameters.model_validate(parameters)
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
self.refresh()
|
|
151
|
+
return self
|
|
152
|
+
|
|
153
|
+
def clear_default_parameters(self) -> Self:
|
|
154
|
+
"""Clear default parameters.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
This `ProcessingStep` object
|
|
158
|
+
"""
|
|
159
|
+
self._processing_step.clear_default_parameters_action.execute()
|
|
160
|
+
self.refresh()
|
|
161
|
+
|
|
162
|
+
return self
|
|
163
|
+
|
|
164
|
+
def upload_configuration(self, json_data: Any) -> Self:
|
|
165
|
+
"""Upload processing configuration.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
This `ProcessingStep` object
|
|
169
|
+
"""
|
|
170
|
+
self._processing_step.upload_configuration_action.execute(
|
|
171
|
+
UploadParameters(
|
|
172
|
+
filename="config.json", # placeholder, jma does not care about filename
|
|
173
|
+
mediatype=MediaTypes.APPLICATION_JSON,
|
|
174
|
+
json=json_data
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
self.refresh()
|
|
178
|
+
|
|
179
|
+
return self
|
|
180
|
+
|
|
181
|
+
def self_link(self) -> ProcessingStepLink:
|
|
182
|
+
return self._processing_step.self_link
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
from io import IOBase
|
|
2
|
+
from typing import Self, Any, Iterable, AsyncIterable
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
from httpx import URL
|
|
6
|
+
|
|
7
|
+
from pinexq_client.core import Link, MediaTypes
|
|
8
|
+
from pinexq_client.core.hco.upload_action_hco import UploadParameters
|
|
9
|
+
from pinexq_client.job_management.enterjma import enter_jma
|
|
10
|
+
from pinexq_client.job_management.hcos import WorkDataLink, WorkDataRootHco, WorkDataHco
|
|
11
|
+
from pinexq_client.job_management.hcos.entrypoint_hco import EntryPointHco
|
|
12
|
+
from pinexq_client.job_management.known_relations import Relations
|
|
13
|
+
from pinexq_client.job_management.model import SetTagsWorkDataParameters
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class WorkData:
|
|
17
|
+
"""Convenience wrapper for handling WorkDataHcos in the JobManagement-Api.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
_client: httpx.Client
|
|
21
|
+
_entrypoint: EntryPointHco
|
|
22
|
+
_work_data_root: WorkDataRootHco
|
|
23
|
+
_work_data: WorkDataHco | None = None
|
|
24
|
+
|
|
25
|
+
def __init__(self, client: httpx.Client):
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
client: An httpx.Client instance initialized with the api-host-url as `base_url`
|
|
30
|
+
"""
|
|
31
|
+
self._client = client
|
|
32
|
+
self._entrypoint = enter_jma(client)
|
|
33
|
+
self._work_data_root = self._entrypoint.work_data_root_link.navigate()
|
|
34
|
+
|
|
35
|
+
def create(
|
|
36
|
+
self,
|
|
37
|
+
*,
|
|
38
|
+
filename: str,
|
|
39
|
+
mediatype: str = MediaTypes.OCTET_STREAM,
|
|
40
|
+
json: Any | None = None,
|
|
41
|
+
file: IOBase | None = None,
|
|
42
|
+
binary: str | bytes | Iterable[bytes] | AsyncIterable[bytes] | None = None
|
|
43
|
+
) -> Self:
|
|
44
|
+
work_data_link = self._work_data_root.upload_action.execute(
|
|
45
|
+
UploadParameters(
|
|
46
|
+
filename=filename, binary=binary, json=json, file=file, mediatype=mediatype
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
self._get_by_link(work_data_link)
|
|
50
|
+
return self
|
|
51
|
+
|
|
52
|
+
def _get_by_link(self, processing_step_link: WorkDataLink):
|
|
53
|
+
self._work_data = processing_step_link.navigate()
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_hco(cls, client: httpx.Client, work_data: WorkDataHco) -> Self:
|
|
57
|
+
"""Initializes a `WorkData` object from an existing WorkDataHco object.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
client: An httpx.Client instance initialized with the api-host-url as `base_url`
|
|
61
|
+
work_data: The WorkDataHco to initialize this WorkData from.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
The newly created work data as `WorkData` object.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
work_data_instance = cls(client)
|
|
68
|
+
work_data_instance._work_data = work_data
|
|
69
|
+
return work_data_instance
|
|
70
|
+
|
|
71
|
+
@classmethod
|
|
72
|
+
def from_url(cls, client: httpx.Client, work_data_url: URL) -> Self:
|
|
73
|
+
"""Initializes a `WorkData` object from an existing work data given by its link as URL.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
client: An httpx.Client instance initialized with the api-host-url as `base_url`
|
|
77
|
+
work_data_url: The URL of the work data
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
The newly created work data as `WorkData` object
|
|
81
|
+
"""
|
|
82
|
+
link = Link.from_url(
|
|
83
|
+
work_data_url,
|
|
84
|
+
[str(Relations.CREATED_RESSOURCE)],
|
|
85
|
+
"Uploaded work data",
|
|
86
|
+
MediaTypes.SIREN,
|
|
87
|
+
)
|
|
88
|
+
processing_step_instance = cls(client)
|
|
89
|
+
processing_step_instance._get_by_link(WorkDataLink.from_link(client, link))
|
|
90
|
+
return processing_step_instance
|
|
91
|
+
|
|
92
|
+
def refresh(self) -> Self:
|
|
93
|
+
"""Updates the work data from the server
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
This `WorkData` object, but with updated properties.
|
|
97
|
+
"""
|
|
98
|
+
self._work_data = self._work_data.self_link.navigate()
|
|
99
|
+
return self
|
|
100
|
+
|
|
101
|
+
def set_tags(self, tags: list[str]):
|
|
102
|
+
"""Set tags to the processing step.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
This `WorkData` object"""
|
|
106
|
+
self._work_data.edit_tags_action.execute(SetTagsWorkDataParameters(
|
|
107
|
+
tags=tags
|
|
108
|
+
))
|
|
109
|
+
self.refresh()
|
|
110
|
+
return self
|
|
111
|
+
|
|
112
|
+
def allow_deletion(self) -> Self:
|
|
113
|
+
"""Allow deletion.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
This `WorkData` object"""
|
|
117
|
+
self._work_data.allow_deletion_action.execute()
|
|
118
|
+
self.refresh()
|
|
119
|
+
return self
|
|
120
|
+
|
|
121
|
+
def disallow_deletion(self) -> Self:
|
|
122
|
+
"""Disallow deletion.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
This `WorkData` object"""
|
|
126
|
+
self._work_data.disallow_deletion_action.execute()
|
|
127
|
+
self.refresh()
|
|
128
|
+
return self
|
|
129
|
+
|
|
130
|
+
def hide(self) -> Self:
|
|
131
|
+
"""Hide WorkData.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
This `WorkData` object"""
|
|
135
|
+
self._work_data.hide_action.execute()
|
|
136
|
+
self.refresh()
|
|
137
|
+
return self
|
|
138
|
+
|
|
139
|
+
def delete(self) -> Self:
|
|
140
|
+
"""Delete WorkData.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
This `WorkData` object"""
|
|
144
|
+
self._work_data.delete_action.execute()
|
|
145
|
+
return self
|
|
146
|
+
|
|
147
|
+
def self_link(self) -> WorkDataLink:
|
|
148
|
+
return self._work_data.self_link
|
{pinexq_client-0.3.0.2024.610.1.dist-info → pinexq_client-0.3.0.20240620.2.dist-info}/METADATA
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pinexq-client
|
|
3
|
-
Version: 0.3.0.
|
|
3
|
+
Version: 0.3.0.20240620.2
|
|
4
4
|
Summary: A hypermedia-based client for the DataCybernetics PinexQ platform.
|
|
5
|
-
Author-Email: =?utf-8?q?Sebastian_H=C3=B6fer?= <hoefer@data-cybernetics.com>, Mathias Reichardt <reichardt@data-cybernetics.com>
|
|
5
|
+
Author-Email: =?utf-8?q?Sebastian_H=C3=B6fer?= <hoefer@data-cybernetics.com>, Mathias Reichardt <reichardt@data-cybernetics.com>, Pratik Poudel <poudel@data-cybernetics.com>
|
|
6
6
|
Maintainer-Email: Mathias Reichardt <reichardt@data-cybernetics.com>, =?utf-8?q?Sebastian_H=C3=B6fer?= <hoefer@data-cybernetics.com>, Carsten Blank <blank@data-cybernetics.com>
|
|
7
7
|
License: MIT
|
|
8
8
|
Requires-Python: >=3.11
|
{pinexq_client-0.3.0.2024.610.1.dist-info → pinexq_client-0.3.0.20240620.2.dist-info}/RECORD
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
pinexq_client-0.3.0.
|
|
2
|
-
pinexq_client-0.3.0.
|
|
3
|
-
pinexq_client-0.3.0.
|
|
1
|
+
pinexq_client-0.3.0.20240620.2.dist-info/METADATA,sha256=70gP6h5Th1XwWj_vF4icSkOllhZ97qy2qM1ohWDhwSc,3236
|
|
2
|
+
pinexq_client-0.3.0.20240620.2.dist-info/WHEEL,sha256=SOP-4bEE0jbVaCHQGVvF08uWxk5rcSsfEybvoQVHlD8,90
|
|
3
|
+
pinexq_client-0.3.0.20240620.2.dist-info/licenses/LICENSE,sha256=3oz3tAhM7kOgRukkRe7wmh5T_HihZY77ZtJDJm91ZN8,1072
|
|
4
4
|
pinexq_client/core/__init__.py,sha256=8SVD_PRgJtpUCOtVjdR6fRrv6KPNk7HD6UQrn0FKR04,235
|
|
5
5
|
pinexq_client/core/base_relations.py,sha256=oIUS58pkbMDdqm-3YOdsenhL1smtzeAk4fp7-U595MY,162
|
|
6
6
|
pinexq_client/core/enterapi.py,sha256=FutPNPBEaoCgb_uTi19z-AQjQGBxfISkTFI7e6wkOdQ,611
|
|
@@ -19,31 +19,32 @@ pinexq_client/core/model/error.py,sha256=U-9U1TRc77UNIQe_rvnwzNkTjrUEem3pKMx2c9r
|
|
|
19
19
|
pinexq_client/core/model/sirenmodels.py,sha256=vGRQlhM2cSa2caxQel91Jr48KWqM-vMYX32iaQCzIds,5547
|
|
20
20
|
pinexq_client/core/polling.py,sha256=Z6VXn-PCGk4XX-4tQWZG59qJyCIS0eIrpPUORQDIGrs,1077
|
|
21
21
|
pinexq_client/core/sirenaccess.py,sha256=5p8twdB0FYMhhBNPH3-xDX20jWR4-b2h8F3BDoyc7C8,6978
|
|
22
|
-
pinexq_client/job_management/__init__.py,sha256=
|
|
23
|
-
pinexq_client/job_management/enterjma.py,sha256=
|
|
22
|
+
pinexq_client/job_management/__init__.py,sha256=BB5Bik_9rwjDLXCanYzEJgJuLJxwEeRqHH2rWvBdQFY,164
|
|
23
|
+
pinexq_client/job_management/enterjma.py,sha256=R72Wzd4UEGNkkqe1WC80B9VCyMc5kt7gNv0RAad6ibE,1443
|
|
24
24
|
pinexq_client/job_management/hcos/__init__.py,sha256=vMIdxGHBsVcKYKrVkCzD4a_VaheKSNxCimospFn5N88,396
|
|
25
25
|
pinexq_client/job_management/hcos/entrypoint_hco.py,sha256=i4n8R4h1ZGinwuCH2Rj7dwzOkqOd1hQKS3SXmHk1-9A,2316
|
|
26
26
|
pinexq_client/job_management/hcos/info_hco.py,sha256=zWjR63SCEO_sUcZ9ha_aIoC_qUzAWLf50Xu4AHddAn8,1328
|
|
27
|
-
pinexq_client/job_management/hcos/input_dataslot_hco.py,sha256=
|
|
28
|
-
pinexq_client/job_management/hcos/job_hco.py,sha256
|
|
29
|
-
pinexq_client/job_management/hcos/job_query_result_hco.py,sha256=
|
|
27
|
+
pinexq_client/job_management/hcos/input_dataslot_hco.py,sha256=hyfuT5eQb5JSPfhdP4mcOkxVx1BsBJNfWbAXKHgkHrQ,3631
|
|
28
|
+
pinexq_client/job_management/hcos/job_hco.py,sha256=wa2UF8-RmJg8Vt26O5yS4bTH5qWeVjA0enDGdKGIWxo,7631
|
|
29
|
+
pinexq_client/job_management/hcos/job_query_result_hco.py,sha256=IzEi7ul240luUIuEfiTHwezrEJbGXknvyu7R6I25v5g,3044
|
|
30
30
|
pinexq_client/job_management/hcos/job_used_tags_hco.py,sha256=nys6E97NNXATdnvX6KZ46JR9qEb2lnqol9ZvJVEiNpQ,944
|
|
31
31
|
pinexq_client/job_management/hcos/jobsroot_hco.py,sha256=3UPhMyHb9zZO7AQbsCrY_0aimd__VQL54C4vzxgrq0o,3640
|
|
32
|
-
pinexq_client/job_management/hcos/output_dataslot_hco.py,sha256=
|
|
33
|
-
pinexq_client/job_management/hcos/processing_step_hco.py,sha256=
|
|
32
|
+
pinexq_client/job_management/hcos/output_dataslot_hco.py,sha256=c5__JR2W4GeJ87pYkF43as3U7G6qgt7FrVzEMo8_-ho,1549
|
|
33
|
+
pinexq_client/job_management/hcos/processing_step_hco.py,sha256=7DcHMchq-2JekcZbu6sT53HR_SehNPrNZKmZ8QHT5Go,5391
|
|
34
34
|
pinexq_client/job_management/hcos/processing_step_used_tags_hco.py,sha256=90-2IWlYTcYX62NzmAPnmcUCwMDhmMZyBrNs_G3yigs,1067
|
|
35
|
-
pinexq_client/job_management/hcos/processingstep_query_result_hco.py,sha256=
|
|
35
|
+
pinexq_client/job_management/hcos/processingstep_query_result_hco.py,sha256=WIOeB_rW2_AEjRpJZqAZotZFXi0vUz0i0sepI6vRg8Q,3304
|
|
36
36
|
pinexq_client/job_management/hcos/processingsteproot_hco.py,sha256=xdgVt__1js7NQZJjmvZuisgZkAynN0Dgw9pBnpPhTcs,3758
|
|
37
37
|
pinexq_client/job_management/hcos/user_hco.py,sha256=z6USe-4nYzBfOoEx3n9_UbgomMTimg4EIa_XeVBj01A,1095
|
|
38
38
|
pinexq_client/job_management/hcos/workdata_hco.py,sha256=jJ0gemgmJ9uHzOTUCA7eBtGbQViCoSmaT3p-2ZIWF30,4934
|
|
39
|
-
pinexq_client/job_management/hcos/workdata_query_result_hco.py,sha256=
|
|
39
|
+
pinexq_client/job_management/hcos/workdata_query_result_hco.py,sha256=uX4EH-5cQLhEnBGbWXSebQU-BuRNGYPxolKruwNyMDk,2984
|
|
40
40
|
pinexq_client/job_management/hcos/workdata_used_tags_query_result_hco.py,sha256=qB1iQpwD63579dq3tUF4DBB_rZRMqJ80y1ysf-41aOo,1087
|
|
41
41
|
pinexq_client/job_management/hcos/workdataroot_hco.py,sha256=isivaMxYV8KwTgFe2W5PuhJ_CJUmZO_Pz_yakwKUup8,4043
|
|
42
|
-
pinexq_client/job_management/ideas.md,sha256=dA2qGLbgh561iLqDn792XhfxHPHdVJ__GpFxcEMTghY,431
|
|
43
42
|
pinexq_client/job_management/known_relations.py,sha256=UlOF-sua8SyOPNNKzT_j6JVG8T-aewHIzn7S2ajXBhI,593
|
|
44
43
|
pinexq_client/job_management/model/__init__.py,sha256=ApHhNfjx4bPuz10sQnyBA2zajYbU7loDTZSKC5H_jBY,34
|
|
45
|
-
pinexq_client/job_management/model/open_api_generated.py,sha256=
|
|
44
|
+
pinexq_client/job_management/model/open_api_generated.py,sha256=TwGg54yv55j3CCetXG9LXaukgFHVkSuBkyGfN1LtcbY,30212
|
|
46
45
|
pinexq_client/job_management/model/sirenentities.py,sha256=OInvxHpC6mnnYQjOMM2xAw7uLtvWwj9E2EQSRJe2jDo,3202
|
|
47
|
-
pinexq_client/job_management/tool/__init__.py,sha256=
|
|
48
|
-
pinexq_client/job_management/tool/job.py,sha256=
|
|
49
|
-
pinexq_client
|
|
46
|
+
pinexq_client/job_management/tool/__init__.py,sha256=58CRDcP8ifSx9eA2uyTLEg0_fX3FUuNUogY_lirx9AY,96
|
|
47
|
+
pinexq_client/job_management/tool/job.py,sha256=qBCAZu3GRcgQ-9tct7pkyUkQlg3YdR0fr1mMqoXkL4c,17308
|
|
48
|
+
pinexq_client/job_management/tool/processing_step.py,sha256=A8IFemh0MRQUYlHzLhp0Ou4rlMv6OUiZYd4XXmscUfM,6337
|
|
49
|
+
pinexq_client/job_management/tool/workdata.py,sha256=nlfwhCyeYpg20SBy63moHwvxNFCWAmwrhVIpl7mjSe4,4712
|
|
50
|
+
pinexq_client-0.3.0.20240620.2.dist-info/RECORD,,
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
class EntryPoint():
|
|
2
|
-
|
|
3
|
-
@LinkRelateion("Info")
|
|
4
|
-
Info: Link[Info]
|
|
5
|
-
|
|
6
|
-
@LinkRelateion("ProcessingSteps")
|
|
7
|
-
@Mandatory
|
|
8
|
-
ProcessingSteps: MandatoryLink[Info]
|
|
9
|
-
|
|
10
|
-
user: User = Info.navigate().User.navigate()
|
|
11
|
-
seld["CreateUser"].Excecute()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
entrypoint.navigate("Info")
|
|
15
|
-
def CreateUser(dojgpsj):
|
|
16
|
-
|
|
17
|
-
class Info():
|
|
18
|
-
|
|
19
|
-
CurrentUser: Link[User]
|
|
20
|
-
|
|
21
|
-
class User():
|
|
22
|
-
|
|
23
|
-
class Job():
|
|
24
|
-
|
|
25
|
-
name = ""
|
|
26
|
-
title = ""
|
|
27
|
-
status = ""
|
|
28
|
-
|
|
File without changes
|