tracdap-runtime 0.6.5__py3-none-any.whl → 0.6.6__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 +272 -105
- tracdap/rt/_exec/dev_mode.py +231 -138
- tracdap/rt/_exec/engine.py +217 -59
- tracdap/rt/_exec/functions.py +25 -1
- tracdap/rt/_exec/graph.py +9 -0
- tracdap/rt/_exec/graph_builder.py +295 -198
- tracdap/rt/_exec/runtime.py +7 -5
- tracdap/rt/_impl/config_parser.py +11 -4
- tracdap/rt/_impl/data.py +278 -167
- tracdap/rt/_impl/ext/__init__.py +13 -0
- tracdap/rt/_impl/ext/sql.py +116 -0
- tracdap/rt/_impl/ext/storage.py +57 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.py +62 -54
- tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.pyi +37 -2
- tracdap/rt/_impl/static_api.py +24 -11
- tracdap/rt/_impl/storage.py +2 -2
- tracdap/rt/_impl/util.py +10 -0
- tracdap/rt/_impl/validation.py +66 -13
- tracdap/rt/_plugins/storage_sql.py +417 -0
- tracdap/rt/_plugins/storage_sql_dialects.py +117 -0
- tracdap/rt/_version.py +1 -1
- tracdap/rt/api/experimental.py +79 -32
- tracdap/rt/api/hook.py +10 -0
- tracdap/rt/metadata/__init__.py +4 -0
- tracdap/rt/metadata/job.py +45 -0
- {tracdap_runtime-0.6.5.dist-info → tracdap_runtime-0.6.6.dist-info}/METADATA +3 -1
- {tracdap_runtime-0.6.5.dist-info → tracdap_runtime-0.6.6.dist-info}/RECORD +30 -25
- {tracdap_runtime-0.6.5.dist-info → tracdap_runtime-0.6.6.dist-info}/WHEEL +1 -1
- {tracdap_runtime-0.6.5.dist-info → tracdap_runtime-0.6.6.dist-info}/LICENSE +0 -0
- {tracdap_runtime-0.6.5.dist-info → tracdap_runtime-0.6.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,116 @@
|
|
1
|
+
# Copyright 2024 Accenture Global Solutions Limited
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
import abc as _abc
|
16
|
+
import enum
|
17
|
+
import typing as _tp
|
18
|
+
import contextlib as _cm
|
19
|
+
|
20
|
+
import pyarrow as _pa
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
class ISqlDialect:
|
25
|
+
|
26
|
+
@_abc.abstractmethod
|
27
|
+
def arrow_to_sql_type(self, arrow_type: _pa.DataType) -> str:
|
28
|
+
pass
|
29
|
+
|
30
|
+
|
31
|
+
class ISqlDriver:
|
32
|
+
|
33
|
+
@_abc.abstractmethod
|
34
|
+
def param_style(self) -> "DbApiWrapper.ParamStyle":
|
35
|
+
pass
|
36
|
+
|
37
|
+
@_abc.abstractmethod
|
38
|
+
def connect(self, **kwargs) -> "DbApiWrapper.Connection":
|
39
|
+
pass
|
40
|
+
|
41
|
+
@_abc.abstractmethod
|
42
|
+
def has_table(self, table_name: str) -> bool:
|
43
|
+
pass
|
44
|
+
|
45
|
+
@_abc.abstractmethod
|
46
|
+
def list_tables(self) -> _tp.List[str]:
|
47
|
+
pass
|
48
|
+
|
49
|
+
@_abc.abstractmethod
|
50
|
+
def error_handling(self) -> _cm.contextmanager:
|
51
|
+
pass
|
52
|
+
|
53
|
+
@_abc.abstractmethod
|
54
|
+
def encode_sql_value(self, py_value: _tp.Any) -> _tp.Any:
|
55
|
+
pass
|
56
|
+
|
57
|
+
@_abc.abstractmethod
|
58
|
+
def decode_sql_value(self, sql_value: _tp.Any, python_type: _tp.Type) -> _tp.Any:
|
59
|
+
pass
|
60
|
+
|
61
|
+
|
62
|
+
class DbApiWrapper:
|
63
|
+
|
64
|
+
class ThreadSafety(enum.Enum):
|
65
|
+
NOT_THREAD_SAFE = 0
|
66
|
+
MODULE_SAFE = 1
|
67
|
+
CONNECTION_SAFE = 2
|
68
|
+
CURSOR_SAFE = 3
|
69
|
+
|
70
|
+
class ParamStyle(enum.Enum):
|
71
|
+
QMARK = "qmark"
|
72
|
+
NUMERIC = "numeric"
|
73
|
+
NAMED = "named"
|
74
|
+
FORMAT = "format"
|
75
|
+
PYFORMAT = "pyformat"
|
76
|
+
|
77
|
+
class Connection(_tp.Protocol):
|
78
|
+
|
79
|
+
def close(self):
|
80
|
+
pass
|
81
|
+
|
82
|
+
def commit(self):
|
83
|
+
pass
|
84
|
+
|
85
|
+
def rollback(self):
|
86
|
+
pass
|
87
|
+
|
88
|
+
def cursor(self) -> "DbApiWrapper.Cursor":
|
89
|
+
pass
|
90
|
+
|
91
|
+
class Cursor(_tp.Protocol):
|
92
|
+
|
93
|
+
arraysize: int = 1
|
94
|
+
|
95
|
+
@property
|
96
|
+
def description(self) -> tuple:
|
97
|
+
pass
|
98
|
+
|
99
|
+
@property
|
100
|
+
def rowcount(self) -> int:
|
101
|
+
pass
|
102
|
+
|
103
|
+
def execute(self, operation: str, parameters: _tp.Union[_tp.Dict, _tp.Sequence]):
|
104
|
+
pass
|
105
|
+
|
106
|
+
def executemany(self, operation: str, parameters: _tp.Iterable[_tp.Union[_tp.Dict, _tp.Sequence]]):
|
107
|
+
pass
|
108
|
+
|
109
|
+
def fetchone(self) -> _tp.Tuple:
|
110
|
+
pass
|
111
|
+
|
112
|
+
def fetchmany(self, size: int = arraysize) -> _tp.Sequence[_tp.Tuple]:
|
113
|
+
pass
|
114
|
+
|
115
|
+
def close(self):
|
116
|
+
pass
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Copyright 2024 Accenture Global Solutions Limited
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
import abc as _abc
|
16
|
+
import typing as _tp
|
17
|
+
|
18
|
+
from tracdap.rt.ext.storage import * # noqa
|
19
|
+
|
20
|
+
|
21
|
+
T_DATA = _tp.TypeVar("T_DATA")
|
22
|
+
T_SCHEMA = _tp.TypeVar("T_SCHEMA")
|
23
|
+
|
24
|
+
|
25
|
+
class IDataStorageBase(_tp.Generic[T_DATA, T_SCHEMA], _abc.ABC):
|
26
|
+
|
27
|
+
@_abc.abstractmethod
|
28
|
+
def data_type(self) -> _tp.Type[T_DATA]:
|
29
|
+
pass
|
30
|
+
|
31
|
+
@_abc.abstractmethod
|
32
|
+
def schema_type(self) -> _tp.Type[T_SCHEMA]:
|
33
|
+
pass
|
34
|
+
|
35
|
+
@_abc.abstractmethod
|
36
|
+
def has_table(self, table_name: str) -> bool:
|
37
|
+
pass
|
38
|
+
|
39
|
+
@_abc.abstractmethod
|
40
|
+
def list_tables(self) -> _tp.List[str]:
|
41
|
+
pass
|
42
|
+
|
43
|
+
@_abc.abstractmethod
|
44
|
+
def create_table(self, table_name: str, schema: T_SCHEMA):
|
45
|
+
pass
|
46
|
+
|
47
|
+
@_abc.abstractmethod
|
48
|
+
def read_table(self, table_name: str) -> T_DATA:
|
49
|
+
pass
|
50
|
+
|
51
|
+
@_abc.abstractmethod
|
52
|
+
def write_table(self, table_name: str, records: T_DATA):
|
53
|
+
pass
|
54
|
+
|
55
|
+
@_abc.abstractmethod
|
56
|
+
def native_read_query(self, query: str, **parameters) -> T_DATA:
|
57
|
+
pass
|
@@ -17,7 +17,7 @@ from tracdap.rt._impl.grpc.tracdap.metadata import object_id_pb2 as tracdap_dot_
|
|
17
17
|
from tracdap.rt._impl.grpc.tracdap.metadata import tag_update_pb2 as tracdap_dot_rt_dot___impl_dot_grpc_dot_tracdap_dot_metadata_dot_tag__update__pb2
|
18
18
|
|
19
19
|
|
20
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n0tracdap/rt/_impl/grpc/tracdap/metadata/job.proto\x12\x10tracdap.metadata\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/type.proto\x1a\x36tracdap/rt/_impl/grpc/tracdap/metadata/object_id.proto\x1a\x37tracdap/rt/_impl/grpc/tracdap/metadata/tag_update.proto\"\
|
20
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n0tracdap/rt/_impl/grpc/tracdap/metadata/job.proto\x12\x10tracdap.metadata\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/type.proto\x1a\x36tracdap/rt/_impl/grpc/tracdap/metadata/object_id.proto\x1a\x37tracdap/rt/_impl/grpc/tracdap/metadata/tag_update.proto\"\x84\x03\n\rJobDefinition\x12*\n\x07jobType\x18\x01 \x01(\x0e\x32\x19.tracdap.metadata.JobType\x12\x31\n\x08runModel\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.RunModelJobH\x00\x12/\n\x07runFlow\x18\x03 \x01(\x0b\x32\x1c.tracdap.metadata.RunFlowJobH\x00\x12\x37\n\x0bimportModel\x18\x04 \x01(\x0b\x32 .tracdap.metadata.ImportModelJobH\x00\x12\x35\n\nimportData\x18\x05 \x01(\x0b\x32\x1f.tracdap.metadata.ImportDataJobH\x00\x12\x35\n\nexportData\x18\x06 \x01(\x0b\x32\x1f.tracdap.metadata.ExportDataJobH\x00\x12.\n\x08jobGroup\x18\x07 \x01(\x0b\x32\x1a.tracdap.metadata.JobGroupH\x00\x42\x0c\n\njobDetails\"\xac\x05\n\x0bRunModelJob\x12,\n\x05model\x18\x01 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector\x12\x41\n\nparameters\x18\x02 \x03(\x0b\x32-.tracdap.metadata.RunModelJob.ParametersEntry\x12\x39\n\x06inputs\x18\x03 \x03(\x0b\x32).tracdap.metadata.RunModelJob.InputsEntry\x12;\n\x07outputs\x18\x04 \x03(\x0b\x32*.tracdap.metadata.RunModelJob.OutputsEntry\x12\x45\n\x0cpriorOutputs\x18\x05 \x03(\x0b\x32/.tracdap.metadata.RunModelJob.PriorOutputsEntry\x12\x30\n\x0boutputAttrs\x18\x06 \x03(\x0b\x32\x1b.tracdap.metadata.TagUpdate\x1aJ\n\x0fParametersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.tracdap.metadata.Value:\x02\x38\x01\x1aL\n\x0bInputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aM\n\x0cOutputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aR\n\x11PriorOutputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\"\xae\x06\n\nRunFlowJob\x12+\n\x04\x66low\x18\x01 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector\x12@\n\nparameters\x18\x02 \x03(\x0b\x32,.tracdap.metadata.RunFlowJob.ParametersEntry\x12\x38\n\x06inputs\x18\x03 \x03(\x0b\x32(.tracdap.metadata.RunFlowJob.InputsEntry\x12:\n\x07outputs\x18\x04 \x03(\x0b\x32).tracdap.metadata.RunFlowJob.OutputsEntry\x12\x44\n\x0cpriorOutputs\x18\x05 \x03(\x0b\x32..tracdap.metadata.RunFlowJob.PriorOutputsEntry\x12\x38\n\x06models\x18\x06 \x03(\x0b\x32(.tracdap.metadata.RunFlowJob.ModelsEntry\x12\x30\n\x0boutputAttrs\x18\x07 \x03(\x0b\x32\x1b.tracdap.metadata.TagUpdate\x1aJ\n\x0fParametersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.tracdap.metadata.Value:\x02\x38\x01\x1aL\n\x0bInputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aM\n\x0cOutputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aR\n\x11PriorOutputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aL\n\x0bModelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\"\xd7\x01\n\x0eImportModelJob\x12\x10\n\x08language\x18\x01 \x01(\t\x12\x12\n\nrepository\x18\x02 \x01(\t\x12\x19\n\x0cpackageGroup\x18\x07 \x01(\tH\x00\x88\x01\x01\x12\x0f\n\x07package\x18\x08 \x01(\t\x12\x0f\n\x07version\x18\x05 \x01(\t\x12\x12\n\nentryPoint\x18\x04 \x01(\t\x12\x0c\n\x04path\x18\x03 \x01(\t\x12/\n\nmodelAttrs\x18\x06 \x03(\x0b\x32\x1b.tracdap.metadata.TagUpdateB\x0f\n\r_packageGroup\"\x8d\x07\n\rImportDataJob\x12,\n\x05model\x18\x01 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector\x12\x43\n\nparameters\x18\x02 \x03(\x0b\x32/.tracdap.metadata.ImportDataJob.ParametersEntry\x12;\n\x06inputs\x18\x03 \x03(\x0b\x32+.tracdap.metadata.ImportDataJob.InputsEntry\x12=\n\x07outputs\x18\x04 \x03(\x0b\x32,.tracdap.metadata.ImportDataJob.OutputsEntry\x12G\n\x0cpriorOutputs\x18\x05 \x03(\x0b\x32\x31.tracdap.metadata.ImportDataJob.PriorOutputsEntry\x12\x15\n\rstorageAccess\x18\x06 \x03(\t\x12=\n\x07imports\x18\x07 \x03(\x0b\x32,.tracdap.metadata.ImportDataJob.ImportsEntry\x12\x30\n\x0boutputAttrs\x18\x08 \x03(\x0b\x32\x1b.tracdap.metadata.TagUpdate\x12\x30\n\x0bimportAttrs\x18\t \x03(\x0b\x32\x1b.tracdap.metadata.TagUpdate\x1aJ\n\x0fParametersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.tracdap.metadata.Value:\x02\x38\x01\x1aL\n\x0bInputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aM\n\x0cOutputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aR\n\x11PriorOutputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aM\n\x0cImportsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\"\xdb\x06\n\rExportDataJob\x12,\n\x05model\x18\x01 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector\x12\x43\n\nparameters\x18\x02 \x03(\x0b\x32/.tracdap.metadata.ExportDataJob.ParametersEntry\x12;\n\x06inputs\x18\x03 \x03(\x0b\x32+.tracdap.metadata.ExportDataJob.InputsEntry\x12=\n\x07outputs\x18\x04 \x03(\x0b\x32,.tracdap.metadata.ExportDataJob.OutputsEntry\x12G\n\x0cpriorOutputs\x18\x05 \x03(\x0b\x32\x31.tracdap.metadata.ExportDataJob.PriorOutputsEntry\x12\x15\n\rstorageAccess\x18\x06 \x03(\t\x12=\n\x07\x65xports\x18\x07 \x03(\x0b\x32,.tracdap.metadata.ExportDataJob.ExportsEntry\x12\x30\n\x0boutputAttrs\x18\x08 \x03(\x0b\x32\x1b.tracdap.metadata.TagUpdate\x1aJ\n\x0fParametersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.tracdap.metadata.Value:\x02\x38\x01\x1aL\n\x0bInputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aM\n\x0cOutputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aR\n\x11PriorOutputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\x1aM\n\x0c\x45xportsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector:\x02\x38\x01\"\xc7\x01\n\x08JobGroup\x12\x34\n\x0cjobGroupType\x18\x01 \x01(\x0e\x32\x1e.tracdap.metadata.JobGroupType\x12:\n\nsequential\x18\x02 \x01(\x0b\x32$.tracdap.metadata.SequentialJobGroupH\x00\x12\x36\n\x08parallel\x18\x03 \x01(\x0b\x32\".tracdap.metadata.ParallelJobGroupH\x00\x42\x11\n\x0fjobGroupDetails\"C\n\x12SequentialJobGroup\x12-\n\x04jobs\x18\x01 \x03(\x0b\x32\x1f.tracdap.metadata.JobDefinition\"A\n\x10ParallelJobGroup\x12-\n\x04jobs\x18\x01 \x03(\x0b\x32\x1f.tracdap.metadata.JobDefinition*\x7f\n\x07JobType\x12\x14\n\x10JOB_TYPE_NOT_SET\x10\x00\x12\r\n\tRUN_MODEL\x10\x01\x12\x0c\n\x08RUN_FLOW\x10\x02\x12\x10\n\x0cIMPORT_MODEL\x10\x03\x12\x0f\n\x0bIMPORT_DATA\x10\x04\x12\x0f\n\x0b\x45XPORT_DATA\x10\x05\x12\r\n\tJOB_GROUP\x10\x06*\xb8\x01\n\rJobStatusCode\x12\x1b\n\x17JOB_STATUS_CODE_NOT_SET\x10\x00\x12\r\n\tPREPARING\x10\x01\x12\r\n\tVALIDATED\x10\x02\x12\x0b\n\x07PENDING\x10\x03\x12\n\n\x06QUEUED\x10\x04\x12\r\n\tSUBMITTED\x10\x05\x12\x0b\n\x07RUNNING\x10\x06\x12\r\n\tFINISHING\x10\x07\x12\r\n\tSUCCEEDED\x10\x08\x12\n\n\x06\x46\x41ILED\x10\t\x12\r\n\tCANCELLED\x10\n*\\\n\x0cJobGroupType\x12\x1a\n\x16JOB_GROUP_TYPE_NOT_SET\x10\x00\x12\x18\n\x14SEQUENTIAL_JOB_GROUP\x10\x01\x12\x16\n\x12PARALLEL_JOB_GROUP\x10\x02\x42\x1e\n\x1aorg.finos.tracdap.metadataP\x01\x62\x06proto3')
|
21
21
|
|
22
22
|
_globals = globals()
|
23
23
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -63,58 +63,66 @@ if _descriptor._USE_C_DESCRIPTORS == False:
|
|
63
63
|
_globals['_EXPORTDATAJOB_PRIOROUTPUTSENTRY']._serialized_options = b'8\001'
|
64
64
|
_globals['_EXPORTDATAJOB_EXPORTSENTRY']._options = None
|
65
65
|
_globals['_EXPORTDATAJOB_EXPORTSENTRY']._serialized_options = b'8\001'
|
66
|
-
_globals['_JOBTYPE']._serialized_start=
|
67
|
-
_globals['_JOBTYPE']._serialized_end=
|
68
|
-
_globals['_JOBSTATUSCODE']._serialized_start=
|
69
|
-
_globals['_JOBSTATUSCODE']._serialized_end=
|
66
|
+
_globals['_JOBTYPE']._serialized_start=4459
|
67
|
+
_globals['_JOBTYPE']._serialized_end=4586
|
68
|
+
_globals['_JOBSTATUSCODE']._serialized_start=4589
|
69
|
+
_globals['_JOBSTATUSCODE']._serialized_end=4773
|
70
|
+
_globals['_JOBGROUPTYPE']._serialized_start=4775
|
71
|
+
_globals['_JOBGROUPTYPE']._serialized_end=4867
|
70
72
|
_globals['_JOBDEFINITION']._serialized_start=235
|
71
|
-
_globals['_JOBDEFINITION']._serialized_end=
|
72
|
-
_globals['_RUNMODELJOB']._serialized_start=
|
73
|
-
_globals['_RUNMODELJOB']._serialized_end=
|
74
|
-
_globals['_RUNMODELJOB_PARAMETERSENTRY']._serialized_start=
|
75
|
-
_globals['_RUNMODELJOB_PARAMETERSENTRY']._serialized_end=
|
76
|
-
_globals['_RUNMODELJOB_INPUTSENTRY']._serialized_start=
|
77
|
-
_globals['_RUNMODELJOB_INPUTSENTRY']._serialized_end=
|
78
|
-
_globals['_RUNMODELJOB_OUTPUTSENTRY']._serialized_start=
|
79
|
-
_globals['_RUNMODELJOB_OUTPUTSENTRY']._serialized_end=
|
80
|
-
_globals['_RUNMODELJOB_PRIOROUTPUTSENTRY']._serialized_start=
|
81
|
-
_globals['_RUNMODELJOB_PRIOROUTPUTSENTRY']._serialized_end=
|
82
|
-
_globals['_RUNFLOWJOB']._serialized_start=
|
83
|
-
_globals['_RUNFLOWJOB']._serialized_end=
|
84
|
-
_globals['_RUNFLOWJOB_PARAMETERSENTRY']._serialized_start=
|
85
|
-
_globals['_RUNFLOWJOB_PARAMETERSENTRY']._serialized_end=
|
86
|
-
_globals['_RUNFLOWJOB_INPUTSENTRY']._serialized_start=
|
87
|
-
_globals['_RUNFLOWJOB_INPUTSENTRY']._serialized_end=
|
88
|
-
_globals['_RUNFLOWJOB_OUTPUTSENTRY']._serialized_start=
|
89
|
-
_globals['_RUNFLOWJOB_OUTPUTSENTRY']._serialized_end=
|
90
|
-
_globals['_RUNFLOWJOB_PRIOROUTPUTSENTRY']._serialized_start=
|
91
|
-
_globals['_RUNFLOWJOB_PRIOROUTPUTSENTRY']._serialized_end=
|
92
|
-
_globals['_RUNFLOWJOB_MODELSENTRY']._serialized_start=
|
93
|
-
_globals['_RUNFLOWJOB_MODELSENTRY']._serialized_end=
|
94
|
-
_globals['_IMPORTMODELJOB']._serialized_start=
|
95
|
-
_globals['_IMPORTMODELJOB']._serialized_end=
|
96
|
-
_globals['_IMPORTDATAJOB']._serialized_start=
|
97
|
-
_globals['_IMPORTDATAJOB']._serialized_end=
|
98
|
-
_globals['_IMPORTDATAJOB_PARAMETERSENTRY']._serialized_start=
|
99
|
-
_globals['_IMPORTDATAJOB_PARAMETERSENTRY']._serialized_end=
|
100
|
-
_globals['_IMPORTDATAJOB_INPUTSENTRY']._serialized_start=
|
101
|
-
_globals['_IMPORTDATAJOB_INPUTSENTRY']._serialized_end=
|
102
|
-
_globals['_IMPORTDATAJOB_OUTPUTSENTRY']._serialized_start=
|
103
|
-
_globals['_IMPORTDATAJOB_OUTPUTSENTRY']._serialized_end=
|
104
|
-
_globals['_IMPORTDATAJOB_PRIOROUTPUTSENTRY']._serialized_start=
|
105
|
-
_globals['_IMPORTDATAJOB_PRIOROUTPUTSENTRY']._serialized_end=
|
106
|
-
_globals['_IMPORTDATAJOB_IMPORTSENTRY']._serialized_start=
|
107
|
-
_globals['_IMPORTDATAJOB_IMPORTSENTRY']._serialized_end=
|
108
|
-
_globals['_EXPORTDATAJOB']._serialized_start=
|
109
|
-
_globals['_EXPORTDATAJOB']._serialized_end=
|
110
|
-
_globals['_EXPORTDATAJOB_PARAMETERSENTRY']._serialized_start=
|
111
|
-
_globals['_EXPORTDATAJOB_PARAMETERSENTRY']._serialized_end=
|
112
|
-
_globals['_EXPORTDATAJOB_INPUTSENTRY']._serialized_start=
|
113
|
-
_globals['_EXPORTDATAJOB_INPUTSENTRY']._serialized_end=
|
114
|
-
_globals['_EXPORTDATAJOB_OUTPUTSENTRY']._serialized_start=
|
115
|
-
_globals['_EXPORTDATAJOB_OUTPUTSENTRY']._serialized_end=
|
116
|
-
_globals['_EXPORTDATAJOB_PRIOROUTPUTSENTRY']._serialized_start=
|
117
|
-
_globals['_EXPORTDATAJOB_PRIOROUTPUTSENTRY']._serialized_end=
|
118
|
-
_globals['_EXPORTDATAJOB_EXPORTSENTRY']._serialized_start=
|
119
|
-
_globals['_EXPORTDATAJOB_EXPORTSENTRY']._serialized_end=
|
73
|
+
_globals['_JOBDEFINITION']._serialized_end=623
|
74
|
+
_globals['_RUNMODELJOB']._serialized_start=626
|
75
|
+
_globals['_RUNMODELJOB']._serialized_end=1310
|
76
|
+
_globals['_RUNMODELJOB_PARAMETERSENTRY']._serialized_start=995
|
77
|
+
_globals['_RUNMODELJOB_PARAMETERSENTRY']._serialized_end=1069
|
78
|
+
_globals['_RUNMODELJOB_INPUTSENTRY']._serialized_start=1071
|
79
|
+
_globals['_RUNMODELJOB_INPUTSENTRY']._serialized_end=1147
|
80
|
+
_globals['_RUNMODELJOB_OUTPUTSENTRY']._serialized_start=1149
|
81
|
+
_globals['_RUNMODELJOB_OUTPUTSENTRY']._serialized_end=1226
|
82
|
+
_globals['_RUNMODELJOB_PRIOROUTPUTSENTRY']._serialized_start=1228
|
83
|
+
_globals['_RUNMODELJOB_PRIOROUTPUTSENTRY']._serialized_end=1310
|
84
|
+
_globals['_RUNFLOWJOB']._serialized_start=1313
|
85
|
+
_globals['_RUNFLOWJOB']._serialized_end=2127
|
86
|
+
_globals['_RUNFLOWJOB_PARAMETERSENTRY']._serialized_start=995
|
87
|
+
_globals['_RUNFLOWJOB_PARAMETERSENTRY']._serialized_end=1069
|
88
|
+
_globals['_RUNFLOWJOB_INPUTSENTRY']._serialized_start=1071
|
89
|
+
_globals['_RUNFLOWJOB_INPUTSENTRY']._serialized_end=1147
|
90
|
+
_globals['_RUNFLOWJOB_OUTPUTSENTRY']._serialized_start=1149
|
91
|
+
_globals['_RUNFLOWJOB_OUTPUTSENTRY']._serialized_end=1226
|
92
|
+
_globals['_RUNFLOWJOB_PRIOROUTPUTSENTRY']._serialized_start=1228
|
93
|
+
_globals['_RUNFLOWJOB_PRIOROUTPUTSENTRY']._serialized_end=1310
|
94
|
+
_globals['_RUNFLOWJOB_MODELSENTRY']._serialized_start=2051
|
95
|
+
_globals['_RUNFLOWJOB_MODELSENTRY']._serialized_end=2127
|
96
|
+
_globals['_IMPORTMODELJOB']._serialized_start=2130
|
97
|
+
_globals['_IMPORTMODELJOB']._serialized_end=2345
|
98
|
+
_globals['_IMPORTDATAJOB']._serialized_start=2348
|
99
|
+
_globals['_IMPORTDATAJOB']._serialized_end=3257
|
100
|
+
_globals['_IMPORTDATAJOB_PARAMETERSENTRY']._serialized_start=995
|
101
|
+
_globals['_IMPORTDATAJOB_PARAMETERSENTRY']._serialized_end=1069
|
102
|
+
_globals['_IMPORTDATAJOB_INPUTSENTRY']._serialized_start=1071
|
103
|
+
_globals['_IMPORTDATAJOB_INPUTSENTRY']._serialized_end=1147
|
104
|
+
_globals['_IMPORTDATAJOB_OUTPUTSENTRY']._serialized_start=1149
|
105
|
+
_globals['_IMPORTDATAJOB_OUTPUTSENTRY']._serialized_end=1226
|
106
|
+
_globals['_IMPORTDATAJOB_PRIOROUTPUTSENTRY']._serialized_start=1228
|
107
|
+
_globals['_IMPORTDATAJOB_PRIOROUTPUTSENTRY']._serialized_end=1310
|
108
|
+
_globals['_IMPORTDATAJOB_IMPORTSENTRY']._serialized_start=3180
|
109
|
+
_globals['_IMPORTDATAJOB_IMPORTSENTRY']._serialized_end=3257
|
110
|
+
_globals['_EXPORTDATAJOB']._serialized_start=3260
|
111
|
+
_globals['_EXPORTDATAJOB']._serialized_end=4119
|
112
|
+
_globals['_EXPORTDATAJOB_PARAMETERSENTRY']._serialized_start=995
|
113
|
+
_globals['_EXPORTDATAJOB_PARAMETERSENTRY']._serialized_end=1069
|
114
|
+
_globals['_EXPORTDATAJOB_INPUTSENTRY']._serialized_start=1071
|
115
|
+
_globals['_EXPORTDATAJOB_INPUTSENTRY']._serialized_end=1147
|
116
|
+
_globals['_EXPORTDATAJOB_OUTPUTSENTRY']._serialized_start=1149
|
117
|
+
_globals['_EXPORTDATAJOB_OUTPUTSENTRY']._serialized_end=1226
|
118
|
+
_globals['_EXPORTDATAJOB_PRIOROUTPUTSENTRY']._serialized_start=1228
|
119
|
+
_globals['_EXPORTDATAJOB_PRIOROUTPUTSENTRY']._serialized_end=1310
|
120
|
+
_globals['_EXPORTDATAJOB_EXPORTSENTRY']._serialized_start=4042
|
121
|
+
_globals['_EXPORTDATAJOB_EXPORTSENTRY']._serialized_end=4119
|
122
|
+
_globals['_JOBGROUP']._serialized_start=4122
|
123
|
+
_globals['_JOBGROUP']._serialized_end=4321
|
124
|
+
_globals['_SEQUENTIALJOBGROUP']._serialized_start=4323
|
125
|
+
_globals['_SEQUENTIALJOBGROUP']._serialized_end=4390
|
126
|
+
_globals['_PARALLELJOBGROUP']._serialized_start=4392
|
127
|
+
_globals['_PARALLELJOBGROUP']._serialized_end=4457
|
120
128
|
# @@protoc_insertion_point(module_scope)
|
@@ -17,6 +17,7 @@ class JobType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
17
17
|
IMPORT_MODEL: _ClassVar[JobType]
|
18
18
|
IMPORT_DATA: _ClassVar[JobType]
|
19
19
|
EXPORT_DATA: _ClassVar[JobType]
|
20
|
+
JOB_GROUP: _ClassVar[JobType]
|
20
21
|
|
21
22
|
class JobStatusCode(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
22
23
|
__slots__ = ()
|
@@ -31,12 +32,19 @@ class JobStatusCode(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
31
32
|
SUCCEEDED: _ClassVar[JobStatusCode]
|
32
33
|
FAILED: _ClassVar[JobStatusCode]
|
33
34
|
CANCELLED: _ClassVar[JobStatusCode]
|
35
|
+
|
36
|
+
class JobGroupType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
37
|
+
__slots__ = ()
|
38
|
+
JOB_GROUP_TYPE_NOT_SET: _ClassVar[JobGroupType]
|
39
|
+
SEQUENTIAL_JOB_GROUP: _ClassVar[JobGroupType]
|
40
|
+
PARALLEL_JOB_GROUP: _ClassVar[JobGroupType]
|
34
41
|
JOB_TYPE_NOT_SET: JobType
|
35
42
|
RUN_MODEL: JobType
|
36
43
|
RUN_FLOW: JobType
|
37
44
|
IMPORT_MODEL: JobType
|
38
45
|
IMPORT_DATA: JobType
|
39
46
|
EXPORT_DATA: JobType
|
47
|
+
JOB_GROUP: JobType
|
40
48
|
JOB_STATUS_CODE_NOT_SET: JobStatusCode
|
41
49
|
PREPARING: JobStatusCode
|
42
50
|
VALIDATED: JobStatusCode
|
@@ -48,22 +56,27 @@ FINISHING: JobStatusCode
|
|
48
56
|
SUCCEEDED: JobStatusCode
|
49
57
|
FAILED: JobStatusCode
|
50
58
|
CANCELLED: JobStatusCode
|
59
|
+
JOB_GROUP_TYPE_NOT_SET: JobGroupType
|
60
|
+
SEQUENTIAL_JOB_GROUP: JobGroupType
|
61
|
+
PARALLEL_JOB_GROUP: JobGroupType
|
51
62
|
|
52
63
|
class JobDefinition(_message.Message):
|
53
|
-
__slots__ = ("jobType", "runModel", "runFlow", "importModel", "importData", "exportData")
|
64
|
+
__slots__ = ("jobType", "runModel", "runFlow", "importModel", "importData", "exportData", "jobGroup")
|
54
65
|
JOBTYPE_FIELD_NUMBER: _ClassVar[int]
|
55
66
|
RUNMODEL_FIELD_NUMBER: _ClassVar[int]
|
56
67
|
RUNFLOW_FIELD_NUMBER: _ClassVar[int]
|
57
68
|
IMPORTMODEL_FIELD_NUMBER: _ClassVar[int]
|
58
69
|
IMPORTDATA_FIELD_NUMBER: _ClassVar[int]
|
59
70
|
EXPORTDATA_FIELD_NUMBER: _ClassVar[int]
|
71
|
+
JOBGROUP_FIELD_NUMBER: _ClassVar[int]
|
60
72
|
jobType: JobType
|
61
73
|
runModel: RunModelJob
|
62
74
|
runFlow: RunFlowJob
|
63
75
|
importModel: ImportModelJob
|
64
76
|
importData: ImportDataJob
|
65
77
|
exportData: ExportDataJob
|
66
|
-
|
78
|
+
jobGroup: JobGroup
|
79
|
+
def __init__(self, jobType: _Optional[_Union[JobType, str]] = ..., runModel: _Optional[_Union[RunModelJob, _Mapping]] = ..., runFlow: _Optional[_Union[RunFlowJob, _Mapping]] = ..., importModel: _Optional[_Union[ImportModelJob, _Mapping]] = ..., importData: _Optional[_Union[ImportDataJob, _Mapping]] = ..., exportData: _Optional[_Union[ExportDataJob, _Mapping]] = ..., jobGroup: _Optional[_Union[JobGroup, _Mapping]] = ...) -> None: ...
|
67
80
|
|
68
81
|
class RunModelJob(_message.Message):
|
69
82
|
__slots__ = ("model", "parameters", "inputs", "outputs", "priorOutputs", "outputAttrs")
|
@@ -293,3 +306,25 @@ class ExportDataJob(_message.Message):
|
|
293
306
|
exports: _containers.MessageMap[str, _object_id_pb2.TagSelector]
|
294
307
|
outputAttrs: _containers.RepeatedCompositeFieldContainer[_tag_update_pb2.TagUpdate]
|
295
308
|
def __init__(self, model: _Optional[_Union[_object_id_pb2.TagSelector, _Mapping]] = ..., parameters: _Optional[_Mapping[str, _type_pb2.Value]] = ..., inputs: _Optional[_Mapping[str, _object_id_pb2.TagSelector]] = ..., outputs: _Optional[_Mapping[str, _object_id_pb2.TagSelector]] = ..., priorOutputs: _Optional[_Mapping[str, _object_id_pb2.TagSelector]] = ..., storageAccess: _Optional[_Iterable[str]] = ..., exports: _Optional[_Mapping[str, _object_id_pb2.TagSelector]] = ..., outputAttrs: _Optional[_Iterable[_Union[_tag_update_pb2.TagUpdate, _Mapping]]] = ...) -> None: ...
|
309
|
+
|
310
|
+
class JobGroup(_message.Message):
|
311
|
+
__slots__ = ("jobGroupType", "sequential", "parallel")
|
312
|
+
JOBGROUPTYPE_FIELD_NUMBER: _ClassVar[int]
|
313
|
+
SEQUENTIAL_FIELD_NUMBER: _ClassVar[int]
|
314
|
+
PARALLEL_FIELD_NUMBER: _ClassVar[int]
|
315
|
+
jobGroupType: JobGroupType
|
316
|
+
sequential: SequentialJobGroup
|
317
|
+
parallel: ParallelJobGroup
|
318
|
+
def __init__(self, jobGroupType: _Optional[_Union[JobGroupType, str]] = ..., sequential: _Optional[_Union[SequentialJobGroup, _Mapping]] = ..., parallel: _Optional[_Union[ParallelJobGroup, _Mapping]] = ...) -> None: ...
|
319
|
+
|
320
|
+
class SequentialJobGroup(_message.Message):
|
321
|
+
__slots__ = ("jobs",)
|
322
|
+
JOBS_FIELD_NUMBER: _ClassVar[int]
|
323
|
+
jobs: _containers.RepeatedCompositeFieldContainer[JobDefinition]
|
324
|
+
def __init__(self, jobs: _Optional[_Iterable[_Union[JobDefinition, _Mapping]]] = ...) -> None: ...
|
325
|
+
|
326
|
+
class ParallelJobGroup(_message.Message):
|
327
|
+
__slots__ = ("jobs",)
|
328
|
+
JOBS_FIELD_NUMBER: _ClassVar[int]
|
329
|
+
jobs: _containers.RepeatedCompositeFieldContainer[JobDefinition]
|
330
|
+
def __init__(self, jobs: _Optional[_Iterable[_Union[JobDefinition, _Mapping]]] = ...) -> None: ...
|
tracdap/rt/_impl/static_api.py
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
import typing as _tp
|
16
16
|
import types as _ts
|
17
17
|
|
18
|
+
import tracdap.rt.api.experimental as _api
|
18
19
|
import tracdap.rt.metadata as _meta
|
19
20
|
import tracdap.rt.exceptions as _ex
|
20
21
|
import tracdap.rt._impl.data as _data
|
@@ -37,6 +38,24 @@ class StaticApiImpl(_StaticApiHook):
|
|
37
38
|
if not _StaticApiHook._is_registered():
|
38
39
|
_StaticApiHook._register(StaticApiImpl())
|
39
40
|
|
41
|
+
def array_type(self, item_type: _meta.BasicType) -> _meta.TypeDescriptor:
|
42
|
+
|
43
|
+
_val.validate_signature(self.array_type, item_type)
|
44
|
+
|
45
|
+
if not _val.is_primitive_type(item_type):
|
46
|
+
raise _ex.EModelValidation(f"Arrays can only contain primitive types, [{item_type}] is not primitive")
|
47
|
+
|
48
|
+
return _meta.TypeDescriptor(_meta.BasicType.ARRAY, arrayType=_meta.TypeDescriptor(item_type))
|
49
|
+
|
50
|
+
def map_type(self, entry_type: _meta.BasicType) -> _meta.TypeDescriptor:
|
51
|
+
|
52
|
+
_val.validate_signature(self.map_type, entry_type)
|
53
|
+
|
54
|
+
if not _val.is_primitive_type(entry_type):
|
55
|
+
raise _ex.EModelValidation(f"Maps can only contain primitive types, [{entry_type}] is not primitive")
|
56
|
+
|
57
|
+
return _meta.TypeDescriptor(_meta.BasicType.MAP, arrayType=_meta.TypeDescriptor(entry_type))
|
58
|
+
|
40
59
|
def define_attribute(
|
41
60
|
self, attr_name: str, attr_value: _tp.Any,
|
42
61
|
attr_type: _tp.Optional[_meta.BasicType] = None,
|
@@ -153,20 +172,14 @@ class StaticApiImpl(_StaticApiHook):
|
|
153
172
|
|
154
173
|
return _schemas.SchemaLoader.load_schema(package, schema_file)
|
155
174
|
|
156
|
-
def infer_schema(self, dataset:
|
175
|
+
def infer_schema(self, dataset: _api.DATA_API) -> _meta.SchemaDefinition:
|
157
176
|
|
158
|
-
|
159
|
-
arrow_schema = _data.DataMapping.pandas_to_arrow_schema(dataset)
|
177
|
+
_val.validate_signature(self.infer_schema, dataset)
|
160
178
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
else:
|
165
|
-
dataset_type = f"{type(dataset).__module__}.{type(dataset).__name__}"
|
166
|
-
message = f"Schema inference is not available for dataset type [{dataset_type}]"
|
167
|
-
raise _ex.ERuntimeValidation(message)
|
179
|
+
framework = _data.DataConverter.get_framework(dataset)
|
180
|
+
converter = _data.DataConverter.for_framework(framework)
|
168
181
|
|
169
|
-
return
|
182
|
+
return converter.infer_schema(dataset)
|
170
183
|
|
171
184
|
def define_input_table(
|
172
185
|
self, *fields: _tp.Union[_meta.FieldSchema, _tp.List[_meta.FieldSchema]],
|
tracdap/rt/_impl/storage.py
CHANGED
@@ -32,8 +32,8 @@ import tracdap.rt._impl.data as _data
|
|
32
32
|
import tracdap.rt._impl.util as _util
|
33
33
|
import tracdap.rt._impl.validation as _val
|
34
34
|
|
35
|
-
# Import storage interfaces
|
36
|
-
from tracdap.rt.ext.storage import *
|
35
|
+
# Import storage interfaces (using the internal version, it has extra bits that are not public)
|
36
|
+
from tracdap.rt._impl.ext.storage import *
|
37
37
|
|
38
38
|
|
39
39
|
class FormatManager:
|
tracdap/rt/_impl/util.py
CHANGED
@@ -262,6 +262,16 @@ def get_args(metaclass: type):
|
|
262
262
|
return None
|
263
263
|
|
264
264
|
|
265
|
+
def get_constraints(metaclass: tp.TypeVar):
|
266
|
+
|
267
|
+
return metaclass.__constraints__ or None
|
268
|
+
|
269
|
+
|
270
|
+
def get_bound(metaclass: tp.TypeVar):
|
271
|
+
|
272
|
+
return metaclass.__bound__ or None
|
273
|
+
|
274
|
+
|
265
275
|
def try_clean_dir(dir_path: pathlib.Path, remove: bool = False) -> bool:
|
266
276
|
|
267
277
|
normalized_path = windows_unc_path(dir_path)
|