pinexq-client 0.10.6rc1__py3-none-any.whl → 1.1.0__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 → pinexq/client}/core/api_event_manager.py +3 -4
- {pinexq_client → pinexq/client}/core/enterapi.py +6 -4
- {pinexq_client → pinexq/client}/core/exceptions.py +2 -2
- {pinexq_client → pinexq/client}/core/hco/action_hco.py +3 -3
- {pinexq_client → pinexq/client}/core/hco/action_with_parameters_hco.py +4 -4
- {pinexq_client → pinexq/client}/core/hco/download_link_hco.py +2 -2
- {pinexq_client → pinexq/client}/core/hco/hco_base.py +1 -1
- {pinexq_client → pinexq/client}/core/hco/link_hco.py +6 -8
- pinexq/client/core/hco/unavailable.py +36 -0
- {pinexq_client → pinexq/client}/core/hco/upload_action_hco.py +4 -5
- {pinexq_client → pinexq/client}/job_management/__init__.py +1 -1
- {pinexq_client → pinexq/client}/job_management/enterjma.py +11 -9
- {pinexq_client → pinexq/client}/job_management/hcos/entrypoint_hco.py +9 -9
- {pinexq_client → pinexq/client}/job_management/hcos/info_hco.py +5 -5
- pinexq/client/job_management/hcos/input_dataslot_hco.py +88 -0
- {pinexq_client → pinexq/client}/job_management/hcos/job_hco.py +23 -16
- pinexq/client/job_management/hcos/job_query_result_hco.py +89 -0
- {pinexq_client → pinexq/client}/job_management/hcos/job_used_tags_hco.py +5 -5
- {pinexq_client → pinexq/client}/job_management/hcos/jobsroot_hco.py +13 -16
- {pinexq_client → pinexq/client}/job_management/hcos/output_dataslot_hco.py +6 -9
- {pinexq_client → pinexq/client}/job_management/hcos/processing_step_hco.py +23 -14
- {pinexq_client → pinexq/client}/job_management/hcos/processing_step_used_tags_hco.py +5 -5
- pinexq/client/job_management/hcos/processingstep_query_result_hco.py +91 -0
- {pinexq_client → pinexq/client}/job_management/hcos/processingsteproot_hco.py +14 -15
- {pinexq_client → pinexq/client}/job_management/hcos/user_hco.py +4 -4
- {pinexq_client → pinexq/client}/job_management/hcos/workdata_hco.py +17 -16
- pinexq/client/job_management/hcos/workdata_query_result_hco.py +91 -0
- {pinexq_client → pinexq/client}/job_management/hcos/workdata_used_tags_query_result_hco.py +5 -5
- {pinexq_client → pinexq/client}/job_management/hcos/workdataroot_hco.py +16 -14
- {pinexq_client → pinexq/client}/job_management/model/open_api_generated.py +120 -96
- {pinexq_client → pinexq/client}/job_management/model/sirenentities.py +14 -12
- {pinexq_client → pinexq/client}/job_management/tool/job.py +20 -25
- {pinexq_client → pinexq/client}/job_management/tool/job_group.py +6 -7
- {pinexq_client → pinexq/client}/job_management/tool/processing_step.py +26 -15
- {pinexq_client → pinexq/client}/job_management/tool/workdata.py +7 -8
- {pinexq_client-0.10.6rc1.dist-info → pinexq_client-1.1.0.dist-info}/METADATA +10 -10
- pinexq_client-1.1.0.dist-info/RECORD +52 -0
- {pinexq_client-0.10.6rc1.dist-info → pinexq_client-1.1.0.dist-info}/WHEEL +2 -2
- pinexq_client/core/hco/unavailable.py +0 -36
- pinexq_client/job_management/hcos/input_dataslot_hco.py +0 -86
- pinexq_client/job_management/hcos/job_query_result_hco.py +0 -89
- pinexq_client/job_management/hcos/processingstep_query_result_hco.py +0 -94
- pinexq_client/job_management/hcos/workdata_query_result_hco.py +0 -91
- pinexq_client-0.10.6rc1.dist-info/RECORD +0 -52
- {pinexq_client → pinexq/client}/core/__init__.py +0 -0
- {pinexq_client → pinexq/client}/core/base_relations.py +0 -0
- {pinexq_client → pinexq/client}/core/hco/__init__.py +0 -0
- {pinexq_client → pinexq/client}/core/http_headers.py +0 -0
- {pinexq_client → pinexq/client}/core/media_types.py +0 -0
- {pinexq_client → pinexq/client}/core/model/__init__.py +0 -0
- {pinexq_client → pinexq/client}/core/model/error.py +0 -0
- {pinexq_client → pinexq/client}/core/model/sirenmodels.py +0 -0
- {pinexq_client → pinexq/client}/core/polling.py +0 -0
- {pinexq_client → pinexq/client}/core/sirenaccess.py +0 -0
- {pinexq_client → pinexq/client}/job_management/hcos/__init__.py +0 -0
- {pinexq_client → pinexq/client}/job_management/known_relations.py +0 -0
- {pinexq_client → pinexq/client}/job_management/model/__init__.py +0 -0
- {pinexq_client → pinexq/client}/job_management/tool/__init__.py +0 -0
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import queue
|
|
2
2
|
import threading
|
|
3
3
|
import time
|
|
4
|
+
from dataclasses import dataclass
|
|
4
5
|
from datetime import datetime, timedelta
|
|
5
|
-
from pydantic import BaseModel
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
from httpx_sse import connect_sse
|
|
9
|
+
from pydantic import BaseModel
|
|
9
10
|
|
|
10
|
-
from
|
|
11
|
-
|
|
12
|
-
from pinexq_client.job_management import EntryPointHco, enter_jma
|
|
11
|
+
from ..job_management import EntryPointHco, enter_jma
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
@dataclass
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
from typing import Type, TypeVar
|
|
2
|
+
|
|
1
3
|
import httpx
|
|
2
4
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
|
|
5
|
+
from .hco.hco_base import Hco
|
|
6
|
+
from .model.sirenmodels import Entity
|
|
7
|
+
from .sirenaccess import get_resource, raise_exception_on_error
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
THco = TypeVar('THco', bound=Hco)
|
|
9
11
|
|
|
@@ -3,9 +3,9 @@ from typing import TypeVar, Self
|
|
|
3
3
|
import httpx
|
|
4
4
|
from httpx import URL
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
6
|
+
from .. import Entity, Action, execute_action, raise_exception_on_error, ClientException
|
|
7
|
+
from ..hco.hco_base import ClientContainer
|
|
8
|
+
from ..hco.unavailable import UnavailableAction, HypermediaAvailability
|
|
9
9
|
|
|
10
10
|
TEntity = TypeVar('TEntity', bound=Entity)
|
|
11
11
|
THcoEntity = TypeVar('THcoEntity', bound=Entity)
|
|
@@ -4,9 +4,9 @@ import httpx
|
|
|
4
4
|
from httpx import URL
|
|
5
5
|
from pydantic import BaseModel
|
|
6
6
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
7
|
+
from .. import Entity, Action, execute_action, raise_exception_on_error, ClientException
|
|
8
|
+
from ..hco.hco_base import ClientContainer
|
|
9
|
+
from ..hco.unavailable import UnavailableAction, HypermediaAvailability
|
|
10
10
|
|
|
11
11
|
TParameters = TypeVar('TParameters', bound=BaseModel)
|
|
12
12
|
|
|
@@ -22,7 +22,7 @@ class ActionWithParametersHco(ClientContainer, Generic[TParameters], HypermediaA
|
|
|
22
22
|
|
|
23
23
|
if not action.has_parameters():
|
|
24
24
|
raise ClientException(
|
|
25
|
-
f"Error while mapping action: expected action with parameters but got none")
|
|
25
|
+
f"Error while mapping action '{action.name}': expected action with parameters but got none")
|
|
26
26
|
|
|
27
27
|
instance = cls(client)
|
|
28
28
|
instance._action = action
|
|
@@ -3,8 +3,8 @@ from typing import Self
|
|
|
3
3
|
import httpx
|
|
4
4
|
from httpx import Response
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
6
|
+
from .. import ClientException, Entity, Link, get_resource
|
|
7
|
+
from ..hco.link_hco import LinkHco
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class DownloadLinkHco(LinkHco):
|
|
@@ -5,7 +5,7 @@ from typing import List, TypeVar, Generic, Callable, Any
|
|
|
5
5
|
import httpx
|
|
6
6
|
from httpx import URL
|
|
7
7
|
|
|
8
|
-
from
|
|
8
|
+
from .. import Entity, BaseRelations, Link, ClientException
|
|
9
9
|
|
|
10
10
|
TEntity = TypeVar('TEntity', bound=Entity)
|
|
11
11
|
THcoEntity = TypeVar('THcoEntity', bound=Entity)
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
from typing import Self, Type
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
|
-
from httpx import URL
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
from
|
|
8
|
-
|
|
9
|
-
from
|
|
10
|
-
from pinexq_client.core.hco.unavailable import UnavailableLink, HypermediaAvailability
|
|
11
|
-
from pinexq_client.core.model.error import ProblemDetails
|
|
4
|
+
from httpx import URL, Response
|
|
5
|
+
|
|
6
|
+
from .. import ApiException, ClientException, Entity, Link, ensure_siren_response, navigate, raise_exception_on_error
|
|
7
|
+
from ..hco.hco_base import ClientContainer, TEntity
|
|
8
|
+
from ..hco.unavailable import HypermediaAvailability, UnavailableLink
|
|
9
|
+
from ..model.error import ProblemDetails
|
|
12
10
|
|
|
13
11
|
|
|
14
12
|
class LinkHco(ClientContainer, HypermediaAvailability):
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from abc import ABC, ABCMeta, abstractmethod
|
|
2
|
+
|
|
3
|
+
from .. import NotAvailableException
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class HypermediaAvailability(ABC):
|
|
7
|
+
def __bool__(self) -> bool:
|
|
8
|
+
return self.is_available()
|
|
9
|
+
|
|
10
|
+
@staticmethod
|
|
11
|
+
@abstractmethod
|
|
12
|
+
def is_available() -> bool:
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
class UnavailableAction(HypermediaAvailability):
|
|
16
|
+
"""This class is used to represent an action that is not available. It is used to avoid None
|
|
17
|
+
checks in the code."""
|
|
18
|
+
|
|
19
|
+
def execute(self, *args, **kwargs):
|
|
20
|
+
raise NotAvailableException(f"Error while executing action: action is not available")
|
|
21
|
+
|
|
22
|
+
@staticmethod
|
|
23
|
+
def is_available() -> bool:
|
|
24
|
+
return False
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class UnavailableLink(HypermediaAvailability):
|
|
28
|
+
"""This class is used to represent a link that is not available. It is used to avoid None
|
|
29
|
+
checks in the code."""
|
|
30
|
+
|
|
31
|
+
def navigate(self):
|
|
32
|
+
raise NotAvailableException(f"Error while navigating: link is not available")
|
|
33
|
+
|
|
34
|
+
@staticmethod
|
|
35
|
+
def is_available() -> bool:
|
|
36
|
+
return False
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
from io import IOBase
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Any, AsyncIterable, Iterable, Self
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from httpx import URL
|
|
6
6
|
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
7
7
|
|
|
8
|
-
from
|
|
9
|
-
|
|
10
|
-
from
|
|
11
|
-
from pinexq_client.core.hco.unavailable import UnavailableAction
|
|
8
|
+
from .. import Action, ClientException, Entity, MediaTypes, SirenClasses, upload_binary, upload_file, upload_json
|
|
9
|
+
from ..hco.action_with_parameters_hco import ActionWithParametersHco
|
|
10
|
+
from ..hco.unavailable import UnavailableAction
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
class UploadParameters(BaseModel):
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import warnings
|
|
2
|
+
from typing import Type, TypeVar
|
|
2
3
|
|
|
3
4
|
import httpx
|
|
4
5
|
from httpx import Client, _config
|
|
6
|
+
|
|
5
7
|
# from hishel.httpx import SyncCacheClient
|
|
6
8
|
from httpx_caching import CachingClient
|
|
7
9
|
|
|
8
|
-
import
|
|
10
|
+
import pinexq.client
|
|
11
|
+
|
|
12
|
+
from ..core import Entity
|
|
13
|
+
from ..core.enterapi import enter_api
|
|
14
|
+
from ..core.hco.hco_base import Hco
|
|
15
|
+
from .hcos import EntryPointHco
|
|
16
|
+
from .model import EntryPointEntity
|
|
9
17
|
|
|
10
|
-
from pinexq_client.core import Entity
|
|
11
|
-
from pinexq_client.core.enterapi import enter_api
|
|
12
|
-
from pinexq_client.core.hco.hco_base import Hco
|
|
13
|
-
from pinexq_client.job_management.hcos.entrypoint_hco import EntryPointHco
|
|
14
|
-
from pinexq_client.job_management.model.sirenentities import EntryPointEntity
|
|
15
|
-
import pinexq_client.job_management
|
|
16
18
|
|
|
17
19
|
THco = TypeVar("THco", bound=Hco)
|
|
18
20
|
|
|
@@ -78,7 +80,7 @@ def enter_jma(
|
|
|
78
80
|
info = entry_point_hco.info_link.navigate()
|
|
79
81
|
|
|
80
82
|
# Check for matching protocol versions
|
|
81
|
-
client_version =
|
|
83
|
+
client_version = pinexq.client.job_management.__jma_version__
|
|
82
84
|
jma_version = [int(i) for i in str.split(info.api_version, '.')]
|
|
83
85
|
if not _version_match_major_minor(jma_version, client_version):
|
|
84
86
|
warnings.warn(
|
|
@@ -3,15 +3,15 @@ from typing import Self
|
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
6
|
+
from ...core.hco.hco_base import Hco
|
|
7
|
+
from ...core.hco.link_hco import LinkHco
|
|
8
|
+
from ...core.hco.unavailable import UnavailableLink
|
|
9
|
+
from ..known_relations import Relations
|
|
10
|
+
from ..model.sirenentities import EntryPointEntity
|
|
11
|
+
from .info_hco import InfoLink
|
|
12
|
+
from .jobsroot_hco import JobsRootLink
|
|
13
|
+
from .processingsteproot_hco import ProcessingStepsRootLink
|
|
14
|
+
from .workdataroot_hco import WorkDataRootLink
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class EntryPointLink(LinkHco):
|
|
@@ -2,11 +2,11 @@ from typing import Self
|
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
5
|
+
from ...core.hco.hco_base import Hco, Property
|
|
6
|
+
from ...core.hco.link_hco import LinkHco
|
|
7
|
+
from ..known_relations import Relations
|
|
8
|
+
from ..model.sirenentities import InfoEntity, UserEntity
|
|
9
|
+
from .user_hco import UserHco
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class InfoLink(LinkHco):
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from typing import Self
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
from ...core import Link, MediaTypes
|
|
6
|
+
from ...core.hco.action_hco import ActionHco
|
|
7
|
+
from ...core.hco.action_with_parameters_hco import ActionWithParametersHco
|
|
8
|
+
from ...core.hco.hco_base import Hco, Property
|
|
9
|
+
from ...core.hco.link_hco import LinkHco
|
|
10
|
+
from ...core.hco.unavailable import UnavailableAction
|
|
11
|
+
from ...core.hco.upload_action_hco import UploadAction, UploadParameters
|
|
12
|
+
from ..hcos.workdata_hco import WorkDataHco, WorkDataLink
|
|
13
|
+
from ..known_relations import Relations
|
|
14
|
+
from ..model.open_api_generated import (
|
|
15
|
+
SelectWorkDataCollectionForDataSlotParameters,
|
|
16
|
+
SelectWorkDataForDataSlotParameters,
|
|
17
|
+
)
|
|
18
|
+
from ..model.sirenentities import InputDataSlotEntity, WorkDataEntity
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class InputDataSlotLink(LinkHco):
|
|
22
|
+
def navigate(self) -> 'InputDataSlotHco':
|
|
23
|
+
return InputDataSlotHco.from_entity(self._navigate_internal(InputDataSlotEntity), self._client)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class InputDataSlotSelectWorkDataAction(ActionWithParametersHco[SelectWorkDataForDataSlotParameters]):
|
|
27
|
+
def execute(self, parameters: SelectWorkDataForDataSlotParameters):
|
|
28
|
+
self._execute(parameters)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class InputDataSlotSelectWorkDataCollectionAction(
|
|
32
|
+
ActionWithParametersHco[SelectWorkDataCollectionForDataSlotParameters]):
|
|
33
|
+
def execute(self, parameters: SelectWorkDataCollectionForDataSlotParameters):
|
|
34
|
+
self._execute(parameters)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class InputDataSlotUploadWorkDataAction(UploadAction):
|
|
38
|
+
def execute(self, parameters: UploadParameters) -> WorkDataLink:
|
|
39
|
+
url = self._upload(parameters)
|
|
40
|
+
link = Link.from_url(url, [str(Relations.CREATED_RESSOURCE)], "Uploaded workdata", MediaTypes.SIREN)
|
|
41
|
+
return WorkDataLink.from_link(self._client, link)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class InputDataSlotClearDataAction(ActionHco):
|
|
45
|
+
def execute(self):
|
|
46
|
+
self._execute_internal()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class InputDataSlotHco(Hco[InputDataSlotEntity]):
|
|
50
|
+
|
|
51
|
+
title: str | None = Property()
|
|
52
|
+
description: str | None = Property()
|
|
53
|
+
name: str | None = Property()
|
|
54
|
+
media_type: str | None = Property()
|
|
55
|
+
selected_workdatas: list[WorkDataHco]
|
|
56
|
+
is_configured: bool | None = Property()
|
|
57
|
+
|
|
58
|
+
select_workdata_action: InputDataSlotSelectWorkDataAction | UnavailableAction
|
|
59
|
+
select_workdata_collection_action: InputDataSlotSelectWorkDataCollectionAction | UnavailableAction
|
|
60
|
+
clear_workdata_action: InputDataSlotClearDataAction | UnavailableAction
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def from_entity(cls, entity: InputDataSlotEntity, client: httpx.Client) -> Self:
|
|
64
|
+
instance = cls(client, entity)
|
|
65
|
+
Hco.check_classes(instance._entity.class_, ["InputDataSlot"])
|
|
66
|
+
|
|
67
|
+
# actions
|
|
68
|
+
instance.select_workdata_action = InputDataSlotSelectWorkDataAction.from_entity_optional(
|
|
69
|
+
client, instance._entity, "SelectWorkData")
|
|
70
|
+
instance.select_workdata_collection_action = InputDataSlotSelectWorkDataCollectionAction.from_entity_optional(
|
|
71
|
+
client, instance._entity, "SelectWorkDataCollection")
|
|
72
|
+
instance.clear_workdata_action = InputDataSlotClearDataAction.from_entity_optional(
|
|
73
|
+
client, instance._entity, "Clear")
|
|
74
|
+
|
|
75
|
+
instance._extract_workdata()
|
|
76
|
+
|
|
77
|
+
return instance
|
|
78
|
+
|
|
79
|
+
def _extract_workdata(self):
|
|
80
|
+
self.selected_workdatas = []
|
|
81
|
+
|
|
82
|
+
workdatas: list[WorkDataEntity] = self._entity.find_all_entities_with_relation(Relations.SELECTED,
|
|
83
|
+
WorkDataEntity)
|
|
84
|
+
if not workdatas:
|
|
85
|
+
return
|
|
86
|
+
|
|
87
|
+
self.selected_workdatas = [WorkDataHco.from_entity(workdata, self._client)
|
|
88
|
+
for workdata in workdatas]
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import TYPE_CHECKING, List, Self
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from pydantic import BaseModel, ConfigDict
|
|
6
6
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
from ...core.hco.action_hco import ActionHco
|
|
8
|
+
from ...core.hco.action_with_parameters_hco import ActionWithParametersHco
|
|
9
|
+
from ...core.hco.hco_base import Hco, Property
|
|
10
|
+
from ...core.hco.link_hco import LinkHco
|
|
11
|
+
from ...core.hco.unavailable import UnavailableAction, UnavailableLink
|
|
12
|
+
from ..hcos.processing_step_hco import ProcessingStepLink
|
|
13
|
+
from ..known_relations import Relations
|
|
14
|
+
from ..model import SetJobErrorStateParameters
|
|
15
|
+
from ..model.open_api_generated import (
|
|
16
|
+
JobStates,
|
|
17
|
+
ProcessingView,
|
|
18
|
+
RenameJobParameters,
|
|
19
|
+
SelectProcessingParameters,
|
|
20
|
+
SetJobTagsParameters, TagDetailsHto,
|
|
21
|
+
)
|
|
22
|
+
from ..model.sirenentities import InputDataSlotEntity, JobEntity, OutputDataSlotEntity
|
|
23
|
+
|
|
18
24
|
|
|
19
25
|
if TYPE_CHECKING:
|
|
20
|
-
from
|
|
21
|
-
from
|
|
26
|
+
from pinexq.client.job_management.hcos.input_dataslot_hco import InputDataSlotHco
|
|
27
|
+
from pinexq.client.job_management.hcos.output_dataslot_hco import OutputDataSlotHco
|
|
22
28
|
|
|
23
29
|
|
|
24
30
|
class JobRenameAction(ActionWithParametersHco[RenameJobParameters]):
|
|
@@ -115,6 +121,7 @@ class JobHco(Hco[JobEntity]):
|
|
|
115
121
|
state: JobStates = Property()
|
|
116
122
|
hidden: bool = Property()
|
|
117
123
|
tags: list[str] | None = Property()
|
|
124
|
+
tag_details: List[TagDetailsHto] | None = Property()
|
|
118
125
|
output_is_deletable: bool = Property()
|
|
119
126
|
created_at: datetime = Property()
|
|
120
127
|
started_at: datetime = Property()
|
|
@@ -186,7 +193,7 @@ class JobHco(Hco[JobEntity]):
|
|
|
186
193
|
return instance
|
|
187
194
|
|
|
188
195
|
def _extract_input_dataslots(self):
|
|
189
|
-
from
|
|
196
|
+
from pinexq.client.job_management.hcos.input_dataslot_hco import InputDataSlotHco
|
|
190
197
|
self.input_dataslots = []
|
|
191
198
|
input_dataslots = self._entity.find_all_entities_with_relation(Relations.INPUT_DATASLOT, InputDataSlotEntity)
|
|
192
199
|
for input_dataslot in input_dataslots:
|
|
@@ -194,7 +201,7 @@ class JobHco(Hco[JobEntity]):
|
|
|
194
201
|
self.input_dataslots.append(input_dataslot_hco)
|
|
195
202
|
|
|
196
203
|
def _extract_output_dataslots(self):
|
|
197
|
-
from
|
|
204
|
+
from pinexq.client.job_management.hcos.output_dataslot_hco import OutputDataSlotHco
|
|
198
205
|
self.output_dataslots = []
|
|
199
206
|
output_dataslots = self._entity.find_all_entities_with_relation(Relations.OUTPUT_DATASLOT, OutputDataSlotEntity)
|
|
200
207
|
for output_dataslot in output_dataslots:
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
from typing import Iterator, List, Self
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
from ...core.hco.hco_base import Hco, Property
|
|
6
|
+
from ...core.hco.link_hco import LinkHco
|
|
7
|
+
from ...core.hco.unavailable import UnavailableLink
|
|
8
|
+
from ..hcos.job_hco import JobHco
|
|
9
|
+
from ..known_relations import Relations
|
|
10
|
+
from ..model.sirenentities import JobEntity, JobQueryResultEntity
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class JobQueryResultPaginationLink(LinkHco):
|
|
14
|
+
def navigate(self) -> 'JobQueryResultHco':
|
|
15
|
+
return JobQueryResultHco.from_entity(self._client, self._navigate_internal(JobQueryResultEntity))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JobQueryResultLink(LinkHco):
|
|
19
|
+
def navigate(self) -> 'JobQueryResultHco':
|
|
20
|
+
return JobQueryResultHco.from_entity(self._client, self._navigate_internal(JobQueryResultEntity))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class JobQueryResultHco(Hco[JobQueryResultEntity]):
|
|
24
|
+
self_link: JobQueryResultLink
|
|
25
|
+
all_link: JobQueryResultPaginationLink | UnavailableLink
|
|
26
|
+
first_link: JobQueryResultPaginationLink | UnavailableLink
|
|
27
|
+
last_link: JobQueryResultPaginationLink | UnavailableLink
|
|
28
|
+
next_link: JobQueryResultPaginationLink | UnavailableLink
|
|
29
|
+
previous_link: JobQueryResultPaginationLink | UnavailableLink
|
|
30
|
+
|
|
31
|
+
total_entities: int = Property()
|
|
32
|
+
current_entities_count: int = Property()
|
|
33
|
+
jobs: List[JobHco]
|
|
34
|
+
remaining_tags: List[str] | None = Property()
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_entity(cls, client: httpx.Client, entity: JobQueryResultEntity) -> 'JobQueryResultHco':
|
|
38
|
+
instance = cls(client, entity)
|
|
39
|
+
|
|
40
|
+
Hco.check_classes(instance._entity.class_, ["JobQueryResult"])
|
|
41
|
+
|
|
42
|
+
# pagination links
|
|
43
|
+
instance.self_link = JobQueryResultLink.from_entity(instance._client, instance._entity, Relations.SELF)
|
|
44
|
+
instance.all_link = JobQueryResultPaginationLink.from_entity_optional(instance._client, instance._entity,
|
|
45
|
+
Relations.ALL)
|
|
46
|
+
instance.first_link = JobQueryResultPaginationLink.from_entity_optional(instance._client, instance._entity,
|
|
47
|
+
Relations.FIRST)
|
|
48
|
+
instance.last_link = JobQueryResultPaginationLink.from_entity_optional(instance._client, instance._entity,
|
|
49
|
+
Relations.LAST)
|
|
50
|
+
instance.next_link = JobQueryResultPaginationLink.from_entity_optional(instance._client, instance._entity,
|
|
51
|
+
Relations.NEXT)
|
|
52
|
+
instance.previous_link = JobQueryResultPaginationLink.from_entity_optional(instance._client, instance._entity,
|
|
53
|
+
Relations.PREVIOUS)
|
|
54
|
+
|
|
55
|
+
# entities
|
|
56
|
+
instance._extract_jobs()
|
|
57
|
+
|
|
58
|
+
return instance
|
|
59
|
+
|
|
60
|
+
def _extract_jobs(self):
|
|
61
|
+
self.jobs = []
|
|
62
|
+
jobs = self._entity.find_all_entities_with_relation(Relations.ITEM, JobEntity)
|
|
63
|
+
for job in jobs:
|
|
64
|
+
job_hco: JobHco = JobHco.from_entity(job, self._client)
|
|
65
|
+
self.jobs.append(job_hco)
|
|
66
|
+
|
|
67
|
+
def iter(self) -> Iterator[Self]:
|
|
68
|
+
"""
|
|
69
|
+
Returns an Iterator of `JobQueryResultHco` so that all pages can be processed in a loop.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
An iterator of `JobQueryResultHco` objects
|
|
73
|
+
"""
|
|
74
|
+
result = self
|
|
75
|
+
while result is not None:
|
|
76
|
+
yield result
|
|
77
|
+
if isinstance(result.next_link, UnavailableLink):
|
|
78
|
+
return
|
|
79
|
+
result = result.next_link.navigate()
|
|
80
|
+
|
|
81
|
+
def iter_flat(self) -> Iterator[JobHco]:
|
|
82
|
+
"""
|
|
83
|
+
Returns an Iterator of `JobHco` so that all jobs can be processed in a loop.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
An iterator of `JobHco` objects
|
|
87
|
+
"""
|
|
88
|
+
for page in self.iter():
|
|
89
|
+
yield from page.jobs
|
|
@@ -2,11 +2,11 @@ from typing import List, Self
|
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
5
|
+
from ...core.hco.hco_base import Hco, Property
|
|
6
|
+
from ...core.hco.link_hco import LinkHco
|
|
7
|
+
from ..known_relations import Relations
|
|
8
|
+
from ..model import JobUsedTagsEntityAdmin
|
|
9
|
+
from ..model.sirenentities import JobUsedTagsEntity
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class JobUsedTagsHco(Hco[JobUsedTagsEntity]):
|
|
@@ -3,25 +3,22 @@ from typing import Self
|
|
|
3
3
|
import httpx
|
|
4
4
|
from httpx import URL
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
from
|
|
17
|
-
from pinexq_client.job_management.known_relations import Relations
|
|
18
|
-
from pinexq_client.job_management.model import RapidJobSetupParameters
|
|
19
|
-
from pinexq_client.job_management.model.open_api_generated import (
|
|
6
|
+
from ...core import Link, MediaTypes
|
|
7
|
+
from ...core.hco.action_with_parameters_hco import ActionWithParametersHco
|
|
8
|
+
from ...core.hco.hco_base import Hco
|
|
9
|
+
from ...core.hco.link_hco import LinkHco
|
|
10
|
+
from ...core.hco.unavailable import UnavailableAction, UnavailableLink
|
|
11
|
+
from ..hcos.job_hco import JobLink
|
|
12
|
+
from ..hcos.job_query_result_hco import JobQueryResultHco, JobQueryResultLink
|
|
13
|
+
from ..hcos.job_used_tags_hco import JobUsedTagsAdminLink, JobUsedTagsLink
|
|
14
|
+
from ..known_relations import Relations
|
|
15
|
+
from ..model import RapidJobSetupParameters
|
|
16
|
+
from ..model.open_api_generated import (
|
|
20
17
|
CreateJobParameters,
|
|
18
|
+
CreateSubJobParameters,
|
|
21
19
|
JobQueryParameters,
|
|
22
|
-
CreateSubJobParameters
|
|
23
20
|
)
|
|
24
|
-
from
|
|
21
|
+
from ..model.sirenentities import JobsRootEntity
|
|
25
22
|
|
|
26
23
|
|
|
27
24
|
class CreateJobAction(ActionWithParametersHco[CreateJobParameters]):
|
|
@@ -2,19 +2,16 @@ from typing import Self
|
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
OutputDataSlotEntity,
|
|
11
|
-
WorkDataEntity
|
|
12
|
-
)
|
|
5
|
+
from ...core.hco.hco_base import Hco, Property
|
|
6
|
+
from ...core.hco.link_hco import LinkHco
|
|
7
|
+
from ..hcos.workdata_hco import WorkDataHco
|
|
8
|
+
from ..known_relations import Relations
|
|
9
|
+
from ..model.sirenentities import OutputDataSlotEntity, WorkDataEntity
|
|
13
10
|
|
|
14
11
|
|
|
15
12
|
class OutputDataSlotLink(LinkHco):
|
|
16
13
|
def navigate(self) -> 'OutputDataSlotHco':
|
|
17
|
-
return OutputDataSlotHco.from_entity(self._navigate_internal(OutputDataSlotEntity), self.
|
|
14
|
+
return OutputDataSlotHco.from_entity(self._navigate_internal(OutputDataSlotEntity), self._pinexq.client)
|
|
18
15
|
|
|
19
16
|
|
|
20
17
|
class OutputDataSlotHco(Hco[OutputDataSlotEntity]):
|