tracdap-runtime 0.8.0b1__tar.gz → 0.8.0b3__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.8.0b1 → tracdap_runtime-0.8.0b3}/PKG-INFO +2 -2
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/setup.cfg +3 -2
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/config_parser.py +14 -7
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/data.py +3 -3
- tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core/logging.py +195 -0
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/models.py +7 -6
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/repos.py +5 -3
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/schemas.py +5 -5
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/shim.py +5 -4
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/storage.py +7 -6
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/util.py +0 -110
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/validation.py +4 -3
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/exec}/actors.py +12 -14
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/exec}/context.py +30 -14
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/exec}/dev_mode.py +8 -7
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/exec}/engine.py +227 -104
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/exec}/functions.py +36 -57
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/exec}/graph.py +2 -21
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/exec}/graph_builder.py +33 -19
- tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/grpc/__init__.py +14 -0
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/grpc}/server.py +7 -6
- tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.py +130 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.pyi +16 -2
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/object_id_pb2.py +3 -3
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/object_id_pb2.pyi +2 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.py +4 -4
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.pyi +4 -2
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl}/runtime.py +13 -12
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/static_api.py +4 -4
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/format_csv.py +1 -1
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/storage_sql.py +1 -1
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_version.py +1 -1
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/config/__init__.py +1 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/config/platform.py +8 -0
- tracdap_runtime-0.8.0b3/src/tracdap/rt/ext/__init__.py +14 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/ext/embed.py +2 -2
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/ext/plugins.py +3 -3
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/launch/launch.py +3 -3
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/__init__.py +1 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/job.py +16 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/object.py +2 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/object_id.py +2 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/tracdap_runtime.egg-info/PKG-INFO +2 -2
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/tracdap_runtime.egg-info/SOURCES.txt +23 -21
- tracdap_runtime-0.8.0b1/src/tracdap/rt/_exec/__init__.py +0 -0
- tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.py +0 -128
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/LICENSE +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/README.md +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/pyproject.toml +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/__init__.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/__init__.py +0 -0
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl/ext → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/__init__.py +0 -0
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/guard_rails.py +0 -0
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/core}/type_system.py +0 -0
- {tracdap_runtime-0.8.0b1/src/tracdap/rt/_impl/grpc → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl/exec}/__init__.py +0 -0
- {tracdap_runtime-0.8.0b1/src/tracdap/rt → tracdap_runtime-0.8.0b3/src/tracdap/rt/_impl}/ext/__init__.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/ext/sql.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/ext/storage.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/codec.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2_grpc.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/common_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/common_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/custom_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/custom_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/flow_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/flow_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/resource_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/resource_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/search_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/search_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/stoarge_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/stoarge_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/tag_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/tag_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/tag_update_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/tag_update_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/type_pb2.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_impl/grpc/tracdap/metadata/type_pb2.pyi +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/__init__.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/_helpers.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/config_local.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/format_arrow.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/format_parquet.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/repo_git.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/repo_local.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/repo_pypi.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/storage_aws.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/storage_azure.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/storage_gcp.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/storage_local.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/_plugins/storage_sql_dialects.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/api/__init__.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/api/experimental.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/api/file_types.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/api/hook.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/api/model_api.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/api/static_api.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/config/common.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/config/job.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/config/result.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/config/runtime.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/exceptions.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/ext/config.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/ext/repos.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/ext/storage.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/launch/__init__.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/launch/__main__.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/launch/cli.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/common.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/custom.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/data.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/file.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/flow.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/model.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/resource.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/search.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/stoarge.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/tag.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/tag_update.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/src/tracdap/rt/metadata/type.py +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/tracdap_runtime.egg-info/dependency_links.txt +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/tracdap_runtime.egg-info/requires.txt +0 -0
- {tracdap_runtime-0.8.0b1 → tracdap_runtime-0.8.0b3}/tracdap_runtime.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[metadata]
|
2
2
|
name = tracdap-runtime
|
3
|
-
version = 0.8.
|
3
|
+
version = 0.8.0b3
|
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
|
@@ -26,8 +26,9 @@ packages =
|
|
26
26
|
tracdap.rt.config
|
27
27
|
tracdap.rt.launch
|
28
28
|
tracdap.rt.ext
|
29
|
-
tracdap.rt._exec
|
30
29
|
tracdap.rt._impl
|
30
|
+
tracdap.rt._impl.core
|
31
|
+
tracdap.rt._impl.exec
|
31
32
|
tracdap.rt._impl.ext
|
32
33
|
tracdap.rt._impl.grpc
|
33
34
|
tracdap.rt._impl.grpc.tracdap
|
@@ -12,8 +12,14 @@
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
|
-
|
16
|
-
|
15
|
+
#
|
16
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
#
|
18
|
+
# Unless required by applicable law or agreed to in writing, software
|
19
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
20
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
21
|
+
# See the License for the specific language governing permissions and
|
22
|
+
# limitations under the License.
|
17
23
|
|
18
24
|
import dataclasses as _dc
|
19
25
|
import decimal
|
@@ -32,7 +38,8 @@ import tracdap.rt.config as _config
|
|
32
38
|
import tracdap.rt.exceptions as _ex
|
33
39
|
import tracdap.rt.ext.plugins as _plugins
|
34
40
|
import tracdap.rt.ext.config as _config_ext
|
35
|
-
import tracdap.rt._impl.
|
41
|
+
import tracdap.rt._impl.core.logging as _logging
|
42
|
+
import tracdap.rt._impl.core.util as _util
|
36
43
|
|
37
44
|
import yaml
|
38
45
|
import yaml.parser
|
@@ -43,7 +50,7 @@ _T = tp.TypeVar('_T')
|
|
43
50
|
class ConfigManager:
|
44
51
|
|
45
52
|
@classmethod
|
46
|
-
def for_root_config(cls, root_config_file: tp.Union[str, pathlib.Path, None]) -> ConfigManager:
|
53
|
+
def for_root_config(cls, root_config_file: tp.Union[str, pathlib.Path, None]) -> "ConfigManager":
|
47
54
|
|
48
55
|
if isinstance(root_config_file, pathlib.Path):
|
49
56
|
root_file_path = cls._resolve_scheme(root_config_file)
|
@@ -69,7 +76,7 @@ class ConfigManager:
|
|
69
76
|
return ConfigManager(working_dir_url, None)
|
70
77
|
|
71
78
|
@classmethod
|
72
|
-
def for_root_dir(cls, root_config_dir: tp.Union[str, pathlib.Path]) -> ConfigManager:
|
79
|
+
def for_root_dir(cls, root_config_dir: tp.Union[str, pathlib.Path]) -> "ConfigManager":
|
73
80
|
|
74
81
|
if isinstance(root_config_dir, pathlib.Path):
|
75
82
|
root_dir_path = cls._resolve_scheme(root_config_dir)
|
@@ -103,7 +110,7 @@ class ConfigManager:
|
|
103
110
|
return raw_url
|
104
111
|
|
105
112
|
def __init__(self, root_dir_url: _urlp.ParseResult, root_file_url: tp.Optional[_urlp.ParseResult]):
|
106
|
-
self._log =
|
113
|
+
self._log = _logging.logger_for_object(self)
|
107
114
|
self._root_dir_url = root_dir_url
|
108
115
|
self._root_file_url = root_file_url
|
109
116
|
|
@@ -294,7 +301,7 @@ class ConfigParser(tp.Generic[_T]):
|
|
294
301
|
}
|
295
302
|
|
296
303
|
def __init__(self, config_class: _T.__class__, dev_mode_locations: tp.List[str] = None):
|
297
|
-
self._log =
|
304
|
+
self._log = _logging.logger_for_object(self)
|
298
305
|
self._config_class = config_class
|
299
306
|
self._dev_mode_locations = dev_mode_locations or []
|
300
307
|
self._errors = []
|
@@ -37,7 +37,7 @@ except ModuleNotFoundError:
|
|
37
37
|
import tracdap.rt.api.experimental as _api
|
38
38
|
import tracdap.rt.metadata as _meta
|
39
39
|
import tracdap.rt.exceptions as _ex
|
40
|
-
import tracdap.rt._impl.
|
40
|
+
import tracdap.rt._impl.core.logging as _log
|
41
41
|
|
42
42
|
|
43
43
|
@dc.dataclass(frozen=True)
|
@@ -188,7 +188,7 @@ class DataMapping:
|
|
188
188
|
:py:class:`TypeMapping <tracdap.rt.impl.type_system.MetadataCodec>`.
|
189
189
|
"""
|
190
190
|
|
191
|
-
__log =
|
191
|
+
__log = _log.logger_for_namespace(_DataInternal.__module__ + ".DataMapping")
|
192
192
|
|
193
193
|
# Matches TRAC_ARROW_TYPE_MAPPING in ArrowSchema, tracdap-lib-data
|
194
194
|
|
@@ -715,7 +715,7 @@ class DataConformance:
|
|
715
715
|
Check and/or apply conformance between datasets and schemas.
|
716
716
|
"""
|
717
717
|
|
718
|
-
__log =
|
718
|
+
__log = _log.logger_for_namespace(_DataInternal.__module__ + ".DataConformance")
|
719
719
|
|
720
720
|
__E_FIELD_MISSING = \
|
721
721
|
"Field [{field_name}] is missing from the data"
|
@@ -0,0 +1,195 @@
|
|
1
|
+
# Licensed to the Fintech Open Source Foundation (FINOS) under one or
|
2
|
+
# more contributor license agreements. See the NOTICE file distributed
|
3
|
+
# with this work for additional information regarding copyright ownership.
|
4
|
+
# FINOS licenses this file to you under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with the
|
6
|
+
# License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
import io as _io
|
17
|
+
import sys as _sys
|
18
|
+
import typing as _tp
|
19
|
+
|
20
|
+
from logging import *
|
21
|
+
|
22
|
+
|
23
|
+
class PlainFormatter(Formatter):
|
24
|
+
|
25
|
+
FORMAT = f"%(asctime)s [%(threadName)s] %(levelname)s %(name)s" + \
|
26
|
+
f" - %(message)s"
|
27
|
+
|
28
|
+
def __init__(self):
|
29
|
+
super().__init__(self.FORMAT)
|
30
|
+
|
31
|
+
|
32
|
+
class ColorFormatter(Formatter):
|
33
|
+
|
34
|
+
_BLACK, _RED, _GREEN, _YELLOW, _BLUE, _MAGENTA, _CYAN, _WHITE, _DEFAULT_WHITE = range(9)
|
35
|
+
_DARK_BASE = 30
|
36
|
+
_LIGHT_BASE = 90
|
37
|
+
|
38
|
+
# DARK_BASE + WHITE = light grey
|
39
|
+
# DARK_BASE + DEFAULT_WHITE = regular console white
|
40
|
+
# LIGHT_BASE + WHITE = bright white (0xffffff), very bright!
|
41
|
+
|
42
|
+
def __init__(self, is_bright: bool):
|
43
|
+
|
44
|
+
super().__init__(self._base_fmt(is_bright))
|
45
|
+
self._level_colors = self._make_level_colors(is_bright)
|
46
|
+
self._default_color = self._make_default_color(is_bright)
|
47
|
+
|
48
|
+
def format(self, record):
|
49
|
+
|
50
|
+
level_name = record.levelname
|
51
|
+
level_color = self._level_colors.get(level_name)
|
52
|
+
|
53
|
+
if level_color:
|
54
|
+
record.levelname = level_color
|
55
|
+
else:
|
56
|
+
record.levelname = self._default_color + level_name
|
57
|
+
|
58
|
+
return Formatter.format(self, record)
|
59
|
+
|
60
|
+
def _base_fmt(self, is_bright: bool):
|
61
|
+
|
62
|
+
if is_bright:
|
63
|
+
base_color = self._make_ansi_code(self._DARK_BASE, self._DEFAULT_WHITE, is_bold=False)
|
64
|
+
message_color = self._make_ansi_code(self._LIGHT_BASE, self._CYAN, is_bold=False)
|
65
|
+
else:
|
66
|
+
base_color = self._make_ansi_code(self._DARK_BASE, self._WHITE, is_bold=False)
|
67
|
+
message_color = self._make_ansi_code(self._DARK_BASE, self._CYAN, is_bold=False)
|
68
|
+
|
69
|
+
return f"{base_color}%(asctime)s [%(threadName)s] %(levelname)s{base_color} %(name)s" + \
|
70
|
+
f" - {message_color}%(message)s"
|
71
|
+
|
72
|
+
def _make_level_colors(self, is_bright: bool):
|
73
|
+
|
74
|
+
base_code = self._LIGHT_BASE if is_bright else self._DARK_BASE
|
75
|
+
|
76
|
+
green = self._make_ansi_code(base_code, self._GREEN, is_bold=is_bright)
|
77
|
+
yellow = self._make_ansi_code(base_code, self._YELLOW, is_bold=is_bright)
|
78
|
+
red = self._make_ansi_code(base_code, self._RED, is_bold=is_bright)
|
79
|
+
|
80
|
+
level_colors = {
|
81
|
+
'CRITICAL': f"{red}CRITICAL",
|
82
|
+
'ERROR': f"{red}ERROR",
|
83
|
+
'WARNING': f"{yellow}WARNING",
|
84
|
+
'INFO': f"{green}INFO"
|
85
|
+
}
|
86
|
+
|
87
|
+
return level_colors
|
88
|
+
|
89
|
+
def _make_default_color(self, is_bright: bool):
|
90
|
+
|
91
|
+
base_code = self._LIGHT_BASE if is_bright else self._DARK_BASE
|
92
|
+
blue = self._make_ansi_code(base_code, self._BLUE, is_bold=is_bright)
|
93
|
+
|
94
|
+
return blue
|
95
|
+
|
96
|
+
@classmethod
|
97
|
+
def _make_ansi_code(cls, base_code: int, color_offset: int, is_bold: bool):
|
98
|
+
return f"\033[{1 if is_bold else 0};{base_code + color_offset}m"
|
99
|
+
|
100
|
+
|
101
|
+
def configure_logging(enable_debug=False):
|
102
|
+
|
103
|
+
root_logger = getLogger()
|
104
|
+
log_level = DEBUG if enable_debug else INFO
|
105
|
+
|
106
|
+
if not root_logger.hasHandlers():
|
107
|
+
|
108
|
+
console_formatter = ColorFormatter(is_bright=True)
|
109
|
+
console_handler = StreamHandler(_sys.stdout)
|
110
|
+
console_handler.setFormatter(console_formatter)
|
111
|
+
console_handler.setLevel(INFO)
|
112
|
+
root_logger.addHandler(console_handler)
|
113
|
+
root_logger.setLevel(log_level)
|
114
|
+
|
115
|
+
# Use is_bright=False for logs from the TRAC runtime, so model logs stand out
|
116
|
+
|
117
|
+
trac_logger = getLogger("tracdap.rt")
|
118
|
+
|
119
|
+
console_formatter = ColorFormatter(is_bright=False)
|
120
|
+
console_handler = StreamHandler(_sys.stdout)
|
121
|
+
console_handler.setFormatter(console_formatter)
|
122
|
+
console_handler.setLevel(log_level)
|
123
|
+
trac_logger.addHandler(console_handler)
|
124
|
+
trac_logger.propagate = False
|
125
|
+
|
126
|
+
|
127
|
+
def logger_for_object(obj: object) -> Logger:
|
128
|
+
return logger_for_class(obj.__class__)
|
129
|
+
|
130
|
+
|
131
|
+
def logger_for_class(clazz: type) -> Logger:
|
132
|
+
qualified_class_name = f"{clazz.__module__}.{clazz.__name__}"
|
133
|
+
return getLogger(qualified_class_name)
|
134
|
+
|
135
|
+
|
136
|
+
def logger_for_namespace(namespace: str) -> Logger:
|
137
|
+
return getLogger(namespace)
|
138
|
+
|
139
|
+
|
140
|
+
class JobLogger(Logger):
|
141
|
+
|
142
|
+
def __init__(self, sys_log: Logger, *handlers: Handler):
|
143
|
+
|
144
|
+
super().__init__(sys_log.name, sys_log.level)
|
145
|
+
self._sys_log = sys_log._log
|
146
|
+
self._job_log = super()._log
|
147
|
+
|
148
|
+
for handler in handlers:
|
149
|
+
self.addHandler(handler)
|
150
|
+
|
151
|
+
def _log(self, level, msg, args, exc_info=None, extra=None, stack_info=False, stacklevel=1):
|
152
|
+
|
153
|
+
self._sys_log(level, msg, args, exc_info, extra, stack_info, stacklevel)
|
154
|
+
self._job_log(level, msg, args, exc_info, extra, stack_info, stacklevel)
|
155
|
+
|
156
|
+
|
157
|
+
class LogProvider:
|
158
|
+
|
159
|
+
def logger_for_object(self, obj: object) -> Logger:
|
160
|
+
return logger_for_object(obj)
|
161
|
+
|
162
|
+
def logger_for_class(self, clazz: type) -> Logger:
|
163
|
+
return logger_for_class(clazz)
|
164
|
+
|
165
|
+
def logger_for_namespace(self, namespace: str) -> Logger:
|
166
|
+
return logger_for_namespace(namespace)
|
167
|
+
|
168
|
+
|
169
|
+
class JobLogProvider(LogProvider):
|
170
|
+
|
171
|
+
def __init__(self, *handlers: Handler):
|
172
|
+
self.__handlers = handlers
|
173
|
+
|
174
|
+
def logger_for_object(self, obj: object) -> Logger:
|
175
|
+
base_logger = logger_for_object(obj)
|
176
|
+
return JobLogger(base_logger, *self.__handlers)
|
177
|
+
|
178
|
+
def logger_for_class(self, clazz: type) -> Logger:
|
179
|
+
base_logger = logger_for_class(clazz)
|
180
|
+
return JobLogger(base_logger, *self.__handlers)
|
181
|
+
|
182
|
+
def logger_for_namespace(self, namespace: str) -> Logger:
|
183
|
+
base_logger = logger_for_namespace(namespace)
|
184
|
+
return JobLogger(base_logger, *self.__handlers)
|
185
|
+
|
186
|
+
|
187
|
+
def job_log_provider(target: _tp.BinaryIO) -> JobLogProvider:
|
188
|
+
|
189
|
+
stream = _io.TextIOWrapper(target, newline="\r\n")
|
190
|
+
formatter = PlainFormatter()
|
191
|
+
|
192
|
+
handler = StreamHandler(stream)
|
193
|
+
handler.setFormatter(formatter)
|
194
|
+
|
195
|
+
return JobLogProvider(handler)
|
@@ -25,11 +25,12 @@ import tracdap.rt.metadata as _meta
|
|
25
25
|
import tracdap.rt.config as _cfg
|
26
26
|
import tracdap.rt.exceptions as _ex
|
27
27
|
|
28
|
-
import tracdap.rt._impl.
|
29
|
-
import tracdap.rt._impl.repos as _repos
|
30
|
-
import tracdap.rt._impl.shim as _shim
|
31
|
-
import tracdap.rt._impl.
|
32
|
-
import tracdap.rt._impl.
|
28
|
+
import tracdap.rt._impl.core.logging as _logging
|
29
|
+
import tracdap.rt._impl.core.repos as _repos
|
30
|
+
import tracdap.rt._impl.core.shim as _shim
|
31
|
+
import tracdap.rt._impl.core.type_system as _types
|
32
|
+
import tracdap.rt._impl.core.util as _util
|
33
|
+
import tracdap.rt._impl.core.validation as _val
|
33
34
|
|
34
35
|
|
35
36
|
class ModelLoader:
|
@@ -43,7 +44,7 @@ class ModelLoader:
|
|
43
44
|
|
44
45
|
def __init__(self, sys_config: _cfg.RuntimeConfig, scratch_dir: pathlib.Path):
|
45
46
|
|
46
|
-
self.__log =
|
47
|
+
self.__log = _logging.logger_for_object(self)
|
47
48
|
|
48
49
|
self.__scratch_dir = scratch_dir.joinpath("models")
|
49
50
|
self.__repos = _repos.RepositoryManager(sys_config)
|
@@ -13,10 +13,12 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
+
import typing as _tp
|
17
|
+
|
16
18
|
import tracdap.rt.ext.plugins as plugins
|
17
19
|
import tracdap.rt.config as cfg
|
18
20
|
import tracdap.rt.exceptions as ex
|
19
|
-
import tracdap.rt._impl.
|
21
|
+
import tracdap.rt._impl.core.logging as _logging
|
20
22
|
|
21
23
|
# Import repo interfaces
|
22
24
|
from tracdap.rt.ext.repos import *
|
@@ -26,8 +28,8 @@ class RepositoryManager:
|
|
26
28
|
|
27
29
|
def __init__(self, sys_config: cfg.RuntimeConfig):
|
28
30
|
|
29
|
-
self._log =
|
30
|
-
self._repos:
|
31
|
+
self._log = _logging.logger_for_object(self)
|
32
|
+
self._repos: _tp.Dict[str, IModelRepository] = dict()
|
31
33
|
|
32
34
|
# Initialize all repos in the system config
|
33
35
|
# Any errors for missing repo types (plugins) will be raised during startup
|
@@ -21,10 +21,10 @@ import pyarrow as pa
|
|
21
21
|
|
22
22
|
import tracdap.rt.metadata as _meta
|
23
23
|
import tracdap.rt.exceptions as _ex
|
24
|
-
import tracdap.rt._impl.data as _data
|
25
|
-
import tracdap.rt._impl.
|
26
|
-
import tracdap.rt._impl.
|
27
|
-
import tracdap.rt._impl.
|
24
|
+
import tracdap.rt._impl.core.data as _data
|
25
|
+
import tracdap.rt._impl.core.logging as _log
|
26
|
+
import tracdap.rt._impl.core.storage as _storage
|
27
|
+
import tracdap.rt._impl.core.shim as _shim
|
28
28
|
|
29
29
|
|
30
30
|
class SchemaLoader:
|
@@ -169,4 +169,4 @@ class SchemaLoader:
|
|
169
169
|
raise _ex.EDataConformance(err)
|
170
170
|
|
171
171
|
|
172
|
-
SchemaLoader._log =
|
172
|
+
SchemaLoader._log = _log.logger_for_class(SchemaLoader)
|
@@ -30,8 +30,9 @@ import importlib.machinery as _ilm
|
|
30
30
|
import importlib.resources as _ilr
|
31
31
|
|
32
32
|
import tracdap.rt.exceptions as _ex
|
33
|
-
import tracdap.rt._impl.guard_rails as _guard
|
34
|
-
import tracdap.rt._impl.
|
33
|
+
import tracdap.rt._impl.core.guard_rails as _guard
|
34
|
+
import tracdap.rt._impl.core.logging as _log
|
35
|
+
import tracdap.rt._impl.core.util as _util
|
35
36
|
|
36
37
|
|
37
38
|
class _Shim:
|
@@ -138,7 +139,7 @@ class _NamespaceShimFinder(_ila.MetaPathFinder):
|
|
138
139
|
def __init__(self, shim_map: tp.Dict[str, _Shim], active_shim: _ActiveShim):
|
139
140
|
self.__shim_map = shim_map
|
140
141
|
self.__active_shim = active_shim
|
141
|
-
self._log =
|
142
|
+
self._log = _log.logger_for_class(ShimLoader)
|
142
143
|
|
143
144
|
def find_spec(
|
144
145
|
self, fullname: str,
|
@@ -561,5 +562,5 @@ class ShimLoader:
|
|
561
562
|
raise _ex.ERuntimeValidation(err)
|
562
563
|
|
563
564
|
|
564
|
-
ShimLoader._log =
|
565
|
+
ShimLoader._log = _log.logger_for_class(ShimLoader)
|
565
566
|
ShimLoader._init() # noqa
|
@@ -29,9 +29,10 @@ import tracdap.rt.metadata as _meta
|
|
29
29
|
import tracdap.rt.config as _cfg
|
30
30
|
import tracdap.rt.exceptions as _ex
|
31
31
|
import tracdap.rt.ext.plugins as plugins
|
32
|
-
import tracdap.rt._impl.data as _data
|
33
|
-
import tracdap.rt._impl.
|
34
|
-
import tracdap.rt._impl.
|
32
|
+
import tracdap.rt._impl.core.data as _data
|
33
|
+
import tracdap.rt._impl.core.logging as _logging
|
34
|
+
import tracdap.rt._impl.core.util as _util
|
35
|
+
import tracdap.rt._impl.core.validation as _val
|
35
36
|
|
36
37
|
# Import storage interfaces (using the internal version, it has extra bits that are not public)
|
37
38
|
from tracdap.rt._impl.ext.storage import *
|
@@ -76,7 +77,7 @@ class StorageManager:
|
|
76
77
|
|
77
78
|
def __init__(self, sys_config: _cfg.RuntimeConfig):
|
78
79
|
|
79
|
-
self.__log =
|
80
|
+
self.__log = _logging.logger_for_object(self)
|
80
81
|
self.__file_storage: tp.Dict[str, IFileStorage] = dict()
|
81
82
|
self.__data_storage: tp.Dict[str, IDataStorage] = dict()
|
82
83
|
self.__external: tp.List[str] = list()
|
@@ -224,7 +225,7 @@ class CommonFileStorage(IFileStorage):
|
|
224
225
|
|
225
226
|
def __init__(self, storage_key: str, storage_config: _cfg.PluginConfig, fs: pa_fs.SubTreeFileSystem):
|
226
227
|
|
227
|
-
self._log =
|
228
|
+
self._log = _logging.logger_for_object(self)
|
228
229
|
self._key = storage_key
|
229
230
|
self._config = storage_config
|
230
231
|
self._fs = fs
|
@@ -731,7 +732,7 @@ class CommonDataStorage(IDataStorage):
|
|
731
732
|
self, config: _cfg.PluginConfig, file_storage: IFileStorage,
|
732
733
|
pushdown_pandas: bool = False, pushdown_spark: bool = False):
|
733
734
|
|
734
|
-
self.__log =
|
735
|
+
self.__log = _logging.logger_for_object(self)
|
735
736
|
|
736
737
|
self.__config = config
|
737
738
|
self.__file_storage = file_storage
|
@@ -14,11 +14,9 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
16
|
import datetime as dt
|
17
|
-
import logging
|
18
17
|
import pathlib
|
19
18
|
import platform
|
20
19
|
|
21
|
-
import sys
|
22
20
|
import typing as tp
|
23
21
|
import uuid
|
24
22
|
|
@@ -38,114 +36,6 @@ def is_windows():
|
|
38
36
|
return __IS_WINDOWS
|
39
37
|
|
40
38
|
|
41
|
-
class ColorFormatter(logging.Formatter):
|
42
|
-
|
43
|
-
_BLACK, _RED, _GREEN, _YELLOW, _BLUE, _MAGENTA, _CYAN, _WHITE, _DEFAULT_WHITE = range(9)
|
44
|
-
_DARK_BASE = 30
|
45
|
-
_LIGHT_BASE = 90
|
46
|
-
|
47
|
-
# DARK_BASE + WHITE = light grey
|
48
|
-
# DARK_BASE + DEFAULT_WHITE = regular console white
|
49
|
-
# LIGHT_BASE + WHITE = bright white (0xffffff), very bright!
|
50
|
-
|
51
|
-
def __init__(self, is_bright: bool):
|
52
|
-
|
53
|
-
super().__init__(self._base_fmt(is_bright))
|
54
|
-
self._level_colors = self._make_level_colors(is_bright)
|
55
|
-
self._default_color = self._make_default_color(is_bright)
|
56
|
-
|
57
|
-
def format(self, record):
|
58
|
-
|
59
|
-
level_name = record.levelname
|
60
|
-
level_color = self._level_colors.get(level_name)
|
61
|
-
|
62
|
-
if level_color:
|
63
|
-
record.levelname = level_color
|
64
|
-
else:
|
65
|
-
record.levelname = self._default_color + level_name
|
66
|
-
|
67
|
-
return logging.Formatter.format(self, record)
|
68
|
-
|
69
|
-
def _base_fmt(self, is_bright: bool):
|
70
|
-
|
71
|
-
if is_bright:
|
72
|
-
base_color = self._make_ansi_code(self._DARK_BASE, self._DEFAULT_WHITE, is_bold=False)
|
73
|
-
message_color = self._make_ansi_code(self._LIGHT_BASE, self._CYAN, is_bold=False)
|
74
|
-
else:
|
75
|
-
base_color = self._make_ansi_code(self._DARK_BASE, self._WHITE, is_bold=False)
|
76
|
-
message_color = self._make_ansi_code(self._DARK_BASE, self._CYAN, is_bold=False)
|
77
|
-
|
78
|
-
return f"{base_color}%(asctime)s [%(threadName)s] %(levelname)s{base_color} %(name)s" + \
|
79
|
-
f" - {message_color}%(message)s"
|
80
|
-
|
81
|
-
def _make_level_colors(self, is_bright: bool):
|
82
|
-
|
83
|
-
base_code = self._LIGHT_BASE if is_bright else self._DARK_BASE
|
84
|
-
|
85
|
-
green = self._make_ansi_code(base_code, self._GREEN, is_bold=is_bright)
|
86
|
-
yellow = self._make_ansi_code(base_code, self._YELLOW, is_bold=is_bright)
|
87
|
-
red = self._make_ansi_code(base_code, self._RED, is_bold=is_bright)
|
88
|
-
|
89
|
-
level_colors = {
|
90
|
-
'CRITICAL': f"{red}CRITICAL",
|
91
|
-
'ERROR': f"{red}ERROR",
|
92
|
-
'WARNING': f"{yellow}WARNING",
|
93
|
-
'INFO': f"{green}INFO"
|
94
|
-
}
|
95
|
-
|
96
|
-
return level_colors
|
97
|
-
|
98
|
-
def _make_default_color(self, is_bright: bool):
|
99
|
-
|
100
|
-
base_code = self._LIGHT_BASE if is_bright else self._DARK_BASE
|
101
|
-
blue = self._make_ansi_code(base_code, self._BLUE, is_bold=is_bright)
|
102
|
-
|
103
|
-
return blue
|
104
|
-
|
105
|
-
@classmethod
|
106
|
-
def _make_ansi_code(cls, base_code: int, color_offset: int, is_bold: bool):
|
107
|
-
return f"\033[{1 if is_bold else 0};{base_code + color_offset}m"
|
108
|
-
|
109
|
-
|
110
|
-
def configure_logging(enable_debug=False):
|
111
|
-
|
112
|
-
root_logger = logging.getLogger()
|
113
|
-
log_level = logging.DEBUG if enable_debug else logging.INFO
|
114
|
-
|
115
|
-
if not root_logger.hasHandlers():
|
116
|
-
|
117
|
-
console_formatter = ColorFormatter(is_bright=True)
|
118
|
-
console_handler = logging.StreamHandler(sys.stdout)
|
119
|
-
console_handler.setFormatter(console_formatter)
|
120
|
-
console_handler.setLevel(logging.INFO)
|
121
|
-
root_logger.addHandler(console_handler)
|
122
|
-
root_logger.setLevel(log_level)
|
123
|
-
|
124
|
-
# Use is_bright=False for logs from the TRAC runtime, so model logs stand out
|
125
|
-
|
126
|
-
trac_logger = logging.getLogger("tracdap.rt")
|
127
|
-
|
128
|
-
console_formatter = ColorFormatter(is_bright=False)
|
129
|
-
console_handler = logging.StreamHandler(sys.stdout)
|
130
|
-
console_handler.setFormatter(console_formatter)
|
131
|
-
console_handler.setLevel(log_level)
|
132
|
-
trac_logger.addHandler(console_handler)
|
133
|
-
trac_logger.propagate = False
|
134
|
-
|
135
|
-
|
136
|
-
def logger_for_object(obj: object) -> logging.Logger:
|
137
|
-
return logger_for_class(obj.__class__)
|
138
|
-
|
139
|
-
|
140
|
-
def logger_for_class(clazz: type) -> logging.Logger:
|
141
|
-
qualified_class_name = f"{clazz.__module__}.{clazz.__name__}"
|
142
|
-
return logging.getLogger(qualified_class_name)
|
143
|
-
|
144
|
-
|
145
|
-
def logger_for_namespace(namespace: str) -> logging.Logger:
|
146
|
-
return logging.getLogger(namespace)
|
147
|
-
|
148
|
-
|
149
39
|
def format_file_size(size: int) -> str:
|
150
40
|
|
151
41
|
if size < 1024:
|
@@ -22,7 +22,8 @@ import pathlib
|
|
22
22
|
|
23
23
|
import tracdap.rt.metadata as meta
|
24
24
|
import tracdap.rt.exceptions as ex
|
25
|
-
import tracdap.rt._impl.
|
25
|
+
import tracdap.rt._impl.core.logging as log
|
26
|
+
import tracdap.rt._impl.core.util as util
|
26
27
|
|
27
28
|
# _Named placeholder type from API hook is needed for API type checking
|
28
29
|
from tracdap.rt.api.hook import _Named # noqa
|
@@ -74,7 +75,7 @@ class _TypeValidator:
|
|
74
75
|
# Inspecting a function signature can take ~ half a second in Python 3.7
|
75
76
|
__method_cache: tp.Dict[str, tp.Tuple[inspect.Signature, tp.Any]] = dict()
|
76
77
|
|
77
|
-
_log: logging.Logger =
|
78
|
+
_log: logging.Logger = log.logger_for_namespace(__name__)
|
78
79
|
|
79
80
|
@classmethod
|
80
81
|
def validate_signature(cls, method: tp.Callable, *args, **kwargs):
|
@@ -324,7 +325,7 @@ class StaticValidator:
|
|
324
325
|
meta.BasicType.INTEGER,
|
325
326
|
meta.BasicType.DATE]
|
326
327
|
|
327
|
-
_log: logging.Logger =
|
328
|
+
_log: logging.Logger = log.logger_for_namespace(__name__)
|
328
329
|
|
329
330
|
@classmethod
|
330
331
|
def is_primitive_type(cls, basic_type: meta.BasicType) -> bool:
|