tracdap-runtime 0.6.1.dev3__py3-none-any.whl → 0.6.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.
- tracdap/rt/_exec/context.py +25 -1
- tracdap/rt/_exec/dev_mode.py +277 -213
- tracdap/rt/_exec/functions.py +37 -8
- tracdap/rt/_exec/graph.py +2 -0
- tracdap/rt/_exec/graph_builder.py +118 -56
- tracdap/rt/_exec/runtime.py +28 -0
- tracdap/rt/_exec/server.py +68 -0
- tracdap/rt/_impl/data.py +14 -0
- tracdap/rt/_impl/grpc/__init__.py +13 -0
- tracdap/rt/_impl/grpc/codec.py +44 -0
- tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.py +51 -0
- tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.pyi +59 -0
- tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2_grpc.py +183 -0
- tracdap/rt/_impl/grpc/tracdap/config/common_pb2.py +55 -0
- tracdap/rt/_impl/grpc/tracdap/config/common_pb2.pyi +103 -0
- tracdap/rt/_impl/grpc/tracdap/config/job_pb2.py +42 -0
- tracdap/rt/_impl/grpc/tracdap/config/job_pb2.pyi +44 -0
- tracdap/rt/_impl/grpc/tracdap/config/platform_pb2.py +71 -0
- tracdap/rt/_impl/grpc/tracdap/config/platform_pb2.pyi +197 -0
- tracdap/rt/_impl/grpc/tracdap/config/result_pb2.py +37 -0
- tracdap/rt/_impl/grpc/tracdap/config/result_pb2.pyi +35 -0
- tracdap/rt/_impl/grpc/tracdap/config/runtime_pb2.py +42 -0
- tracdap/rt/_impl/grpc/tracdap/config/runtime_pb2.pyi +46 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/common_pb2.py +33 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/common_pb2.pyi +34 -0
- tracdap/rt/{metadata → _impl/grpc/tracdap/metadata}/custom_pb2.py +5 -5
- tracdap/rt/_impl/grpc/tracdap/metadata/custom_pb2.pyi +15 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.py +51 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.pyi +115 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.py +28 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.pyi +22 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/flow_pb2.py +59 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/flow_pb2.pyi +109 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.py +76 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.pyi +177 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.py +51 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.pyi +92 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/object_id_pb2.py +32 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/object_id_pb2.pyi +68 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.py +35 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.pyi +35 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/search_pb2.py +39 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/search_pb2.pyi +83 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/stoarge_pb2.py +50 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/stoarge_pb2.pyi +89 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/tag_pb2.py +34 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/tag_pb2.pyi +26 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/tag_update_pb2.py +30 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/tag_update_pb2.pyi +34 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/type_pb2.py +47 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/type_pb2.pyi +101 -0
- tracdap/rt/_impl/guard_rails.py +5 -6
- tracdap/rt/_impl/static_api.py +10 -6
- tracdap/rt/_version.py +1 -1
- tracdap/rt/api/hook.py +6 -2
- tracdap/rt/api/model_api.py +22 -0
- tracdap/rt/api/static_api.py +14 -4
- tracdap/rt/config/__init__.py +3 -3
- tracdap/rt/config/platform.py +9 -9
- tracdap/rt/launch/cli.py +3 -5
- tracdap/rt/launch/launch.py +15 -3
- tracdap/rt/metadata/__init__.py +15 -15
- tracdap/rt/metadata/common.py +7 -7
- tracdap/rt/metadata/custom.py +2 -0
- tracdap/rt/metadata/data.py +28 -5
- tracdap/rt/metadata/file.py +2 -0
- tracdap/rt/metadata/flow.py +66 -4
- tracdap/rt/metadata/job.py +56 -16
- tracdap/rt/metadata/model.py +4 -0
- tracdap/rt/metadata/object_id.py +9 -9
- tracdap/rt/metadata/search.py +35 -13
- tracdap/rt/metadata/stoarge.py +64 -6
- tracdap/rt/metadata/tag_update.py +21 -7
- tracdap/rt/metadata/type.py +28 -13
- {tracdap_runtime-0.6.1.dev3.dist-info → tracdap_runtime-0.6.2.dist-info}/METADATA +22 -19
- tracdap_runtime-0.6.2.dist-info/RECORD +121 -0
- {tracdap_runtime-0.6.1.dev3.dist-info → tracdap_runtime-0.6.2.dist-info}/WHEEL +1 -1
- tracdap/rt/config/common_pb2.py +0 -55
- tracdap/rt/config/job_pb2.py +0 -42
- tracdap/rt/config/platform_pb2.py +0 -71
- tracdap/rt/config/result_pb2.py +0 -37
- tracdap/rt/config/runtime_pb2.py +0 -42
- tracdap/rt/metadata/common_pb2.py +0 -33
- tracdap/rt/metadata/data_pb2.py +0 -51
- tracdap/rt/metadata/file_pb2.py +0 -28
- tracdap/rt/metadata/flow_pb2.py +0 -55
- tracdap/rt/metadata/job_pb2.py +0 -76
- tracdap/rt/metadata/model_pb2.py +0 -51
- tracdap/rt/metadata/object_id_pb2.py +0 -32
- tracdap/rt/metadata/object_pb2.py +0 -35
- tracdap/rt/metadata/search_pb2.py +0 -39
- tracdap/rt/metadata/stoarge_pb2.py +0 -50
- tracdap/rt/metadata/tag_pb2.py +0 -34
- tracdap/rt/metadata/tag_update_pb2.py +0 -30
- tracdap/rt/metadata/type_pb2.py +0 -48
- tracdap_runtime-0.6.1.dev3.dist-info/RECORD +0 -96
- {tracdap_runtime-0.6.1.dev3.dist-info → tracdap_runtime-0.6.2.dist-info}/LICENSE +0 -0
- {tracdap_runtime-0.6.1.dev3.dist-info → tracdap_runtime-0.6.2.dist-info}/top_level.txt +0 -0
tracdap/rt/metadata/flow.py
CHANGED
@@ -13,20 +13,48 @@ from .tag_update import * # noqa
|
|
13
13
|
|
14
14
|
class FlowNodeType(_enum.Enum):
|
15
15
|
|
16
|
-
|
16
|
+
"""
|
17
|
+
Specify the type of an individual flow node
|
18
|
+
|
19
|
+
.. seealso::
|
20
|
+
:class:`FlowNode <FlowNode>`
|
21
|
+
"""
|
17
22
|
|
18
|
-
|
23
|
+
NODE_TYPE_NOT_SET = 0
|
19
24
|
|
20
|
-
|
25
|
+
INPUT_NODE = 1
|
21
26
|
|
22
|
-
|
27
|
+
"""Input nodes described inputs to the flow, such as a files or datasets"""
|
28
|
+
|
29
|
+
OUTPUT_NODE = 2
|
30
|
+
|
31
|
+
"""Output nodes describe outputs the flow produces, such as a files or datasets"""
|
32
|
+
|
33
|
+
MODEL_NODE = 3
|
34
|
+
|
35
|
+
"""Model nodes are placeholders for TRAC models that will be supplied at runtime"""
|
36
|
+
|
37
|
+
PARAMETER_NODE = 4
|
38
|
+
|
39
|
+
"""Parameter nodes allow explicit mapping of parameters into models
|
40
|
+
(TRAC can infer parameters by name if they are not defined explicitly)
|
41
|
+
"""
|
23
42
|
|
24
43
|
|
25
44
|
@_dc.dataclass
|
26
45
|
class FlowNode:
|
27
46
|
|
47
|
+
"""
|
48
|
+
Describes an individual node in a flow
|
49
|
+
|
50
|
+
.. seealso::
|
51
|
+
:class:`FlowDefinition <FlowDefinition>`
|
52
|
+
"""
|
53
|
+
|
28
54
|
nodeType: FlowNodeType = FlowNodeType.NODE_TYPE_NOT_SET
|
29
55
|
|
56
|
+
parameters: _tp.List[str] = _dc.field(default_factory=list)
|
57
|
+
|
30
58
|
inputs: _tp.List[str] = _dc.field(default_factory=list)
|
31
59
|
|
32
60
|
outputs: _tp.List[str] = _dc.field(default_factory=list)
|
@@ -35,12 +63,28 @@ class FlowNode:
|
|
35
63
|
|
36
64
|
nodeAttrs: _tp.List[TagUpdate] = _dc.field(default_factory=list)
|
37
65
|
|
66
|
+
nodeProps: _tp.Dict[str, Value] = _dc.field(default_factory=dict)
|
67
|
+
|
38
68
|
label: str = None
|
39
69
|
|
40
70
|
|
41
71
|
@_dc.dataclass
|
42
72
|
class FlowSocket:
|
43
73
|
|
74
|
+
"""
|
75
|
+
A socket is a point of connection for wiring up the edges in a flow
|
76
|
+
|
77
|
+
For parameter, input and output nodes the socket is just the node name and the socket field will be blank.
|
78
|
+
For models, the node name refers to a model node and the socket is the name of the parameter, input or output
|
79
|
+
being connected. E.g. these two sockets could be used to connect a flow input to a model, using an edge::
|
80
|
+
|
81
|
+
flow_input_socket = { "node": "my_input_dataset", socket: "" }
|
82
|
+
model_input_socket = { "node": "my_model", "socket": "input_1" }.
|
83
|
+
|
84
|
+
.. seealso::
|
85
|
+
:class:`FlowEdge <FlowEdge>`
|
86
|
+
"""
|
87
|
+
|
44
88
|
node: str = None
|
45
89
|
|
46
90
|
socket: str = None
|
@@ -49,6 +93,13 @@ class FlowSocket:
|
|
49
93
|
@_dc.dataclass
|
50
94
|
class FlowEdge:
|
51
95
|
|
96
|
+
"""
|
97
|
+
A connection between two nodes in a flow
|
98
|
+
|
99
|
+
.. seealso::
|
100
|
+
:class:`FlowSocket <FlowSocket>`
|
101
|
+
"""
|
102
|
+
|
52
103
|
source: FlowSocket = None
|
53
104
|
|
54
105
|
target: FlowSocket = None
|
@@ -57,6 +108,17 @@ class FlowEdge:
|
|
57
108
|
@_dc.dataclass
|
58
109
|
class FlowDefinition:
|
59
110
|
|
111
|
+
"""
|
112
|
+
A flow defines an execution graph as a set of connections between models and data
|
113
|
+
|
114
|
+
A flow describes the shape of the execution graph, it does not fix in advance the set
|
115
|
+
of models and datasets that will go into it. When a RUN_FLOW job is created, the job
|
116
|
+
matches the flow with a set of models, inputs, outputs and parameters.
|
117
|
+
|
118
|
+
.. seealso::
|
119
|
+
:class:`JobDefinition <JobDefinition>`
|
120
|
+
"""
|
121
|
+
|
60
122
|
nodes: _tp.Dict[str, FlowNode] = _dc.field(default_factory=dict)
|
61
123
|
|
62
124
|
edges: _tp.List[FlowEdge] = _dc.field(default_factory=list)
|
tracdap/rt/metadata/job.py
CHANGED
@@ -12,45 +12,79 @@ from .tag_update import * # noqa
|
|
12
12
|
|
13
13
|
class JobType(_enum.Enum):
|
14
14
|
|
15
|
-
|
15
|
+
"""Specify the type of an individual TRAC job"""
|
16
16
|
|
17
|
-
|
17
|
+
JOB_TYPE_NOT_SET = 0
|
18
18
|
|
19
|
-
|
19
|
+
RUN_MODEL = 1
|
20
20
|
|
21
|
-
|
21
|
+
"""Run a single model, with parameters and inputs"""
|
22
22
|
|
23
|
-
|
23
|
+
RUN_FLOW = 2
|
24
|
+
|
25
|
+
"""Run a flow with all its models, parameters and inputs"""
|
26
|
+
|
27
|
+
IMPORT_MODEL = 3
|
28
|
+
|
29
|
+
"""Import a model into the platform"""
|
30
|
+
|
31
|
+
IMPORT_DATA = 4
|
32
|
+
|
33
|
+
"""Import data into the platform"""
|
24
34
|
|
25
35
|
|
26
36
|
class JobStatusCode(_enum.Enum):
|
27
37
|
|
28
|
-
|
38
|
+
"""Indicate the status of a job in the TRAC platform"""
|
39
|
+
|
40
|
+
JOB_STATUS_CODE_NOT_SET = 0
|
41
|
+
|
42
|
+
PREPARING = 1
|
43
|
+
|
44
|
+
"""The job is being set up"""
|
45
|
+
|
46
|
+
VALIDATED = 2
|
47
|
+
|
48
|
+
"""The job has passed validation and is ok to run (dry-run operations may return this status)"""
|
29
49
|
|
30
|
-
|
50
|
+
PENDING = 3
|
31
51
|
|
32
|
-
|
52
|
+
"""The job is being set up"""
|
33
53
|
|
34
|
-
|
54
|
+
QUEUED = 4
|
35
55
|
|
36
|
-
|
56
|
+
"""The job is queued in TRAC, waiting for available resources"""
|
37
57
|
|
38
|
-
SUBMITTED = 5
|
58
|
+
SUBMITTED = 5
|
39
59
|
|
40
|
-
|
60
|
+
"""The job has been submitted for execution but has not yet started"""
|
41
61
|
|
42
|
-
|
62
|
+
RUNNING = 6
|
43
63
|
|
44
|
-
|
64
|
+
"""The job is currently running"""
|
45
65
|
|
46
|
-
|
66
|
+
FINISHING = 7
|
47
67
|
|
48
|
-
|
68
|
+
"""Job execution completed, the platform is cleaning up and validating the outputs"""
|
69
|
+
|
70
|
+
SUCCEEDED = 8
|
71
|
+
|
72
|
+
"""The job completed successfully and the results are available"""
|
73
|
+
|
74
|
+
FAILED = 9
|
75
|
+
|
76
|
+
"""The job failed and has been terminated or rejected"""
|
77
|
+
|
78
|
+
CANCELLED = 10
|
79
|
+
|
80
|
+
"""The job was cancelled by a user of the platform"""
|
49
81
|
|
50
82
|
|
51
83
|
@_dc.dataclass
|
52
84
|
class JobDefinition:
|
53
85
|
|
86
|
+
"""Define a job to run on the TRAC platform"""
|
87
|
+
|
54
88
|
jobType: JobType = JobType.JOB_TYPE_NOT_SET
|
55
89
|
|
56
90
|
runModel: _tp.Optional[RunModelJob] = None
|
@@ -63,6 +97,8 @@ class JobDefinition:
|
|
63
97
|
@_dc.dataclass
|
64
98
|
class RunModelJob:
|
65
99
|
|
100
|
+
"""Specification for a RuN_MODEL job"""
|
101
|
+
|
66
102
|
model: TagSelector = None
|
67
103
|
|
68
104
|
parameters: _tp.Dict[str, Value] = _dc.field(default_factory=dict)
|
@@ -79,6 +115,8 @@ class RunModelJob:
|
|
79
115
|
@_dc.dataclass
|
80
116
|
class RunFlowJob:
|
81
117
|
|
118
|
+
"""Specification for a RUN_FLOW job"""
|
119
|
+
|
82
120
|
flow: TagSelector = None
|
83
121
|
|
84
122
|
parameters: _tp.Dict[str, Value] = _dc.field(default_factory=dict)
|
@@ -97,6 +135,8 @@ class RunFlowJob:
|
|
97
135
|
@_dc.dataclass
|
98
136
|
class ImportModelJob:
|
99
137
|
|
138
|
+
"""Specification for an IMPORT_MODEL job"""
|
139
|
+
|
100
140
|
language: str = None
|
101
141
|
|
102
142
|
repository: str = None
|
tracdap/rt/metadata/model.py
CHANGED
@@ -41,6 +41,8 @@ class ModelInputSchema:
|
|
41
41
|
|
42
42
|
label: _tp.Optional[str] = None
|
43
43
|
|
44
|
+
optional: bool = None
|
45
|
+
|
44
46
|
|
45
47
|
@_dc.dataclass
|
46
48
|
class ModelOutputSchema:
|
@@ -62,6 +64,8 @@ class ModelOutputSchema:
|
|
62
64
|
|
63
65
|
label: _tp.Optional[str] = None
|
64
66
|
|
67
|
+
optional: bool = None
|
68
|
+
|
65
69
|
|
66
70
|
@_dc.dataclass
|
67
71
|
class ModelDefinition:
|
tracdap/rt/metadata/object_id.py
CHANGED
@@ -17,23 +17,23 @@ class ObjectType(_enum.Enum):
|
|
17
17
|
:class:`ObjectDefinition <ObjectDefinition>`
|
18
18
|
"""
|
19
19
|
|
20
|
-
OBJECT_TYPE_NOT_SET = 0
|
20
|
+
OBJECT_TYPE_NOT_SET = 0
|
21
21
|
|
22
|
-
DATA = 1
|
22
|
+
DATA = 1
|
23
23
|
|
24
|
-
MODEL = 2
|
24
|
+
MODEL = 2
|
25
25
|
|
26
|
-
FLOW = 3
|
26
|
+
FLOW = 3
|
27
27
|
|
28
|
-
JOB = 4
|
28
|
+
JOB = 4
|
29
29
|
|
30
|
-
FILE = 5
|
30
|
+
FILE = 5
|
31
31
|
|
32
|
-
CUSTOM = 6
|
32
|
+
CUSTOM = 6
|
33
33
|
|
34
|
-
STORAGE = 7
|
34
|
+
STORAGE = 7
|
35
35
|
|
36
|
-
SCHEMA = 8
|
36
|
+
SCHEMA = 8
|
37
37
|
|
38
38
|
|
39
39
|
@_dc.dataclass
|
tracdap/rt/metadata/search.py
CHANGED
@@ -18,9 +18,11 @@ class SearchOperator(_enum.Enum):
|
|
18
18
|
:class:`SearchTerm <SearchTerm>`
|
19
19
|
"""
|
20
20
|
|
21
|
-
SEARCH_OPERATOR_NOT_SET = 0
|
21
|
+
SEARCH_OPERATOR_NOT_SET = 0
|
22
22
|
|
23
|
-
EQ = 1
|
23
|
+
EQ = 1
|
24
|
+
|
25
|
+
"""EQUALS
|
24
26
|
|
25
27
|
The EQ operator matches a tag when the tag has an attribute that matches the
|
26
28
|
search term exactly, i.e. attribute name, type and value all match. For
|
@@ -32,7 +34,9 @@ class SearchOperator(_enum.Enum):
|
|
32
34
|
for this reason it is not recommended to use the EQ operator with FLOAT values.
|
33
35
|
"""
|
34
36
|
|
35
|
-
NE = 2
|
37
|
+
NE = 2
|
38
|
+
|
39
|
+
"""DOES NOT EQUAL
|
36
40
|
|
37
41
|
The NE operator matches a tag precisely when the EQ operator does not match it.
|
38
42
|
This could be because the tag attribute does not match the search term, or because
|
@@ -48,7 +52,9 @@ class SearchOperator(_enum.Enum):
|
|
48
52
|
for this reason it is not recommended to use the NE operator with FLOAT values.
|
49
53
|
"""
|
50
54
|
|
51
|
-
LT = 3
|
55
|
+
LT = 3
|
56
|
+
|
57
|
+
"""LESS THAN
|
52
58
|
|
53
59
|
The LT operator matches a tag when the tag has an attribute with a value less than
|
54
60
|
the search parameter. The LT operator will only match single-valued attributes.
|
@@ -58,7 +64,9 @@ class SearchOperator(_enum.Enum):
|
|
58
64
|
even if one or more of the individual values matches the search term.
|
59
65
|
"""
|
60
66
|
|
61
|
-
LE = 4
|
67
|
+
LE = 4
|
68
|
+
|
69
|
+
"""LESS THAN OR EQUAL TO
|
62
70
|
|
63
71
|
The LE operator matches a tag when the tag has an attribute with a value less than
|
64
72
|
or equal to the search parameter. The LE operator will only match single-valued
|
@@ -69,7 +77,9 @@ class SearchOperator(_enum.Enum):
|
|
69
77
|
even if one or more of the individual values matches the search term.
|
70
78
|
"""
|
71
79
|
|
72
|
-
GT = 5
|
80
|
+
GT = 5
|
81
|
+
|
82
|
+
"""GREATER THAN
|
73
83
|
|
74
84
|
The GT operator matches a tag when the tag has an attribute with a value greater than
|
75
85
|
the search parameter. The GT operator will only match single-valued attributes.
|
@@ -79,7 +89,9 @@ class SearchOperator(_enum.Enum):
|
|
79
89
|
even if one or more of the individual values matches the search term.
|
80
90
|
"""
|
81
91
|
|
82
|
-
GE = 6
|
92
|
+
GE = 6
|
93
|
+
|
94
|
+
"""GREATER THAN OR EQUAL TO
|
83
95
|
|
84
96
|
The GE operator matches a tag when the tag has an attribute with a value greater than
|
85
97
|
or equal to the search parameter. The GE operator will only match single-valued
|
@@ -90,7 +102,9 @@ class SearchOperator(_enum.Enum):
|
|
90
102
|
even if one or more of the individual values matches the search term.
|
91
103
|
"""
|
92
104
|
|
93
|
-
IN = 7
|
105
|
+
IN = 7
|
106
|
+
|
107
|
+
"""IN
|
94
108
|
|
95
109
|
The IN operator matches a tag when the tag has an attribute whose value is matched
|
96
110
|
exactly by an item in the list of values provided. For multi-valued attributes, the
|
@@ -103,7 +117,9 @@ class SearchOperator(_enum.Enum):
|
|
103
117
|
for this reason it is not recommended to use the IN operator with FLOAT values.
|
104
118
|
"""
|
105
119
|
|
106
|
-
EXISTS = 8
|
120
|
+
EXISTS = 8
|
121
|
+
|
122
|
+
"""EXISTS
|
107
123
|
|
108
124
|
If an attribute type is provided the EXISTS operator matches a tag of specified
|
109
125
|
name when the tag has an attribute whose type is matched with type provided attribute
|
@@ -121,23 +137,29 @@ class LogicalOperator(_enum.Enum):
|
|
121
137
|
:class:`LogicalExpression <LogicalExpression>`
|
122
138
|
"""
|
123
139
|
|
124
|
-
LOGICAL_OPERATOR_NOT_SET = 0
|
140
|
+
LOGICAL_OPERATOR_NOT_SET = 0
|
141
|
+
|
142
|
+
AND = 1
|
125
143
|
|
126
|
-
|
144
|
+
"""LOGICAL AND
|
127
145
|
|
128
146
|
The AND operator combines two or more search expressions, the logical expression
|
129
147
|
will match only when all sub-expressions match. The order of sub-expressions is
|
130
148
|
not important.
|
131
149
|
"""
|
132
150
|
|
133
|
-
OR = 2
|
151
|
+
OR = 2
|
152
|
+
|
153
|
+
"""LOGICAL OR
|
134
154
|
|
135
155
|
The OR operator combines two or more search expressions, the logical expression
|
136
156
|
will match when any of the sub-expressions match. The order of sub-expressions
|
137
157
|
is not important.
|
138
158
|
"""
|
139
159
|
|
140
|
-
NOT = 3
|
160
|
+
NOT = 3
|
161
|
+
|
162
|
+
"""LOGICAL NOT
|
141
163
|
|
142
164
|
The NOT operator applies to a single sub-expression, the logical expression will
|
143
165
|
match precisely when the sub-expression does not match.
|
tracdap/rt/metadata/stoarge.py
CHANGED
@@ -10,25 +10,56 @@ from .type import * # noqa
|
|
10
10
|
|
11
11
|
class CopyStatus(_enum.Enum):
|
12
12
|
|
13
|
-
|
13
|
+
"""
|
14
|
+
Status of an individual copy of a data storage item
|
15
|
+
|
16
|
+
.. seealso::
|
17
|
+
:class:`StorageDefinition <StorageDefinition>`,
|
18
|
+
:class:`StorageCopy <StorageCopy>`
|
19
|
+
"""
|
14
20
|
|
15
|
-
|
21
|
+
COPY_STATUS_NOT_SET = 0
|
16
22
|
|
17
|
-
|
23
|
+
COPY_AVAILABLE = 1
|
24
|
+
|
25
|
+
"""The copy of the data item is available in storage to access"""
|
26
|
+
|
27
|
+
COPY_EXPUNGED = 2
|
28
|
+
|
29
|
+
"""The copy of the data item has been expunged and is no longer available"""
|
18
30
|
|
19
31
|
|
20
32
|
class IncarnationStatus(_enum.Enum):
|
21
33
|
|
22
|
-
|
34
|
+
"""
|
35
|
+
Status of an individual incarnation of a data storage item
|
36
|
+
|
37
|
+
.. seealso::
|
38
|
+
:class:`StorageDefinition <StorageDefinition>`,
|
39
|
+
:class:`StorageIncarnation <StorageIncarnation>`
|
40
|
+
"""
|
41
|
+
|
42
|
+
INCARNATION_STATUS_NOT_SET = 0
|
43
|
+
|
44
|
+
INCARNATION_AVAILABLE = 1
|
23
45
|
|
24
|
-
|
46
|
+
"""The incarnation of the data item has at least one copy available in storage"""
|
25
47
|
|
26
|
-
INCARNATION_EXPUNGED = 2
|
48
|
+
INCARNATION_EXPUNGED = 2
|
49
|
+
|
50
|
+
"""This incarnation of the data item is no longer available in storage, all copies have been expunged"""
|
27
51
|
|
28
52
|
|
29
53
|
@_dc.dataclass
|
30
54
|
class StorageCopy:
|
31
55
|
|
56
|
+
"""
|
57
|
+
Define physical storage for an individual copy of a data item
|
58
|
+
|
59
|
+
.. seealso::
|
60
|
+
:class:`StorageDefinition <StorageDefinition>`
|
61
|
+
"""
|
62
|
+
|
32
63
|
storageKey: str = None
|
33
64
|
|
34
65
|
storagePath: str = None
|
@@ -45,6 +76,13 @@ class StorageCopy:
|
|
45
76
|
@_dc.dataclass
|
46
77
|
class StorageIncarnation:
|
47
78
|
|
79
|
+
"""
|
80
|
+
Define physical storage for an individual incarnation of a data item
|
81
|
+
|
82
|
+
.. seealso::
|
83
|
+
:class:`StorageDefinition <StorageDefinition>`
|
84
|
+
"""
|
85
|
+
|
48
86
|
copies: _tp.List[StorageCopy] = _dc.field(default_factory=list)
|
49
87
|
|
50
88
|
incarnationIndex: int = None
|
@@ -57,12 +95,32 @@ class StorageIncarnation:
|
|
57
95
|
@_dc.dataclass
|
58
96
|
class StorageItem:
|
59
97
|
|
98
|
+
"""
|
99
|
+
Define physical storage for an individual data item
|
100
|
+
|
101
|
+
.. seealso::
|
102
|
+
:class:`StorageDefinition <StorageDefinition>`
|
103
|
+
"""
|
104
|
+
|
60
105
|
incarnations: _tp.List[StorageIncarnation] = _dc.field(default_factory=list)
|
61
106
|
|
62
107
|
|
63
108
|
@_dc.dataclass
|
64
109
|
class StorageDefinition:
|
65
110
|
|
111
|
+
"""
|
112
|
+
Defines the physical storage for a file or dataset object
|
113
|
+
|
114
|
+
Each storage item corresponds to one logical data item, such as a version of
|
115
|
+
a file or a snapshot of a data partition. Storage for each item is broken down
|
116
|
+
into incarnations (data that has been expunged and recomputed) and copies
|
117
|
+
(physical file-level copies for resilience, locality etc).
|
118
|
+
|
119
|
+
.. seealso::
|
120
|
+
:class:`DataDefinition <DataDefinition>`,
|
121
|
+
:class:`FileDefinition <FileDefinition>`
|
122
|
+
"""
|
123
|
+
|
66
124
|
dataItems: _tp.Dict[str, StorageItem] = _dc.field(default_factory=dict)
|
67
125
|
|
68
126
|
storageOptions: _tp.Dict[str, Value] = _dc.field(default_factory=dict)
|
@@ -17,7 +17,9 @@ class TagOperation(_enum.Enum):
|
|
17
17
|
:class:`TagUpdate <TagUpdate>`
|
18
18
|
"""
|
19
19
|
|
20
|
-
CREATE_OR_REPLACE_ATTR = 0
|
20
|
+
CREATE_OR_REPLACE_ATTR = 0
|
21
|
+
|
22
|
+
"""Add an attribute to a tag or replace it if it already exists.
|
21
23
|
|
22
24
|
This is the default operation if no operation is specified. If the
|
23
25
|
attribute does not exist it will be created using CREATE_ATTR, otherwise
|
@@ -28,7 +30,9 @@ class TagOperation(_enum.Enum):
|
|
28
30
|
:class:`REPLACE_ATTR <TagOperation.REPLACE_ATTR>`
|
29
31
|
"""
|
30
32
|
|
31
|
-
CREATE_OR_APPEND_ATTR = 1
|
33
|
+
CREATE_OR_APPEND_ATTR = 1
|
34
|
+
|
35
|
+
"""Add an attribute to a tag or append to it if it already exists.
|
32
36
|
|
33
37
|
If the attribute does not exist it will be created using CREATE_ATTR,
|
34
38
|
otherwise it will appended to using APPEND_ATTR.
|
@@ -38,9 +42,13 @@ class TagOperation(_enum.Enum):
|
|
38
42
|
:class:`APPEND_ATTR <TagOperation.APPEND_ATTR>`
|
39
43
|
"""
|
40
44
|
|
41
|
-
CREATE_ATTR = 2
|
45
|
+
CREATE_ATTR = 2
|
46
|
+
|
47
|
+
"""Add an attribute to a tag, fail if the attribute already exists."""
|
48
|
+
|
49
|
+
REPLACE_ATTR = 3
|
42
50
|
|
43
|
-
|
51
|
+
"""Replace an attribute on a tag, fail if the attribute does not exist.
|
44
52
|
|
45
53
|
When replacing an attribute, the new attribute must be of the same basic
|
46
54
|
type as the old one. It is allowed to replace a single-valued attribute
|
@@ -53,7 +61,9 @@ class TagOperation(_enum.Enum):
|
|
53
61
|
DELETE_ATTR followed by CREATE_ATTR.
|
54
62
|
"""
|
55
63
|
|
56
|
-
APPEND_ATTR = 4
|
64
|
+
APPEND_ATTR = 4
|
65
|
+
|
66
|
+
"""Append one or more values to an existing attribute, fail if the attribute
|
57
67
|
does not exist.
|
58
68
|
|
59
69
|
The existing attribute may be single- or multi-valued and the append
|
@@ -62,9 +72,13 @@ class TagOperation(_enum.Enum):
|
|
62
72
|
existing value(s).
|
63
73
|
"""
|
64
74
|
|
65
|
-
DELETE_ATTR = 5
|
75
|
+
DELETE_ATTR = 5
|
76
|
+
|
77
|
+
"""Remove an attribute from a tag, fail if the attribute does not exist."""
|
78
|
+
|
79
|
+
CLEAR_ALL_ATTR = 6
|
66
80
|
|
67
|
-
|
81
|
+
"""Remove all the attributes from a tag.
|
68
82
|
|
69
83
|
This operation does not affect controlled attributes, which are still
|
70
84
|
managed by TRAC according to its normal rules.
|
tracdap/rt/metadata/type.py
CHANGED
@@ -5,29 +5,36 @@ import typing as _tp # noqa
|
|
5
5
|
import dataclasses as _dc # noqa
|
6
6
|
import enum as _enum # noqa
|
7
7
|
|
8
|
-
from .common import * # noqa
|
9
|
-
|
10
|
-
|
11
8
|
class BasicType(_enum.Enum):
|
12
9
|
|
13
10
|
"""Basic types provide the set of core types available in the TRAC type system."""
|
14
11
|
|
15
|
-
BASIC_TYPE_NOT_SET = 0
|
12
|
+
BASIC_TYPE_NOT_SET = 0
|
13
|
+
|
14
|
+
BOOLEAN = 1
|
15
|
+
|
16
|
+
"""A true/false value"""
|
17
|
+
|
18
|
+
INTEGER = 2
|
19
|
+
|
20
|
+
"""64 bit signed integer"""
|
16
21
|
|
17
|
-
|
22
|
+
FLOAT = 3
|
18
23
|
|
19
|
-
|
24
|
+
"""64 bit signed floating point number (referred to as 'double' in many languages)"""
|
20
25
|
|
21
|
-
|
26
|
+
STRING = 4
|
22
27
|
|
23
|
-
|
28
|
+
"""UTF encoded string value of arbitrary length.
|
24
29
|
|
25
30
|
The encoding used (e.g. UTF-8, UTF-16, UCS-16) varies between languages / platforms,
|
26
31
|
generally TRAC will present strings using the standard encoding for a given language or
|
27
32
|
protocol.
|
28
33
|
"""
|
29
34
|
|
30
|
-
DECIMAL = 5
|
35
|
+
DECIMAL = 5
|
36
|
+
|
37
|
+
"""A fixed-point decimal value with known precision and scale.
|
31
38
|
|
32
39
|
The available precision and scale may vary between languages / platforms.
|
33
40
|
|
@@ -37,12 +44,16 @@ class BasicType(_enum.Enum):
|
|
37
44
|
precision - scale >= 21
|
38
45
|
"""
|
39
46
|
|
40
|
-
DATE = 6
|
47
|
+
DATE = 6
|
48
|
+
|
49
|
+
"""A date value.
|
41
50
|
|
42
51
|
Dates do not take any account of time zones or offsets from UTC.
|
43
52
|
"""
|
44
53
|
|
45
|
-
DATETIME = 7
|
54
|
+
DATETIME = 7
|
55
|
+
|
56
|
+
"""A date-time value.
|
46
57
|
|
47
58
|
Date-time values may be expressed with an offset from UTC, as per ISO 8601.
|
48
59
|
The available sub-second precision may vary depending on language / platform.
|
@@ -52,12 +63,16 @@ class BasicType(_enum.Enum):
|
|
52
63
|
supplied with an offset.
|
53
64
|
"""
|
54
65
|
|
55
|
-
ARRAY = 8
|
66
|
+
ARRAY = 8
|
67
|
+
|
68
|
+
"""An array of values, which may be primitive or composite values.
|
56
69
|
|
57
70
|
All items in an array must have the same type (i.e. the same type descriptor).
|
58
71
|
"""
|
59
72
|
|
60
|
-
MAP = 9
|
73
|
+
MAP = 9
|
74
|
+
|
75
|
+
"""An key-value map with string keys, values may be primitive or composite values.
|
61
76
|
|
62
77
|
Maps may be uniform, in which case all the values are of the same type, or non-
|
63
78
|
uniform in which case values can be of any type. For uniform maps the type
|