tracdap-runtime 0.7.0rc1__tar.gz → 0.8.0b2__tar.gz
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_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/PKG-INFO +3 -3
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/setup.cfg +2 -2
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/actors.py +5 -4
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/context.py +166 -74
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/dev_mode.py +147 -71
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/engine.py +224 -99
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/functions.py +122 -80
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/graph.py +23 -35
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/graph_builder.py +250 -113
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/runtime.py +24 -10
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/server.py +4 -3
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/config_parser.py +3 -2
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/data.py +89 -16
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.py +3 -1
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.pyi +8 -0
- tracdap_runtime-0.8.0b2/src/tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.py +130 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.pyi +16 -2
- tracdap_runtime-0.8.0b2/src/tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.py +67 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.pyi +14 -4
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/object_id_pb2.py +3 -3
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/object_id_pb2.pyi +2 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.py +4 -4
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.pyi +4 -2
- tracdap_runtime-0.8.0b2/src/tracdap/rt/_impl/logging.py +195 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/models.py +11 -8
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/repos.py +5 -3
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/schemas.py +2 -2
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/shim.py +3 -2
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/static_api.py +53 -33
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/storage.py +4 -3
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/util.py +1 -111
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/validation.py +57 -30
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_version.py +1 -1
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/api/__init__.py +6 -3
- tracdap_runtime-0.8.0b2/src/tracdap/rt/api/file_types.py +29 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/api/hook.py +15 -7
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/api/model_api.py +16 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/api/static_api.py +211 -125
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/config/common.py +11 -1
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/config/platform.py +4 -6
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/ext/plugins.py +2 -2
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/launch/launch.py +9 -11
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/__init__.py +11 -9
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/file.py +8 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/job.py +16 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/model.py +12 -2
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/object.py +2 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/object_id.py +2 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/tracdap_runtime.egg-info/PKG-INFO +3 -3
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/tracdap_runtime.egg-info/SOURCES.txt +2 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/tracdap_runtime.egg-info/requires.txt +1 -1
- tracdap_runtime-0.7.0rc1/src/tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.py +0 -128
- tracdap_runtime-0.7.0rc1/src/tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.py +0 -65
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/LICENSE +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/README.md +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/pyproject.toml +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/__init__.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_exec/__init__.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/__init__.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/ext/__init__.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/ext/sql.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/ext/storage.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/__init__.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/codec.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2_grpc.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/common_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/common_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/custom_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/custom_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/flow_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/flow_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/resource_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/resource_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/search_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/search_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/stoarge_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/stoarge_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/tag_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/tag_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/tag_update_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/tag_update_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/type_pb2.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/grpc/tracdap/metadata/type_pb2.pyi +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/guard_rails.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_impl/type_system.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/__init__.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/_helpers.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/config_local.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/format_arrow.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/format_csv.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/format_parquet.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/repo_git.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/repo_local.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/repo_pypi.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/storage_aws.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/storage_azure.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/storage_gcp.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/storage_local.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/storage_sql.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/_plugins/storage_sql_dialects.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/api/experimental.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/config/__init__.py +6 -6
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/config/job.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/config/result.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/config/runtime.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/exceptions.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/ext/__init__.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/ext/config.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/ext/embed.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/ext/repos.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/ext/storage.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/launch/__init__.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/launch/__main__.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/launch/cli.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/common.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/custom.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/data.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/flow.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/resource.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/search.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/stoarge.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/tag.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/tag_update.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/src/tracdap/rt/metadata/type.py +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/tracdap_runtime.egg-info/dependency_links.txt +0 -0
- {tracdap_runtime-0.7.0rc1 → tracdap_runtime-0.8.0b2}/tracdap_runtime.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tracdap-runtime
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.8.0b2
|
4
4
|
Summary: Runtime package for building models on the TRAC Data & Analytics Platform
|
5
5
|
Home-page: https://tracdap.finos.org/
|
6
6
|
Author: Martin Traverse
|
@@ -28,8 +28,8 @@ Requires-Dist: grpcio==1.66.1; extra == "grpc"
|
|
28
28
|
Requires-Dist: grpcio-status==1.66.1; extra == "grpc"
|
29
29
|
Provides-Extra: polars
|
30
30
|
Requires-Dist: polars<2.0.0,>=1.0.0; extra == "polars"
|
31
|
-
Provides-Extra:
|
32
|
-
Requires-Dist: pyspark<3.6.0,>=3.0.0; extra == "
|
31
|
+
Provides-Extra: pyspark
|
32
|
+
Requires-Dist: pyspark<3.6.0,>=3.0.0; extra == "pyspark"
|
33
33
|
Provides-Extra: sql
|
34
34
|
Requires-Dist: sqlalchemy<2.1.0,>=2.0.0; extra == "sql"
|
35
35
|
Provides-Extra: aws
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[metadata]
|
2
2
|
name = tracdap-runtime
|
3
|
-
version = 0.
|
3
|
+
version = 0.8.0b2
|
4
4
|
description = Runtime package for building models on the TRAC Data & Analytics Platform
|
5
5
|
long_description = file: README.md
|
6
6
|
long_description_content_type = text/markdown
|
@@ -54,7 +54,7 @@ grpc =
|
|
54
54
|
grpcio-status == 1.66.1
|
55
55
|
polars =
|
56
56
|
polars >= 1.0.0, < 2.0.0
|
57
|
-
|
57
|
+
pyspark =
|
58
58
|
pyspark >= 3.0.0, < 3.6.0
|
59
59
|
sql =
|
60
60
|
sqlalchemy >= 2.0.0, < 2.1.0
|
@@ -25,7 +25,8 @@ import inspect
|
|
25
25
|
import queue
|
26
26
|
import time
|
27
27
|
|
28
|
-
import tracdap.rt._impl.
|
28
|
+
import tracdap.rt._impl.logging as _logging # noqa
|
29
|
+
import tracdap.rt._impl.util as _util # noqa
|
29
30
|
import tracdap.rt._impl.validation as _val # noqa
|
30
31
|
import tracdap.rt.exceptions as _ex
|
31
32
|
|
@@ -235,7 +236,7 @@ class EventLoop:
|
|
235
236
|
self.__shutdown = False
|
236
237
|
self.__shutdown_now = False
|
237
238
|
self.__done = False
|
238
|
-
self.__log =
|
239
|
+
self.__log = _logging.logger_for_object(self)
|
239
240
|
|
240
241
|
def post_message(self, msg: _T_MSG, processor: tp.Callable[[_T_MSG], None]) -> bool:
|
241
242
|
with self.__msg_lock:
|
@@ -365,7 +366,7 @@ class FunctionCache:
|
|
365
366
|
|
366
367
|
class ActorNode:
|
367
368
|
|
368
|
-
_log =
|
369
|
+
_log = _logging.logger_for_class(Actor)
|
369
370
|
|
370
371
|
def __init__(
|
371
372
|
self, actor_id: ActorId, actor: Actor,
|
@@ -904,7 +905,7 @@ class ActorSystem:
|
|
904
905
|
|
905
906
|
super().__init__()
|
906
907
|
|
907
|
-
self._log =
|
908
|
+
self._log = _logging.logger_for_object(self)
|
908
909
|
|
909
910
|
# self.__actors: tp.Dict[ActorId, ActorNode] = {self.__ROOT_ID: ActorNode("", self.__ROOT_ID, None)}
|
910
911
|
# self.__message_queue: tp.List[Msg] = list()
|
@@ -13,7 +13,9 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
+
import contextlib
|
16
17
|
import copy
|
18
|
+
import io
|
17
19
|
import logging
|
18
20
|
import pathlib
|
19
21
|
import typing as tp
|
@@ -24,9 +26,10 @@ import tracdap.rt.api as _api
|
|
24
26
|
import tracdap.rt.api.experimental as _eapi
|
25
27
|
import tracdap.rt.metadata as _meta
|
26
28
|
import tracdap.rt.exceptions as _ex
|
27
|
-
import tracdap.rt._impl.type_system as _types # noqa
|
28
29
|
import tracdap.rt._impl.data as _data # noqa
|
30
|
+
import tracdap.rt._impl.logging as _logging # noqa
|
29
31
|
import tracdap.rt._impl.storage as _storage # noqa
|
32
|
+
import tracdap.rt._impl.type_system as _types # noqa
|
30
33
|
import tracdap.rt._impl.util as _util # noqa
|
31
34
|
import tracdap.rt._impl.validation as _val # noqa
|
32
35
|
|
@@ -61,10 +64,15 @@ class TracContextImpl(_api.TracContext):
|
|
61
64
|
model_class: _api.TracModel.__class__,
|
62
65
|
local_ctx: tp.Dict[str, tp.Any],
|
63
66
|
dynamic_outputs: tp.List[str] = None,
|
64
|
-
checkout_directory: pathlib.Path = None
|
67
|
+
checkout_directory: pathlib.Path = None,
|
68
|
+
log_provider: _logging.LogProvider = None):
|
69
|
+
|
70
|
+
# If no log provider is supplied, use the default (system logs only)
|
71
|
+
if log_provider is None:
|
72
|
+
log_provider = _logging.LogProvider()
|
65
73
|
|
66
|
-
self.__ctx_log =
|
67
|
-
self.__model_log =
|
74
|
+
self.__ctx_log = log_provider.logger_for_object(self)
|
75
|
+
self.__model_log = log_provider.logger_for_class(model_class)
|
68
76
|
|
69
77
|
self.__model_def = model_def
|
70
78
|
self.__model_class = model_class
|
@@ -82,9 +90,9 @@ class TracContextImpl(_api.TracContext):
|
|
82
90
|
|
83
91
|
_val.validate_signature(self.get_parameter, parameter_name)
|
84
92
|
|
85
|
-
self.__val.
|
86
|
-
self.__val.
|
87
|
-
self.__val.
|
93
|
+
self.__val.check_item_valid_identifier(parameter_name, TracContextValidator.PARAMETER)
|
94
|
+
self.__val.check_item_defined_in_model(parameter_name, TracContextValidator.PARAMETER)
|
95
|
+
self.__val.check_item_available_in_context(parameter_name, TracContextValidator.PARAMETER)
|
88
96
|
|
89
97
|
value: _meta.Value = self.__local_ctx.get(parameter_name)
|
90
98
|
|
@@ -96,8 +104,8 @@ class TracContextImpl(_api.TracContext):
|
|
96
104
|
|
97
105
|
_val.validate_signature(self.has_dataset, dataset_name)
|
98
106
|
|
99
|
-
self.__val.
|
100
|
-
self.__val.
|
107
|
+
self.__val.check_item_valid_identifier(dataset_name, TracContextValidator.DATASET)
|
108
|
+
self.__val.check_item_defined_in_model(dataset_name, TracContextValidator.DATASET)
|
101
109
|
|
102
110
|
data_view: _data.DataView = self.__local_ctx.get(dataset_name)
|
103
111
|
|
@@ -105,6 +113,7 @@ class TracContextImpl(_api.TracContext):
|
|
105
113
|
return False
|
106
114
|
|
107
115
|
self.__val.check_context_object_type(dataset_name, data_view, _data.DataView)
|
116
|
+
self.__val.check_context_data_view_type(dataset_name, data_view, _meta.ObjectType.DATA)
|
108
117
|
|
109
118
|
return not data_view.is_empty()
|
110
119
|
|
@@ -112,9 +121,9 @@ class TracContextImpl(_api.TracContext):
|
|
112
121
|
|
113
122
|
_val.validate_signature(self.get_schema, dataset_name)
|
114
123
|
|
115
|
-
self.__val.
|
116
|
-
self.__val.
|
117
|
-
self.__val.
|
124
|
+
self.__val.check_item_valid_identifier(dataset_name, TracContextValidator.DATASET)
|
125
|
+
self.__val.check_item_defined_in_model(dataset_name, TracContextValidator.DATASET)
|
126
|
+
self.__val.check_item_available_in_context(dataset_name, TracContextValidator.DATASET)
|
118
127
|
|
119
128
|
static_schema = self.__get_static_schema(self.__model_def, dataset_name)
|
120
129
|
data_view: _data.DataView = self.__local_ctx.get(dataset_name)
|
@@ -123,6 +132,7 @@ class TracContextImpl(_api.TracContext):
|
|
123
132
|
# This ensures errors are always reported and is consistent with get_pandas_table()
|
124
133
|
|
125
134
|
self.__val.check_context_object_type(dataset_name, data_view, _data.DataView)
|
135
|
+
self.__val.check_context_data_view_type(dataset_name, data_view, _meta.ObjectType.DATA)
|
126
136
|
self.__val.check_dataset_schema_defined(dataset_name, data_view)
|
127
137
|
|
128
138
|
# If a static schema exists, that takes priority
|
@@ -138,9 +148,9 @@ class TracContextImpl(_api.TracContext):
|
|
138
148
|
_val.validate_signature(self.get_table, dataset_name, framework)
|
139
149
|
_val.require_package(framework.protocol_name, framework.api_type)
|
140
150
|
|
141
|
-
self.__val.
|
142
|
-
self.__val.
|
143
|
-
self.__val.
|
151
|
+
self.__val.check_item_valid_identifier(dataset_name, TracContextValidator.DATASET)
|
152
|
+
self.__val.check_item_defined_in_model(dataset_name, TracContextValidator.DATASET)
|
153
|
+
self.__val.check_item_available_in_context(dataset_name, TracContextValidator.DATASET)
|
144
154
|
self.__val.check_data_framework_args(framework, framework_args)
|
145
155
|
|
146
156
|
static_schema = self.__get_static_schema(self.__model_def, dataset_name)
|
@@ -150,6 +160,7 @@ class TracContextImpl(_api.TracContext):
|
|
150
160
|
converter = _data.DataConverter.for_framework(framework, **framework_args)
|
151
161
|
|
152
162
|
self.__val.check_context_object_type(dataset_name, data_view, _data.DataView)
|
163
|
+
self.__val.check_context_data_view_type(dataset_name, data_view, _meta.ObjectType.DATA)
|
153
164
|
self.__val.check_dataset_schema_defined(dataset_name, data_view)
|
154
165
|
self.__val.check_dataset_part_present(dataset_name, data_view, part_key)
|
155
166
|
|
@@ -173,6 +184,27 @@ class TracContextImpl(_api.TracContext):
|
|
173
184
|
def get_polars_table(self, dataset_name: str) -> "_data.polars.DataFrame":
|
174
185
|
|
175
186
|
return self.get_table(dataset_name, _eapi.POLARS)
|
187
|
+
|
188
|
+
def get_file(self, file_name: str) -> bytes:
|
189
|
+
|
190
|
+
_val.validate_signature(self.get_file, file_name)
|
191
|
+
|
192
|
+
self.__val.check_item_valid_identifier(file_name, TracContextValidator.FILE)
|
193
|
+
self.__val.check_item_defined_in_model(file_name, TracContextValidator.FILE)
|
194
|
+
self.__val.check_item_available_in_context(file_name, TracContextValidator.FILE)
|
195
|
+
|
196
|
+
file_view: _data.DataView = self.__local_ctx.get(file_name)
|
197
|
+
|
198
|
+
self.__val.check_context_object_type(file_name, file_view, _data.DataView)
|
199
|
+
self.__val.check_context_data_view_type(file_name, file_view, _meta.ObjectType.FILE)
|
200
|
+
self.__val.check_file_content_present(file_name, file_view)
|
201
|
+
|
202
|
+
return file_view.file_item.raw_bytes
|
203
|
+
|
204
|
+
def get_file_stream(self, file_name: str) -> tp.ContextManager[tp.BinaryIO]:
|
205
|
+
|
206
|
+
buffer = self.get_file(file_name)
|
207
|
+
return contextlib.closing(io.BytesIO(buffer))
|
176
208
|
|
177
209
|
def put_schema(self, dataset_name: str, schema: _meta.SchemaDefinition):
|
178
210
|
|
@@ -182,7 +214,7 @@ class TracContextImpl(_api.TracContext):
|
|
182
214
|
# If field ordering is not assigned by the model, assign it here (model code will not see the numbers)
|
183
215
|
schema_copy = self.__assign_field_order(copy.deepcopy(schema))
|
184
216
|
|
185
|
-
self.__val.
|
217
|
+
self.__val.check_item_valid_identifier(dataset_name, TracContextValidator.DATASET)
|
186
218
|
self.__val.check_dataset_is_dynamic_output(dataset_name)
|
187
219
|
self.__val.check_provided_schema_is_valid(dataset_name, schema_copy)
|
188
220
|
|
@@ -197,6 +229,7 @@ class TracContextImpl(_api.TracContext):
|
|
197
229
|
|
198
230
|
# If there is a prior view it must contain nothing and will be replaced
|
199
231
|
self.__val.check_context_object_type(dataset_name, data_view, _data.DataView)
|
232
|
+
self.__val.check_context_data_view_type(dataset_name, data_view, _meta.ObjectType.DATA)
|
200
233
|
self.__val.check_dataset_schema_not_defined(dataset_name, data_view)
|
201
234
|
self.__val.check_dataset_is_empty(dataset_name, data_view)
|
202
235
|
|
@@ -216,8 +249,8 @@ class TracContextImpl(_api.TracContext):
|
|
216
249
|
|
217
250
|
_val.require_package(framework.protocol_name, framework.api_type)
|
218
251
|
|
219
|
-
self.__val.
|
220
|
-
self.__val.
|
252
|
+
self.__val.check_item_valid_identifier(dataset_name, TracContextValidator.DATASET)
|
253
|
+
self.__val.check_item_is_model_output(dataset_name, TracContextValidator.DATASET)
|
221
254
|
self.__val.check_provided_dataset_type(dataset, framework.api_type)
|
222
255
|
self.__val.check_data_framework_args(framework, framework_args)
|
223
256
|
|
@@ -234,6 +267,7 @@ class TracContextImpl(_api.TracContext):
|
|
234
267
|
data_view = _data.DataView.create_empty()
|
235
268
|
|
236
269
|
self.__val.check_context_object_type(dataset_name, data_view, _data.DataView)
|
270
|
+
self.__val.check_context_data_view_type(dataset_name, data_view, _meta.ObjectType.DATA)
|
237
271
|
self.__val.check_dataset_schema_defined(dataset_name, data_view)
|
238
272
|
self.__val.check_dataset_part_not_present(dataset_name, data_view, part_key)
|
239
273
|
|
@@ -246,7 +280,7 @@ class TracContextImpl(_api.TracContext):
|
|
246
280
|
|
247
281
|
# Data conformance is applied automatically inside the converter, if schema != None
|
248
282
|
table = converter.to_internal(dataset, schema)
|
249
|
-
item = _data.DataItem(schema, table)
|
283
|
+
item = _data.DataItem(_meta.ObjectType.DATA, schema, table)
|
250
284
|
|
251
285
|
updated_view = _data.DataMapping.add_item_to_view(data_view, part_key, item)
|
252
286
|
|
@@ -259,6 +293,46 @@ class TracContextImpl(_api.TracContext):
|
|
259
293
|
def put_polars_table(self, dataset_name: str, dataset: "_data.polars.DataFrame"):
|
260
294
|
|
261
295
|
self.put_table(dataset_name, dataset, _eapi.POLARS)
|
296
|
+
|
297
|
+
def put_file(self, file_name: str, file_content: tp.Union[bytes, bytearray]):
|
298
|
+
|
299
|
+
_val.validate_signature(self.put_file, file_name, file_content)
|
300
|
+
|
301
|
+
self.__val.check_item_valid_identifier(file_name, TracContextValidator.FILE)
|
302
|
+
self.__val.check_item_is_model_output(file_name, TracContextValidator.FILE)
|
303
|
+
|
304
|
+
file_view: _data.DataView = self.__local_ctx.get(file_name)
|
305
|
+
|
306
|
+
if file_view is None:
|
307
|
+
file_view = _data.DataView.create_empty(_meta.ObjectType.FILE)
|
308
|
+
|
309
|
+
self.__val.check_context_object_type(file_name, file_view, _data.DataView)
|
310
|
+
self.__val.check_context_data_view_type(file_name, file_view, _meta.ObjectType.FILE)
|
311
|
+
self.__val.check_file_content_not_present(file_name, file_view)
|
312
|
+
|
313
|
+
if isinstance(file_content, bytearray):
|
314
|
+
file_content = bytes(bytearray)
|
315
|
+
|
316
|
+
file_item = _data.DataItem.for_file_content(file_content)
|
317
|
+
self.__local_ctx[file_name] = file_view.with_file_item(file_item)
|
318
|
+
|
319
|
+
def put_file_stream(self, file_name: str) -> tp.ContextManager[tp.BinaryIO]:
|
320
|
+
|
321
|
+
_val.validate_signature(self.put_file_stream, file_name)
|
322
|
+
|
323
|
+
self.__val.check_item_valid_identifier(file_name, TracContextValidator.FILE)
|
324
|
+
self.__val.check_item_is_model_output(file_name, TracContextValidator.FILE)
|
325
|
+
|
326
|
+
@contextlib.contextmanager
|
327
|
+
def memory_stream(stream: io.BytesIO):
|
328
|
+
try:
|
329
|
+
yield stream
|
330
|
+
buffer = stream.getbuffer().tobytes()
|
331
|
+
self.put_file(file_name, buffer)
|
332
|
+
finally:
|
333
|
+
stream.close()
|
334
|
+
|
335
|
+
return memory_stream(io.BytesIO())
|
262
336
|
|
263
337
|
def log(self) -> logging.Logger:
|
264
338
|
|
@@ -300,9 +374,9 @@ class TracDataContextImpl(TracContextImpl, _eapi.TracDataContext):
|
|
300
374
|
self, model_def: _meta.ModelDefinition, model_class: _api.TracModel.__class__,
|
301
375
|
local_ctx: tp.Dict[str, tp.Any], dynamic_outputs: tp.List[str],
|
302
376
|
storage_map: tp.Dict[str, tp.Union[_eapi.TracFileStorage, _eapi.TracDataStorage]],
|
303
|
-
checkout_directory: pathlib.Path = None):
|
377
|
+
checkout_directory: pathlib.Path = None, log_provider: _logging.LogProvider = None):
|
304
378
|
|
305
|
-
super().__init__(model_def, model_class, local_ctx, dynamic_outputs, checkout_directory)
|
379
|
+
super().__init__(model_def, model_class, local_ctx, dynamic_outputs, checkout_directory, log_provider)
|
306
380
|
|
307
381
|
self.__model_def = model_def
|
308
382
|
self.__local_ctx = local_ctx
|
@@ -310,7 +384,7 @@ class TracDataContextImpl(TracContextImpl, _eapi.TracDataContext):
|
|
310
384
|
self.__storage_map = storage_map
|
311
385
|
self.__checkout_directory = checkout_directory
|
312
386
|
|
313
|
-
self.__val = self._TracContextImpl__val # noqa
|
387
|
+
self.__val: TracContextValidator = self._TracContextImpl__val # noqa
|
314
388
|
|
315
389
|
def get_file_storage(self, storage_key: str) -> _eapi.TracFileStorage:
|
316
390
|
|
@@ -348,9 +422,9 @@ class TracDataContextImpl(TracContextImpl, _eapi.TracDataContext):
|
|
348
422
|
|
349
423
|
_val.validate_signature(self.add_data_import, dataset_name)
|
350
424
|
|
351
|
-
self.__val.
|
352
|
-
self.__val.
|
353
|
-
self.__val.
|
425
|
+
self.__val.check_item_valid_identifier(dataset_name, TracContextValidator.DATASET)
|
426
|
+
self.__val.check_item_not_defined_in_model(dataset_name, TracContextValidator.DATASET)
|
427
|
+
self.__val.check_item_not_available_in_context(dataset_name, TracContextValidator.DATASET)
|
354
428
|
|
355
429
|
self.__local_ctx[dataset_name] = _data.DataView.create_empty()
|
356
430
|
self.__dynamic_outputs.append(dataset_name)
|
@@ -359,8 +433,8 @@ class TracDataContextImpl(TracContextImpl, _eapi.TracDataContext):
|
|
359
433
|
|
360
434
|
_val.validate_signature(self.set_source_metadata, dataset_name, storage_key, source_info)
|
361
435
|
|
362
|
-
self.__val.
|
363
|
-
self.__val.
|
436
|
+
self.__val.check_item_valid_identifier(dataset_name, TracContextValidator.DATASET)
|
437
|
+
self.__val.check_item_available_in_context(dataset_name, TracContextValidator.DATASET)
|
364
438
|
self.__val.check_storage_valid_identifier(storage_key)
|
365
439
|
self.__val.check_storage_available(self.__storage_map, storage_key)
|
366
440
|
|
@@ -368,11 +442,11 @@ class TracDataContextImpl(TracContextImpl, _eapi.TracDataContext):
|
|
368
442
|
|
369
443
|
if isinstance(storage, _eapi.TracFileStorage):
|
370
444
|
if not isinstance(source_info, _eapi.FileStat):
|
371
|
-
self.__val.report_public_error(f"Expected storage_info to be a FileStat, [{storage_key}] refers to file storage")
|
445
|
+
self.__val.report_public_error(_ex.ERuntimeValidation(f"Expected storage_info to be a FileStat, [{storage_key}] refers to file storage"))
|
372
446
|
|
373
447
|
if isinstance(storage, _eapi.TracDataStorage):
|
374
448
|
if not isinstance(source_info, str):
|
375
|
-
self.__val.report_public_error(f"Expected storage_info to be a table name, [{storage_key}] refers to dadta storage")
|
449
|
+
self.__val.report_public_error(_ex.ERuntimeValidation(f"Expected storage_info to be a table name, [{storage_key}] refers to dadta storage"))
|
376
450
|
|
377
451
|
pass # Not implemented yet, only required when imports are sent back to the platform
|
378
452
|
|
@@ -392,7 +466,9 @@ class TracDataContextImpl(TracContextImpl, _eapi.TracDataContext):
|
|
392
466
|
|
393
467
|
class TracFileStorageImpl(_eapi.TracFileStorage):
|
394
468
|
|
395
|
-
def __init__(
|
469
|
+
def __init__(
|
470
|
+
self, storage_key: str, storage_impl: _storage.IFileStorage,
|
471
|
+
write_access: bool, checkout_directory, log_provider: _logging.LogProvider):
|
396
472
|
|
397
473
|
self.__storage_key = storage_key
|
398
474
|
|
@@ -413,7 +489,11 @@ class TracFileStorageImpl(_eapi.TracFileStorage):
|
|
413
489
|
self.__rmdir = None
|
414
490
|
self.__write_byte_stream = None
|
415
491
|
|
416
|
-
|
492
|
+
# If no log provider is supplied, use the default (system logs only)
|
493
|
+
if log_provider is None:
|
494
|
+
log_provider = _logging.LogProvider()
|
495
|
+
|
496
|
+
self.__log = log_provider.logger_for_object(self)
|
417
497
|
self.__val = TracStorageValidator(self.__log, checkout_directory, self.__storage_key)
|
418
498
|
|
419
499
|
def get_storage_key(self) -> str:
|
@@ -534,7 +614,7 @@ class TracDataStorageImpl(_eapi.TracDataStorage[_eapi.DATA_API]):
|
|
534
614
|
def __init__(
|
535
615
|
self, storage_key: str, storage_impl: _storage.IDataStorageBase[_data.T_INTERNAL_DATA, _data.T_INTERNAL_SCHEMA],
|
536
616
|
data_converter: _data.DataConverter[_eapi.DATA_API, _data.T_INTERNAL_DATA, _data.T_INTERNAL_SCHEMA],
|
537
|
-
write_access: bool, checkout_directory):
|
617
|
+
write_access: bool, checkout_directory, log_provider: _logging.LogProvider):
|
538
618
|
|
539
619
|
self.__storage_key = storage_key
|
540
620
|
self.__converter = data_converter
|
@@ -551,7 +631,11 @@ class TracDataStorageImpl(_eapi.TracDataStorage[_eapi.DATA_API]):
|
|
551
631
|
self.__create_table = None
|
552
632
|
self.__write_table = None
|
553
633
|
|
554
|
-
|
634
|
+
# If no log provider is supplied, use the default (system logs only)
|
635
|
+
if log_provider is None:
|
636
|
+
log_provider = _logging.LogProvider()
|
637
|
+
|
638
|
+
self.__log = log_provider.logger_for_object(self)
|
555
639
|
self.__val = TracStorageValidator(self.__log, checkout_directory, self.__storage_key)
|
556
640
|
|
557
641
|
def has_table(self, table_name: str) -> bool:
|
@@ -684,6 +768,10 @@ class TracContextErrorReporter:
|
|
684
768
|
|
685
769
|
class TracContextValidator(TracContextErrorReporter):
|
686
770
|
|
771
|
+
PARAMETER = "Parameter"
|
772
|
+
DATASET = "Dataset"
|
773
|
+
FILE = "File"
|
774
|
+
|
687
775
|
def __init__(
|
688
776
|
self, log: logging.Logger,
|
689
777
|
model_def: _meta.ModelDefinition,
|
@@ -697,49 +785,45 @@ class TracContextValidator(TracContextErrorReporter):
|
|
697
785
|
self.__local_ctx = local_ctx
|
698
786
|
self.__dynamic_outputs = dynamic_outputs
|
699
787
|
|
700
|
-
def
|
788
|
+
def check_item_valid_identifier(self, item_name: str, item_type: str):
|
701
789
|
|
702
|
-
if
|
703
|
-
self._report_error(f"
|
790
|
+
if item_name is None:
|
791
|
+
self._report_error(f"{item_type} name is null")
|
704
792
|
|
705
|
-
if not self._VALID_IDENTIFIER.match(
|
706
|
-
self._report_error(f"
|
793
|
+
if not self._VALID_IDENTIFIER.match(item_name):
|
794
|
+
self._report_error(f"{item_type} name {item_name} is not a valid identifier")
|
707
795
|
|
708
|
-
def
|
796
|
+
def check_item_defined_in_model(self, item_name: str, item_type: str):
|
709
797
|
|
710
|
-
if
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
self._report_error(f"Parameter {param_name} is not available in the current context")
|
717
|
-
|
718
|
-
def check_dataset_valid_identifier(self, dataset_name: str):
|
798
|
+
if item_type == self.PARAMETER:
|
799
|
+
if item_name not in self.__model_def.parameters:
|
800
|
+
self._report_error(f"{item_type} {item_name} is not defined in the model")
|
801
|
+
else:
|
802
|
+
if item_name not in self.__model_def.inputs and item_name not in self.__model_def.outputs:
|
803
|
+
self._report_error(f"{item_type} {item_name} is not defined in the model")
|
719
804
|
|
720
|
-
|
721
|
-
self._report_error(f"Dataset name is null")
|
805
|
+
def check_item_not_defined_in_model(self, item_name: str, item_type: str):
|
722
806
|
|
723
|
-
if
|
724
|
-
self._report_error(f"
|
807
|
+
if item_name in self.__model_def.inputs or item_name in self.__model_def.outputs:
|
808
|
+
self._report_error(f"{item_type} {item_name} is already defined in the model")
|
725
809
|
|
726
|
-
|
810
|
+
if item_name in self.__model_def.parameters:
|
811
|
+
self._report_error(f"{item_name} name {item_name} is already in use as a model parameter")
|
727
812
|
|
728
|
-
|
729
|
-
self._report_error(f"Dataset {dataset_name} is already defined in the model")
|
813
|
+
def check_item_is_model_output(self, item_name: str, item_type: str):
|
730
814
|
|
731
|
-
if
|
732
|
-
self._report_error(f"
|
815
|
+
if item_name not in self.__model_def.outputs and item_name not in self.__dynamic_outputs:
|
816
|
+
self._report_error(f"{item_type} {item_name} is not defined as a model output")
|
733
817
|
|
734
|
-
def
|
818
|
+
def check_item_available_in_context(self, item_name: str, item_type: str):
|
735
819
|
|
736
|
-
if
|
737
|
-
self._report_error(f"
|
820
|
+
if item_name not in self.__local_ctx:
|
821
|
+
self._report_error(f"{item_type} {item_name} is not available in the current context")
|
738
822
|
|
739
|
-
def
|
823
|
+
def check_item_not_available_in_context(self, item_name: str, item_type: str):
|
740
824
|
|
741
|
-
if
|
742
|
-
self._report_error(f"
|
825
|
+
if item_name in self.__local_ctx:
|
826
|
+
self._report_error(f"{item_type} {item_name} already exists in the current context")
|
743
827
|
|
744
828
|
def check_dataset_is_dynamic_output(self, dataset_name: str):
|
745
829
|
|
@@ -752,16 +836,6 @@ class TracContextValidator(TracContextErrorReporter):
|
|
752
836
|
if model_output and not model_output.dynamic:
|
753
837
|
self._report_error(f"Model output {dataset_name} is not a dynamic output")
|
754
838
|
|
755
|
-
def check_dataset_available_in_context(self, item_name: str):
|
756
|
-
|
757
|
-
if item_name not in self.__local_ctx:
|
758
|
-
self._report_error(f"Dataset {item_name} is not available in the current context")
|
759
|
-
|
760
|
-
def check_dataset_not_available_in_context(self, item_name: str):
|
761
|
-
|
762
|
-
if item_name in self.__local_ctx:
|
763
|
-
self._report_error(f"Dataset {item_name} already exists in the current context")
|
764
|
-
|
765
839
|
def check_dataset_schema_defined(self, dataset_name: str, data_view: _data.DataView):
|
766
840
|
|
767
841
|
schema = data_view.trac_schema if data_view is not None else None
|
@@ -834,6 +908,14 @@ class TracContextValidator(TracContextErrorReporter):
|
|
834
908
|
f"The object referenced by [{item_name}] in the current context has the wrong type" +
|
835
909
|
f" (expected {expected_type_name}, got {actual_type_name})")
|
836
910
|
|
911
|
+
def check_context_data_view_type(self, item_name: str, data_vew: _data.DataView, expected_type: _meta.ObjectType):
|
912
|
+
|
913
|
+
if data_vew.object_type != expected_type:
|
914
|
+
|
915
|
+
self._report_error(
|
916
|
+
f"The object referenced by [{item_name}] in the current context has the wrong type" +
|
917
|
+
f" (expected {expected_type.name}, got {data_vew.object_type.name})")
|
918
|
+
|
837
919
|
def check_data_framework_args(self, framework: _eapi.DataFramework, framework_args: tp.Dict[str, tp.Any]):
|
838
920
|
|
839
921
|
expected_args = _data.DataConverter.get_framework_args(framework)
|
@@ -861,6 +943,16 @@ class TracContextValidator(TracContextErrorReporter):
|
|
861
943
|
f"Using [{framework}], argument [{arg_name}] has the wrong type" +
|
862
944
|
f" (expected {expected_type_name}, got {actual_type_name})")
|
863
945
|
|
946
|
+
def check_file_content_present(self, file_name: str, file_view: _data.DataView):
|
947
|
+
|
948
|
+
if file_view.file_item is None or not file_view.file_item.raw_bytes:
|
949
|
+
self._report_error(f"File content is missing or empty for [{file_name}] in the current context")
|
950
|
+
|
951
|
+
def check_file_content_not_present(self, file_name: str, file_view: _data.DataView):
|
952
|
+
|
953
|
+
if file_view.file_item is not None and file_view.file_item.raw_bytes:
|
954
|
+
self._report_error(f"File content is already present for [{file_name}] in the current context")
|
955
|
+
|
864
956
|
def check_storage_valid_identifier(self, storage_key):
|
865
957
|
|
866
958
|
if storage_key is None:
|
@@ -878,7 +970,7 @@ class TracContextValidator(TracContextErrorReporter):
|
|
878
970
|
|
879
971
|
def check_storage_type(
|
880
972
|
self, storage_map: tp.Dict, storage_key: str,
|
881
|
-
storage_type: tp.Union[_eapi.TracFileStorage.__class__]):
|
973
|
+
storage_type: tp.Union[_eapi.TracFileStorage.__class__, _eapi.TracDataStorage.__class__]):
|
882
974
|
|
883
975
|
storage_instance = storage_map.get(storage_key)
|
884
976
|
|