pinexq-client 0.9.2.20250506.42__py3-none-any.whl → 0.9.2.20250716.44__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.
@@ -22,4 +22,4 @@ from .model import JobSortPropertiesSortParameter, ProcessingView
22
22
  from .tool import Job, JobGroup, ProcessingStep, WorkData
23
23
 
24
24
  # Protocol version the JMA is using
25
- __jma_version__ = [7, 5, 0]
25
+ __jma_version__ = [7, 6, 0]
@@ -15,6 +15,7 @@ from pinexq_client.job_management.hcos.job_query_result_hco import (
15
15
  )
16
16
  from pinexq_client.job_management.hcos.job_used_tags_hco import JobUsedTagsLink
17
17
  from pinexq_client.job_management.known_relations import Relations
18
+ from pinexq_client.job_management.model import RapidJobSetupParameters
18
19
  from pinexq_client.job_management.model.open_api_generated import (
19
20
  CreateJobParameters,
20
21
  JobQueryParameters,
@@ -43,6 +44,16 @@ class CreateSubJobAction(ActionWithParametersHco[CreateSubJobParameters]):
43
44
  return self._get_default_parameters(CreateSubJobParameters, CreateSubJobParameters())
44
45
 
45
46
 
47
+ class RapidJobSetupAction(ActionWithParametersHco[RapidJobSetupParameters]):
48
+ def execute(self, parameters: RapidJobSetupParameters) -> JobLink:
49
+ url: URL = self._execute_returns_url(parameters)
50
+ link = Link.from_url(url, [str(Relations.CREATED_RESSOURCE)], "Rapid job setup", MediaTypes.SIREN)
51
+ return JobLink.from_link(self._client, link)
52
+
53
+ def default_parameters(self) -> RapidJobSetupParameters:
54
+ return self._get_default_parameters(RapidJobSetupParameters, RapidJobSetupParameters())
55
+
56
+
46
57
  class JobQueryAction(ActionWithParametersHco):
47
58
  def execute(self, parameters: JobQueryParameters) -> JobQueryResultHco:
48
59
  url = self._execute_returns_url(parameters)
@@ -56,6 +67,7 @@ class JobQueryAction(ActionWithParametersHco):
56
67
 
57
68
  class JobsRootHco(Hco[JobsRootEntity]):
58
69
  create_job_action: CreateJobAction | UnavailableAction
70
+ rapid_job_setup_action: RapidJobSetupAction | UnavailableAction
59
71
  job_query_action: JobQueryAction | UnavailableAction
60
72
  create_subjob_action: CreateSubJobAction | UnavailableAction
61
73
  used_tags_link: JobUsedTagsLink | UnavailableLink
@@ -70,6 +82,8 @@ class JobsRootHco(Hco[JobsRootEntity]):
70
82
  instance.create_job_action = CreateJobAction.from_entity_optional(client, instance._entity, "CreateJob")
71
83
  instance.create_subjob_action = CreateSubJobAction.from_entity_optional(client, instance._entity,
72
84
  "CreateSubJob")
85
+ instance.rapid_job_setup_action = RapidJobSetupAction.from_entity_optional(client, instance._entity,
86
+ "RapidSetupJob")
73
87
  instance.job_query_action = JobQueryAction.from_entity_optional(client, instance._entity, "CreateJobQuery")
74
88
  instance.used_tags_link = JobUsedTagsLink.from_entity_optional(
75
89
  instance._client, instance._entity, Relations.USED_TAGS)
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: openapi.json
3
- # timestamp: 2025-05-04T15:01:47+00:00
3
+ # timestamp: 2025-05-14T12:10:18+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -137,6 +137,15 @@ class InfoHtoOpenApiProperties(BaseModel):
137
137
  used_storage_in_bytes: int | None = Field(None, alias='UsedStorageInBytes')
138
138
 
139
139
 
140
+ class InputDataSlotParameter(BaseModel):
141
+ model_config = ConfigDict(
142
+ extra='allow',
143
+ populate_by_name=True,
144
+ )
145
+ index: int | None = Field(None, alias='Index')
146
+ work_data_urls: List[str] | None = Field(None, alias='WorkDataUrls')
147
+
148
+
140
149
  class JobQueryResultHtoOpenApiProperties(BaseModel):
141
150
  model_config = ConfigDict(
142
151
  extra='allow',
@@ -324,6 +333,25 @@ class ProcessingView(BaseModel):
324
333
  )
325
334
 
326
335
 
336
+ class RapidJobSetupParameters(BaseModel):
337
+ model_config = ConfigDict(
338
+ extra='allow',
339
+ populate_by_name=True,
340
+ )
341
+ name: constr(min_length=1) = Field(..., alias='Name')
342
+ processing_step_url: str | None = Field(None, alias='ProcessingStepUrl')
343
+ parent_job_url: str | None = Field(None, alias='ParentJobUrl')
344
+ tags: List[str] | None = Field(None, alias='Tags')
345
+ parameters: str | None = Field(None, alias='Parameters')
346
+ allow_output_data_deletion: bool | None = Field(
347
+ None, alias='AllowOutputDataDeletion'
348
+ )
349
+ input_data_slots: List[InputDataSlotParameter] | None = Field(
350
+ None, alias='InputDataSlots'
351
+ )
352
+ start: bool | None = Field(None, alias='Start')
353
+
354
+
327
355
  class RenameJobParameters(BaseModel):
328
356
  model_config = ConfigDict(
329
357
  extra='allow',
@@ -659,8 +687,8 @@ class JobHtoOpenApiProperties(BaseModel):
659
687
  hidden: bool | None = Field(None, alias='Hidden')
660
688
  output_is_deletable: bool | None = Field(None, alias='OutputIsDeletable')
661
689
  created_at: AwareDatetime | None = Field(None, alias='CreatedAt')
662
- completed_at: AwareDatetime | None = Field(None, alias='CompletedAt')
663
690
  started_at: AwareDatetime | None = Field(None, alias='StartedAt')
691
+ completed_at: AwareDatetime | None = Field(None, alias='CompletedAt')
664
692
  error_description: str | None = Field(None, alias='ErrorDescription')
665
693
  processing: ProcessingView | None = Field(None, alias='Processing')
666
694
  result: str | None = Field(None, alias='Result')
@@ -1,9 +1,10 @@
1
1
  import json as json_
2
2
  import warnings
3
- from typing import Any, Self
3
+ from typing import Any, Self, List
4
4
 
5
5
  import httpx
6
6
  from httpx import URL
7
+ from pydantic import BaseModel, ConfigDict
7
8
 
8
9
  from pinexq_client.core import Link, MediaTypes, ClientException, ApiException
9
10
  from pinexq_client.core.polling import wait_until, PollingException
@@ -35,12 +36,51 @@ from pinexq_client.job_management.model import (
35
36
  SelectProcessingParameters,
36
37
  SelectWorkDataCollectionForDataSlotParameters,
37
38
  SelectWorkDataForDataSlotParameters,
38
- SetJobTagsParameters,
39
+ SetJobTagsParameters, RapidJobSetupParameters, InputDataSlotParameter,
39
40
  )
40
41
  from pinexq_client.job_management.tool.processing_step import ProcessingStep
41
42
  from pinexq_client.job_management.tool.workdata import WorkData
42
43
 
43
44
 
45
+ class InputDataSlotParameterFlexible(BaseModel):
46
+ model_config = ConfigDict(
47
+ extra='allow',
48
+ arbitrary_types_allowed=True
49
+ )
50
+ index: int
51
+ work_data_urls: List[str] | None = None
52
+ work_data_instances: List[WorkData] | None = None
53
+
54
+ @classmethod
55
+ def create(cls, *,
56
+ index: int,
57
+ work_data_urls: List[WorkDataLink] | None = None,
58
+ work_data_instances: List[WorkData] | None = None
59
+ ) -> "InputDataSlotParameterFlexible":
60
+ """Creates an instance of InputDataSlotParameterFlexible that can be used to assign work data to a job.
61
+
62
+ Args:
63
+ index: The index of the input data slot.
64
+ work_data_urls: A list of URLs pointing to the work data.
65
+ work_data_instances: A list of WorkData instances.
66
+
67
+ Returns:
68
+ An instance of InputDataSlotParameterFlexible.
69
+ """
70
+ if sum(p is not None for p in [work_data_urls, work_data_instances]) != 1:
71
+ raise ValueError("Exactly one parameter must be provided")
72
+
73
+ if work_data_instances is not None:
74
+ if not isinstance(work_data_instances, list) or any(
75
+ not isinstance(i, WorkData) for i in work_data_instances):
76
+ raise Exception('Instance passed to "work_data_instances" is not of type "list[WorkData]"')
77
+ work_data_urls = [work_data_instance.self_link() for work_data_instance in work_data_instances]
78
+ return InputDataSlotParameterFlexible(
79
+ index=index,
80
+ work_data_urls=[str(wd.get_url()) for wd in work_data_urls] if work_data_urls else None,
81
+ work_data_instances=None
82
+ )
83
+
44
84
  class Job:
45
85
  """Convenience wrapper for handling JobHcos in the JobManagement-Api.
46
86
 
@@ -61,7 +101,7 @@ class Job:
61
101
  _entrypoint: EntryPointHco
62
102
  _jobs_root: JobsRootHco
63
103
  _processing_step_root: ProcessingStepsRootHco
64
- job_hco: JobHco | None = None # Internal hco of the wrapper. This is updated by this class. You should not take a reference to this object.
104
+ job_hco: JobHco | None = None # Internal hco of the wrapper. This is updated by this class. You should not take a reference to this object.
65
105
 
66
106
  def __init__(self, client: httpx.Client):
67
107
  """
@@ -313,6 +353,19 @@ class Job:
313
353
 
314
354
  return self
315
355
 
356
+ def wait_for_completion(self, timeout_ms: int = 60000, polling_interval_ms: int = 500) -> Self:
357
+ """Wait for this job to reach the state 'completed'.
358
+
359
+ Args:
360
+ timeout_ms: Timeout to wait for the job to reach the next state.
361
+ polling_interval_ms: will determine how fast the API is polled for updates.
362
+ Note that low values will produce unnecessary load.
363
+
364
+ Returns:
365
+ This `Job` object
366
+ """
367
+ return self.wait_for_state(JobStates.completed, timeout_ms, polling_interval_ms)
368
+
316
369
  def assign_input_dataslot(
317
370
  self,
318
371
  index: int,
@@ -564,7 +617,7 @@ class Job:
564
617
 
565
618
  job_was_deleted = False
566
619
  try:
567
- if self.job_hco.delete_action.is_available():
620
+ if self.job_hco.delete_action.is_available():
568
621
  self.job_hco.delete_action.execute()
569
622
  # do not delete the hco here since we want to access its data slots just below
570
623
  job_was_deleted = True
@@ -661,6 +714,80 @@ class Job:
661
714
  self._raise_if_no_hco()
662
715
  return self.job_hco.processing
663
716
 
717
+ def create_and_configure_rapidly(
718
+ self,
719
+ *,
720
+ name: str,
721
+ parent_job_url: JobLink | None = None,
722
+ parent_job_instance: Self | None = None,
723
+ tags: list[str] | None = None,
724
+ processing_step_url: ProcessingStepLink | None = None,
725
+ processing_step_instance: ProcessingStep | None = None,
726
+ start: bool = True,
727
+ parameters: str | None = None,
728
+ allow_output_data_slots: bool | None = None,
729
+ input_data_slots: List[InputDataSlotParameterFlexible] | None = None,
730
+ ) -> Self:
731
+ """
732
+ Creates a new job and configures it rapidly with RapidJobSetupParameters.
733
+
734
+ Args:
735
+ parameters: The parameters to configure the job with.
736
+
737
+ Returns:
738
+ The newly created job as `Job` object
739
+ """
740
+
741
+ # handle parent job
742
+ if sum(p is not None for p in [parent_job_url, parent_job_instance]) > 1:
743
+ raise ValueError("Either none or at most 1 one of parent_job_url or parent_job_instance must be provided")
744
+ parent_job = None
745
+ if parent_job_instance is not None:
746
+ if not isinstance(parent_job_instance, Job):
747
+ raise Exception('Instance passed to "parent_job_instance" is not of type "Job"')
748
+ parent_job = parent_job_instance.self_link().get_url()
749
+ elif parent_job_url is not None:
750
+ if not isinstance(parent_job_url, JobLink):
751
+ raise Exception('Instance passed to "parent_job_url" is not of type "JobLink"')
752
+ parent_job = parent_job_url.get_url()
753
+
754
+ # handle processing step
755
+ if sum(p is not None for p in [processing_step_url, processing_step_instance]) != 1:
756
+ raise ValueError("Exactly one of processing_step_url or processing_step_instance must be provided")
757
+ if processing_step_instance is not None:
758
+ if not isinstance(processing_step_instance, ProcessingStep):
759
+ raise Exception('Instance passed to "processing_step_instance" is not of type "ProcessingStep"')
760
+ processing_step = processing_step_instance.self_link().get_url()
761
+ else:
762
+ if not isinstance(processing_step_url, ProcessingStepLink):
763
+ raise Exception('Instance passed to "processing_step_url" is not of type "ProcessingStepLink"')
764
+ processing_step = processing_step_url.get_url()
765
+
766
+ # handle input data slots
767
+ if input_data_slots is not None:
768
+ input_data_slots = [
769
+ InputDataSlotParameter(
770
+ Index=slot.index,
771
+ WorkDataUrls=slot.work_data_urls
772
+ ) for slot in input_data_slots
773
+ ]
774
+
775
+ # build RapidJobSetupParameters
776
+ params = RapidJobSetupParameters(
777
+ Name=name,
778
+ ParentJobUrl=None if parent_job is None else str(parent_job),
779
+ ProcessingStepUrl=str(processing_step),
780
+ Tags=tags,
781
+ Start=start,
782
+ Parameters=parameters,
783
+ AllowOutputDataDeletion=allow_output_data_slots,
784
+ InputDataSlots=input_data_slots
785
+ )
786
+
787
+ job_link = self._jobs_root.rapid_job_setup_action.execute(params)
788
+ self._get_by_link(job_link)
789
+ return self
790
+
664
791
  def self_link(self) -> JobLink:
665
792
  self._raise_if_no_hco()
666
793
  return self.job_hco.self_link
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pinexq-client
3
- Version: 0.9.2.20250506.42
3
+ Version: 0.9.2.20250716.44
4
4
  Summary: A hypermedia-based client for the DataCybernetics PinexQ platform.
5
5
  Author-Email: =?utf-8?q?Sebastian_H=C3=B6fer?= <hoefer@data-cybernetics.com>, Mathias Reichardt <reichardt@data-cybernetics.com>, Jasim Ahmed <ahmed@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>
@@ -1,7 +1,7 @@
1
- pinexq_client-0.9.2.20250506.42.dist-info/METADATA,sha256=cfEKCEw-O1JaFD9mdQ87HoSQqCkcuvGLdJAwBQsPgmg,3279
2
- pinexq_client-0.9.2.20250506.42.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- pinexq_client-0.9.2.20250506.42.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- pinexq_client-0.9.2.20250506.42.dist-info/licenses/LICENSE,sha256=3oz3tAhM7kOgRukkRe7wmh5T_HihZY77ZtJDJm91ZN8,1072
1
+ pinexq_client-0.9.2.20250716.44.dist-info/METADATA,sha256=d2Xxx8jzezOpdVEJrGiLUdb5b7Y5mB5S5x6WCb8pn6g,3279
2
+ pinexq_client-0.9.2.20250716.44.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ pinexq_client-0.9.2.20250716.44.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ pinexq_client-0.9.2.20250716.44.dist-info/licenses/LICENSE,sha256=3oz3tAhM7kOgRukkRe7wmh5T_HihZY77ZtJDJm91ZN8,1072
5
5
  pinexq_client/core/__init__.py,sha256=zO9vUuAl6AEokL-SqQO3Jl1qrxFBZPA2kH99VNZugEU,598
6
6
  pinexq_client/core/base_relations.py,sha256=oIUS58pkbMDdqm-3YOdsenhL1smtzeAk4fp7-U595MY,162
7
7
  pinexq_client/core/enterapi.py,sha256=eB4F2_t3lCbMgKhy-M-Sf_u9MhuJMO7OGh-GB-4Cc-8,731
@@ -21,7 +21,7 @@ pinexq_client/core/model/error.py,sha256=ZDbUlwsj7d8XPMolSSLTFwgs3RBLvOvgmlEtoBu
21
21
  pinexq_client/core/model/sirenmodels.py,sha256=vGRQlhM2cSa2caxQel91Jr48KWqM-vMYX32iaQCzIds,5547
22
22
  pinexq_client/core/polling.py,sha256=Z6VXn-PCGk4XX-4tQWZG59qJyCIS0eIrpPUORQDIGrs,1077
23
23
  pinexq_client/core/sirenaccess.py,sha256=F7eZI5Pz79el0D30SYNGsiS2qWaAZF_jrCrUy-q2GgY,6992
24
- pinexq_client/job_management/__init__.py,sha256=bYcBivLyiTyBdrWJv9TfQerNGvgtS4qCB8MZUxAaS-A,598
24
+ pinexq_client/job_management/__init__.py,sha256=jaOkYyOSur8EMcz4fgEFlENQFwagHKjLwlR67E9FIhs,598
25
25
  pinexq_client/job_management/enterjma.py,sha256=Ivl_jVPw_gaLyU5nKbywM-bbVGpn0MoCrZ0DMbJYf3s,1411
26
26
  pinexq_client/job_management/hcos/__init__.py,sha256=TZgs5kuBk3lSBxPfn5ehgbdUgzPy2jn1PC3Ea6VQY-k,584
27
27
  pinexq_client/job_management/hcos/entrypoint_hco.py,sha256=qodjAwO_MtawUuhmaYjhGXHV-uW1k94V9gKRYZRkhn4,2234
@@ -30,7 +30,7 @@ pinexq_client/job_management/hcos/input_dataslot_hco.py,sha256=SDflhyW8kjpcTUfKA
30
30
  pinexq_client/job_management/hcos/job_hco.py,sha256=8Lq5RABq7XUp3Z6jhYegPgVPfm591-38eC8CCLes0KQ,8934
31
31
  pinexq_client/job_management/hcos/job_query_result_hco.py,sha256=I0G8YIlYDhTahLz8n06L8BywlcsMGNWUEsmEr4Sk0GU,3315
32
32
  pinexq_client/job_management/hcos/job_used_tags_hco.py,sha256=nys6E97NNXATdnvX6KZ46JR9qEb2lnqol9ZvJVEiNpQ,944
33
- pinexq_client/job_management/hcos/jobsroot_hco.py,sha256=P8C5CaIEq_bkh6YgJBuQEp45Cc4fHuU5lYuWNdgtISY,3853
33
+ pinexq_client/job_management/hcos/jobsroot_hco.py,sha256=5h_CYb9FyjpmAlvDXuK_AimCvomadFTcCSQ6QmMD0QY,4726
34
34
  pinexq_client/job_management/hcos/output_dataslot_hco.py,sha256=zxpo-fI9eHcp_pMKcf2l-gRoPHX1RzQO53auHMRB_T8,1549
35
35
  pinexq_client/job_management/hcos/processing_step_hco.py,sha256=JH9s3ifchYvpwzPGkDon9AyDnjdZZiSCu1Xtgd2jKnY,6131
36
36
  pinexq_client/job_management/hcos/processing_step_used_tags_hco.py,sha256=90-2IWlYTcYX62NzmAPnmcUCwMDhmMZyBrNs_G3yigs,1067
@@ -43,11 +43,11 @@ pinexq_client/job_management/hcos/workdata_used_tags_query_result_hco.py,sha256=
43
43
  pinexq_client/job_management/hcos/workdataroot_hco.py,sha256=LdEPW2JJTqAWi-6zj-40lfREhthcDL6nPXQk_nfMtCA,3936
44
44
  pinexq_client/job_management/known_relations.py,sha256=f3-7RagAfeSFv9b54l5zxnLKbVQjQQHzYsM4W2QHf0Y,708
45
45
  pinexq_client/job_management/model/__init__.py,sha256=iuAKRXdW_Mxo0i3HsBfEzhJJZUKkNe3qs4gLW-ge1PU,63
46
- pinexq_client/job_management/model/open_api_generated.py,sha256=myC0ZkqYAYBmd2A9rwD3kmTbkJlskAQ0H7Z5pgejaq0,32233
46
+ pinexq_client/job_management/model/open_api_generated.py,sha256=s-XtnhuK5YmBhbOqKsy09iRKrQMtZL6-N2be-g5d8QU,33211
47
47
  pinexq_client/job_management/model/sirenentities.py,sha256=MUjgByEwzQcrduCEJuNK85uAj8SLTdyaiKmnlB44h3E,3430
48
48
  pinexq_client/job_management/tool/__init__.py,sha256=zPobd-hQyANHzC0-TjJG91z9XrewvE54ZJ6VViymW5M,128
49
- pinexq_client/job_management/tool/job.py,sha256=77veL0dnqFpu8kz9Yr9xR9nG1YqZ2chCXWWLmnXm6kI,24962
49
+ pinexq_client/job_management/tool/job.py,sha256=yVEVE3RRalQy8abA2G1X-a1Tj3v32YCsDeN52LDMSp8,30572
50
50
  pinexq_client/job_management/tool/job_group.py,sha256=TNWw46UDyP2gmArhbzMAqpHa6lS2hzwarLIrxxpOMnk,4822
51
51
  pinexq_client/job_management/tool/processing_step.py,sha256=LLesEbS7vaAiCoGs7MV8bnaD8bWnkK-2YTxAsyPiJFM,10796
52
52
  pinexq_client/job_management/tool/workdata.py,sha256=wRy_yfFZUJDh-hoGUuAbQaRGtPysDmEOhLwD84Fgz04,5510
53
- pinexq_client-0.9.2.20250506.42.dist-info/RECORD,,
53
+ pinexq_client-0.9.2.20250716.44.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: pdm-backend (2.4.4)
2
+ Generator: pdm-backend (2.4.5)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any