ctm-python-client 2.4.6__py3-none-any.whl → 2.4.8__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.
- aapi/bases.py +71 -36
- aapi/ifbase.py +108 -61
- aapi/integration_factory/connection_profiles.py +2007 -2010
- aapi/integration_factory/jobs.py +845 -156
- ctm_python_client/__init__.py +2 -2
- ctm_python_client/ext/autogen.py +1 -1
- ctm_python_client/ext/viz.py +38 -27
- {ctm_python_client-2.4.6.dist-info → ctm_python_client-2.4.8.dist-info}/METADATA +3 -2
- {ctm_python_client-2.4.6.dist-info → ctm_python_client-2.4.8.dist-info}/RECORD +12 -12
- {ctm_python_client-2.4.6.dist-info → ctm_python_client-2.4.8.dist-info}/WHEEL +1 -1
- {ctm_python_client-2.4.6.dist-info → ctm_python_client-2.4.8.dist-info/licenses}/LICENSE +0 -0
- {ctm_python_client-2.4.6.dist-info → ctm_python_client-2.4.8.dist-info}/top_level.txt +0 -0
aapi/bases.py
CHANGED
|
@@ -1,74 +1,107 @@
|
|
|
1
|
-
import attrs
|
|
2
1
|
import enum
|
|
3
|
-
import typing
|
|
4
2
|
import json
|
|
5
3
|
import random
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
import attrs
|
|
7
|
+
|
|
6
8
|
from ctm_python_client.core.comm import Environment
|
|
7
9
|
from ctm_python_client.core.monitoring import RunMonitor
|
|
8
10
|
|
|
11
|
+
|
|
9
12
|
class AAPIJob:
|
|
10
13
|
pass
|
|
11
14
|
|
|
15
|
+
|
|
12
16
|
class AAPIObject:
|
|
13
|
-
def as_aapi_dict(self):
|
|
17
|
+
def as_aapi_dict(self, ignore_event_type=True):
|
|
18
|
+
|
|
19
|
+
# Import inside the method to prevent circular import issues
|
|
20
|
+
from aapi.ifbase import IfCompletionStatus
|
|
21
|
+
|
|
14
22
|
res = {}
|
|
15
23
|
|
|
16
24
|
if '_type' in attrs.fields_dict(self.__class__):
|
|
17
|
-
|
|
25
|
+
is_condition_or_event = self._type.startswith(('Condition', 'Event'))
|
|
26
|
+
|
|
27
|
+
if ignore_event_type:
|
|
28
|
+
if not is_condition_or_event:
|
|
29
|
+
res['Type'] = self._type
|
|
30
|
+
elif self._type.startswith('Event'):
|
|
18
31
|
res['Type'] = self._type
|
|
19
|
-
|
|
32
|
+
|
|
33
|
+
|
|
20
34
|
if attrs.has(self):
|
|
21
35
|
for field in attrs.fields(self.__class__):
|
|
22
36
|
value = self.__getattribute__(field.name)
|
|
23
|
-
aapi_repr = field.metadata.get(
|
|
37
|
+
aapi_repr = field.metadata.get("_aapi_repr_")
|
|
24
38
|
|
|
25
39
|
if value in [None, [], {}]:
|
|
26
40
|
continue
|
|
27
41
|
|
|
28
42
|
if aapi_repr:
|
|
29
|
-
if
|
|
30
|
-
if
|
|
31
|
-
if
|
|
32
|
-
res.__delitem__(
|
|
43
|
+
if "_type_aapi_" in field.metadata:
|
|
44
|
+
if "_hide_type_" in field.metadata:
|
|
45
|
+
if "Type" in res:
|
|
46
|
+
res.__delitem__("Type")
|
|
33
47
|
continue
|
|
34
|
-
if
|
|
48
|
+
if "as_aapi_dict" in dir(value):
|
|
35
49
|
res[aapi_repr] = value.as_aapi_dict()
|
|
36
50
|
elif isinstance(value, list):
|
|
37
51
|
res[aapi_repr] = [
|
|
38
|
-
(o.as_aapi_dict() if
|
|
52
|
+
(o.as_aapi_dict() if "as_aapi_dict" in dir(o) else o)
|
|
53
|
+
for o in value
|
|
39
54
|
]
|
|
40
55
|
elif isinstance(value, enum.Enum):
|
|
41
56
|
res[aapi_repr] = value.value
|
|
42
57
|
else:
|
|
43
58
|
res[aapi_repr] = value
|
|
44
59
|
|
|
45
|
-
elif field.metadata.get(
|
|
60
|
+
elif field.metadata.get("_abstract_aapi_container_"):
|
|
46
61
|
for obj in value:
|
|
47
|
-
|
|
62
|
+
obj_ignore_type = ignore_event_type
|
|
63
|
+
if isinstance(self, IfCompletionStatus):
|
|
64
|
+
obj_ignore_type = False
|
|
65
|
+
res[obj.object_name] = obj.as_aapi_dict(ignore_event_type=obj_ignore_type)
|
|
48
66
|
|
|
49
67
|
else:
|
|
50
|
-
res[
|
|
68
|
+
res["attrsibutes_valid"] = False
|
|
51
69
|
|
|
52
70
|
return res
|
|
53
71
|
|
|
54
|
-
|
|
55
72
|
def dumps_aapi(self, indent=None):
|
|
56
73
|
return json.dumps(self.as_aapi_dict(), indent=indent)
|
|
57
74
|
|
|
58
|
-
def dump_aapi(self, f,
|
|
75
|
+
def dump_aapi(self, f, indent=None):
|
|
59
76
|
return json.dump(self.as_aapi_dict(), f, indent=indent)
|
|
60
77
|
|
|
61
|
-
def as_dict(self):
|
|
78
|
+
def as_dict(self):
|
|
62
79
|
return attrs.asdict(self)
|
|
63
|
-
|
|
64
|
-
def run_on_demand(
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
|
|
81
|
+
def run_on_demand(
|
|
82
|
+
self,
|
|
83
|
+
environment: Environment,
|
|
84
|
+
skip_initial_authentication: bool = False,
|
|
85
|
+
inpath: str = f"run_on_demand{random.randint(100,999)}",
|
|
86
|
+
controlm_server: str = None,
|
|
87
|
+
run_as: str = None,
|
|
88
|
+
host: str = None,
|
|
89
|
+
application: str = None,
|
|
90
|
+
sub_application: str = None,
|
|
91
|
+
skip_login: bool = False,
|
|
92
|
+
file_path: str = None,
|
|
93
|
+
delete_afterwards: bool = True,
|
|
94
|
+
open_in_browser: str = None,
|
|
95
|
+
) -> RunMonitor:
|
|
67
96
|
# Import circular dependency
|
|
68
|
-
from ctm_python_client.core.workflow import Workflow, WorkflowDefaults
|
|
69
97
|
from aapi import Folder
|
|
70
|
-
|
|
71
|
-
|
|
98
|
+
from ctm_python_client.core.workflow import Workflow, WorkflowDefaults
|
|
99
|
+
|
|
100
|
+
if (hasattr(self, "_type") and "Job" in self._type) or (
|
|
101
|
+
hasattr(self, "job_list")
|
|
102
|
+
and self.job_list is not None
|
|
103
|
+
and len(self.job_list) > 0
|
|
104
|
+
):
|
|
72
105
|
try:
|
|
73
106
|
on_demand_workflow = Workflow(
|
|
74
107
|
environment,
|
|
@@ -77,29 +110,31 @@ class AAPIObject:
|
|
|
77
110
|
run_as=run_as,
|
|
78
111
|
host=host,
|
|
79
112
|
application=application,
|
|
80
|
-
sub_application=sub_application
|
|
113
|
+
sub_application=sub_application,
|
|
81
114
|
),
|
|
82
|
-
skip_initial_authentication=skip_initial_authentication
|
|
115
|
+
skip_initial_authentication=skip_initial_authentication,
|
|
83
116
|
)
|
|
84
117
|
if isinstance(self, Folder):
|
|
85
118
|
on_demand_workflow.add(self)
|
|
86
119
|
else:
|
|
87
120
|
on_demand_workflow.add(self, inpath=inpath)
|
|
88
|
-
|
|
121
|
+
|
|
89
122
|
return on_demand_workflow.run_on_demand(
|
|
90
|
-
skip_login=skip_login,
|
|
91
|
-
file_path=file_path,
|
|
123
|
+
skip_login=skip_login,
|
|
124
|
+
file_path=file_path,
|
|
92
125
|
delete_afterwards=delete_afterwards,
|
|
93
|
-
open_in_browser=open_in_browser
|
|
94
|
-
|
|
126
|
+
open_in_browser=open_in_browser,
|
|
127
|
+
)
|
|
95
128
|
except Exception as e:
|
|
96
|
-
if hasattr(e,
|
|
97
|
-
errors = [
|
|
98
|
-
|
|
129
|
+
if hasattr(e, "body"):
|
|
130
|
+
errors = [
|
|
131
|
+
err.get("message", "") + " " + err.get("item", "")
|
|
132
|
+
for err in json.loads(e.body)["errors"]
|
|
133
|
+
]
|
|
99
134
|
raise RuntimeError(f"AAPI request failed: {', '.join(errors)}")
|
|
100
135
|
else:
|
|
101
136
|
raise e
|
|
102
137
|
finally:
|
|
103
138
|
on_demand_workflow.clear_all()
|
|
104
139
|
else:
|
|
105
|
-
raise Exception(
|
|
140
|
+
raise Exception("Run is not allowed for json without jobs")
|
aapi/ifbase.py
CHANGED
|
@@ -1,102 +1,140 @@
|
|
|
1
|
-
|
|
2
1
|
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import typing
|
|
2
|
+
|
|
5
3
|
import enum
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
import attrs
|
|
7
|
+
|
|
6
8
|
from aapi import *
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
@attrs.define
|
|
10
12
|
class IfBase(AAPIObject):
|
|
11
13
|
|
|
12
|
-
_type: str = attrs.field(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
_type: str = attrs.field(
|
|
15
|
+
init=False,
|
|
16
|
+
default="IfBase",
|
|
17
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "IfBase"},
|
|
18
|
+
)
|
|
19
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
20
|
+
on_list: typing.List[On] = attrs.field(
|
|
21
|
+
kw_only=True, factory=list, metadata={"_abstract_aapi_container_": True}
|
|
22
|
+
)
|
|
23
|
+
do_list: typing.List[Do] = attrs.field(
|
|
24
|
+
kw_only=True, factory=list, metadata={"_abstract_aapi_container_": True}
|
|
25
|
+
)
|
|
19
26
|
|
|
20
27
|
|
|
21
28
|
@attrs.define
|
|
22
29
|
class IfBaseFolder(IfBase):
|
|
23
30
|
|
|
24
|
-
_type: str = attrs.field(
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
_type: str = attrs.field(
|
|
32
|
+
init=False,
|
|
33
|
+
default="IfBase:Folder",
|
|
34
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "IfBase:Folder"},
|
|
35
|
+
)
|
|
36
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
27
37
|
|
|
28
38
|
|
|
29
39
|
@attrs.define
|
|
30
40
|
class IfOutput(IfBaseFolder):
|
|
31
41
|
|
|
32
|
-
_type: str = attrs.field(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
_type: str = attrs.field(
|
|
43
|
+
init=False,
|
|
44
|
+
default="If:Output",
|
|
45
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "If:Output"},
|
|
46
|
+
)
|
|
47
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
48
|
+
code: str = attrs.field(
|
|
49
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "Code"}
|
|
50
|
+
)
|
|
51
|
+
statement: str = attrs.field(
|
|
52
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "Statement"}
|
|
53
|
+
)
|
|
39
54
|
|
|
40
55
|
|
|
41
56
|
@attrs.define
|
|
42
57
|
class IfCompletionStatus(IfBaseFolder):
|
|
43
58
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
_type: str = attrs.field(
|
|
60
|
+
init=False,
|
|
61
|
+
default="If:CompletionStatus",
|
|
62
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "If:CompletionStatus"},
|
|
63
|
+
)
|
|
64
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
48
65
|
completion_status: str = attrs.field(
|
|
49
|
-
kw_only=True, default=None, metadata={
|
|
66
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "CompletionStatus"}
|
|
67
|
+
)
|
|
50
68
|
|
|
51
69
|
|
|
52
70
|
@attrs.define
|
|
53
71
|
class IfNumberOfReruns(IfBaseFolder):
|
|
54
72
|
|
|
55
|
-
_type: str = attrs.field(
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
_type: str = attrs.field(
|
|
74
|
+
init=False,
|
|
75
|
+
default="If:NumberOfReruns",
|
|
76
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "If:NumberOfReruns"},
|
|
77
|
+
)
|
|
78
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
58
79
|
number_of_reruns: str = attrs.field(
|
|
59
|
-
kw_only=True, default=None, metadata={
|
|
80
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "NumberOfReruns"}
|
|
81
|
+
)
|
|
60
82
|
|
|
61
83
|
|
|
62
84
|
@attrs.define
|
|
63
85
|
class IfNumberOfExecutions(IfBaseFolder):
|
|
64
86
|
|
|
65
|
-
_type: str = attrs.field(
|
|
66
|
-
|
|
67
|
-
|
|
87
|
+
_type: str = attrs.field(
|
|
88
|
+
init=False,
|
|
89
|
+
default="If:NumberOfExecutions",
|
|
90
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "If:NumberOfExecutions"},
|
|
91
|
+
)
|
|
92
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
68
93
|
number_of_executions: str = attrs.field(
|
|
69
|
-
kw_only=True, default=None, metadata={
|
|
94
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "NumberOfExecutions"}
|
|
95
|
+
)
|
|
70
96
|
|
|
71
97
|
|
|
72
98
|
@attrs.define
|
|
73
99
|
class IfNumberOfFailures(IfBaseFolder):
|
|
74
100
|
|
|
75
|
-
_type: str = attrs.field(
|
|
76
|
-
|
|
77
|
-
|
|
101
|
+
_type: str = attrs.field(
|
|
102
|
+
init=False,
|
|
103
|
+
default="If:NumberOfFailures",
|
|
104
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "If:NumberOfFailures"},
|
|
105
|
+
)
|
|
106
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
78
107
|
number_of_failures: str = attrs.field(
|
|
79
|
-
kw_only=True, default=None, metadata={
|
|
108
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "NumberOfFailures"}
|
|
109
|
+
)
|
|
80
110
|
|
|
81
111
|
|
|
82
112
|
@attrs.define
|
|
83
113
|
class IfJobNotSubmitted(IfBase):
|
|
84
114
|
|
|
85
|
-
_type: str = attrs.field(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
115
|
+
_type: str = attrs.field(
|
|
116
|
+
init=False,
|
|
117
|
+
default="If:JobNotSubmitted",
|
|
118
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "If:JobNotSubmitted"},
|
|
119
|
+
)
|
|
120
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
121
|
+
job_not_submitted: str = attrs.field(
|
|
122
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "JobNotSubmitted"}
|
|
123
|
+
)
|
|
90
124
|
|
|
91
125
|
|
|
92
126
|
@attrs.define
|
|
93
127
|
class IfJobOutputNotFound(IfBase):
|
|
94
128
|
|
|
95
|
-
_type: str = attrs.field(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
129
|
+
_type: str = attrs.field(
|
|
130
|
+
init=False,
|
|
131
|
+
default="If:JobOutputNotFound",
|
|
132
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "If:JobOutputNotFound"},
|
|
133
|
+
)
|
|
134
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
135
|
+
job_output_not_found: str = attrs.field(
|
|
136
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "JobOutputNotFound"}
|
|
137
|
+
)
|
|
100
138
|
|
|
101
139
|
|
|
102
140
|
@attrs.define
|
|
@@ -105,10 +143,12 @@ class IfVariableValue(IfBase):
|
|
|
105
143
|
@attrs.define
|
|
106
144
|
class RangeVariableValue(AAPIObject):
|
|
107
145
|
|
|
108
|
-
min: str = attrs.field(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
146
|
+
min: str = attrs.field(
|
|
147
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "Min"}
|
|
148
|
+
)
|
|
149
|
+
max: str = attrs.field(
|
|
150
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "Max"}
|
|
151
|
+
)
|
|
112
152
|
|
|
113
153
|
class Operator(enum.Enum):
|
|
114
154
|
|
|
@@ -131,14 +171,21 @@ class IfVariableValue(IfBase):
|
|
|
131
171
|
IsEmpty = "IsEmpty"
|
|
132
172
|
IsNotEmpty = "IsNotEmpty"
|
|
133
173
|
|
|
134
|
-
_type: str = attrs.field(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
174
|
+
_type: str = attrs.field(
|
|
175
|
+
init=False,
|
|
176
|
+
default="If:VariableValue",
|
|
177
|
+
metadata={"_aapi_repr_": "Type", "_type_aapi_": "If:VariableValue"},
|
|
178
|
+
)
|
|
179
|
+
object_name: str = attrs.field(metadata={"_aapi_name_": True})
|
|
180
|
+
variable_name: str = attrs.field(
|
|
181
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "VariableName"}
|
|
182
|
+
)
|
|
139
183
|
range_variable_value: RangeVariableValue = attrs.field(
|
|
140
|
-
kw_only=True, default=None, metadata={
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
184
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "RangeVariableValue"}
|
|
185
|
+
)
|
|
186
|
+
variable_value: str = attrs.field(
|
|
187
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "VariableValue"}
|
|
188
|
+
)
|
|
189
|
+
operator: Operator = attrs.field(
|
|
190
|
+
kw_only=True, default=None, metadata={"_aapi_repr_": "Operator"}
|
|
191
|
+
)
|