tracdap-runtime 0.7.1__py3-none-any.whl → 0.8.0__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/_impl/core/__init__.py +14 -0
- tracdap/rt/_impl/{config_parser.py → core/config_parser.py} +36 -19
- tracdap/rt/_impl/{data.py → core/data.py} +136 -32
- tracdap/rt/_impl/core/logging.py +195 -0
- tracdap/rt/_impl/{models.py → core/models.py} +15 -12
- tracdap/rt/_impl/{repos.py → core/repos.py} +12 -3
- tracdap/rt/_impl/{schemas.py → core/schemas.py} +5 -5
- tracdap/rt/_impl/{shim.py → core/shim.py} +5 -4
- tracdap/rt/_impl/{storage.py → core/storage.py} +21 -10
- tracdap/rt/_impl/core/struct.py +547 -0
- tracdap/rt/_impl/{util.py → core/util.py} +1 -111
- tracdap/rt/_impl/{validation.py → core/validation.py} +99 -31
- tracdap/rt/_impl/exec/__init__.py +14 -0
- tracdap/rt/{_exec → _impl/exec}/actors.py +12 -14
- tracdap/rt/{_exec → _impl/exec}/context.py +228 -82
- tracdap/rt/{_exec → _impl/exec}/dev_mode.py +163 -81
- tracdap/rt/{_exec → _impl/exec}/engine.py +230 -105
- tracdap/rt/{_exec → _impl/exec}/functions.py +191 -100
- tracdap/rt/{_exec → _impl/exec}/graph.py +24 -36
- tracdap/rt/{_exec → _impl/exec}/graph_builder.py +252 -115
- tracdap/rt/_impl/grpc/codec.py +1 -1
- tracdap/rt/{_exec → _impl/grpc}/server.py +7 -6
- tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.py +3 -3
- tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2_grpc.py +1 -1
- tracdap/rt/_impl/grpc/tracdap/metadata/common_pb2.py +1 -1
- tracdap/rt/_impl/grpc/tracdap/metadata/config_pb2.py +40 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/config_pb2.pyi +62 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/custom_pb2.py +1 -1
- tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.py +32 -20
- tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.pyi +48 -2
- tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.py +4 -2
- tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.pyi +8 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/flow_pb2.py +1 -1
- tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.py +65 -63
- tracdap/rt/_impl/grpc/tracdap/metadata/job_pb2.pyi +16 -2
- tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.py +28 -26
- tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.pyi +14 -4
- tracdap/rt/_impl/grpc/tracdap/metadata/object_id_pb2.py +4 -4
- tracdap/rt/_impl/grpc/tracdap/metadata/object_id_pb2.pyi +6 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.py +9 -7
- tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.pyi +12 -4
- tracdap/rt/_impl/grpc/tracdap/metadata/resource_pb2.py +18 -5
- tracdap/rt/_impl/grpc/tracdap/metadata/resource_pb2.pyi +42 -2
- tracdap/rt/_impl/grpc/tracdap/metadata/search_pb2.py +1 -1
- tracdap/rt/_impl/grpc/tracdap/metadata/{stoarge_pb2.py → storage_pb2.py} +4 -4
- tracdap/rt/_impl/grpc/tracdap/metadata/tag_pb2.py +1 -1
- tracdap/rt/_impl/grpc/tracdap/metadata/tag_update_pb2.py +1 -1
- tracdap/rt/_impl/grpc/tracdap/metadata/type_pb2.py +1 -1
- tracdap/rt/{_exec → _impl}/runtime.py +32 -18
- tracdap/rt/_impl/static_api.py +65 -37
- tracdap/rt/_plugins/format_csv.py +1 -1
- tracdap/rt/_plugins/repo_git.py +56 -11
- tracdap/rt/_plugins/storage_sql.py +1 -1
- tracdap/rt/_version.py +1 -1
- tracdap/rt/api/__init__.py +5 -24
- tracdap/rt/api/constants.py +57 -0
- tracdap/rt/api/experimental.py +32 -0
- tracdap/rt/api/hook.py +26 -7
- tracdap/rt/api/model_api.py +16 -0
- tracdap/rt/api/static_api.py +265 -127
- tracdap/rt/config/__init__.py +11 -11
- tracdap/rt/config/common.py +2 -26
- tracdap/rt/config/dynamic.py +28 -0
- tracdap/rt/config/platform.py +17 -31
- tracdap/rt/config/runtime.py +2 -0
- tracdap/rt/ext/embed.py +2 -2
- tracdap/rt/ext/plugins.py +3 -3
- tracdap/rt/launch/launch.py +12 -14
- tracdap/rt/metadata/__init__.py +28 -18
- tracdap/rt/metadata/config.py +95 -0
- tracdap/rt/metadata/data.py +40 -0
- tracdap/rt/metadata/file.py +10 -0
- tracdap/rt/metadata/job.py +16 -0
- tracdap/rt/metadata/model.py +12 -2
- tracdap/rt/metadata/object.py +9 -1
- tracdap/rt/metadata/object_id.py +6 -0
- tracdap/rt/metadata/resource.py +41 -1
- {tracdap_runtime-0.7.1.dist-info → tracdap_runtime-0.8.0.dist-info}/METADATA +23 -17
- tracdap_runtime-0.8.0.dist-info/RECORD +129 -0
- {tracdap_runtime-0.7.1.dist-info → tracdap_runtime-0.8.0.dist-info}/WHEEL +1 -1
- tracdap/rt/_exec/__init__.py +0 -0
- tracdap_runtime-0.7.1.dist-info/RECORD +0 -121
- /tracdap/rt/_impl/{guard_rails.py → core/guard_rails.py} +0 -0
- /tracdap/rt/_impl/{type_system.py → core/type_system.py} +0 -0
- /tracdap/rt/_impl/grpc/tracdap/metadata/{stoarge_pb2.pyi → storage_pb2.pyi} +0 -0
- /tracdap/rt/metadata/{stoarge.py → storage.py} +0 -0
- {tracdap_runtime-0.7.1.dist-info → tracdap_runtime-0.8.0.dist-info/licenses}/LICENSE +0 -0
- {tracdap_runtime-0.7.1.dist-info → tracdap_runtime-0.8.0.dist-info}/top_level.txt +0 -0
tracdap/rt/api/static_api.py
CHANGED
@@ -162,35 +162,6 @@ def define_parameter(
|
|
162
162
|
return sa.define_parameter(param_name, param_type, label, default_value, param_props=param_props)
|
163
163
|
|
164
164
|
|
165
|
-
def declare_parameter(
|
166
|
-
param_name: str,
|
167
|
-
param_type: _tp.Union[BasicType, TypeDescriptor],
|
168
|
-
label: str,
|
169
|
-
default_value: _tp.Optional[_tp.Any] = None) \
|
170
|
-
-> _Named[ModelParameter]:
|
171
|
-
|
172
|
-
"""
|
173
|
-
.. deprecated:: 0.4.4
|
174
|
-
Use :py:func:`define_parameter` or :py:func:`P` instead.
|
175
|
-
|
176
|
-
This function is deprecated and will be removed in a future version.
|
177
|
-
Please use :py:func:`define_parameter() <tracdap.rt.api.define_parameter>` instead.
|
178
|
-
|
179
|
-
:type param_name: str
|
180
|
-
:type param_type: :py:class:`BasicType <tracdap.rt.metadata.BasicType>` |
|
181
|
-
:py:class:`TypeDescriptor <tracdap.rt.metadata.TypeDescriptor>`
|
182
|
-
|
183
|
-
:type label: str
|
184
|
-
:type default_value: Any | None
|
185
|
-
:rtype: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
|
186
|
-
|
187
|
-
:display: False
|
188
|
-
"""
|
189
|
-
|
190
|
-
print("TRAC Warning: declare_parameter() is deprecated, please use define_parameter()", file=sys.stderr)
|
191
|
-
|
192
|
-
return define_parameter(param_name, param_type, label, default_value)
|
193
|
-
|
194
165
|
|
195
166
|
def P( # noqa
|
196
167
|
param_name: str,
|
@@ -241,29 +212,6 @@ def define_parameters(
|
|
241
212
|
return sa.define_parameters(*parameters)
|
242
213
|
|
243
214
|
|
244
|
-
def declare_parameters(
|
245
|
-
*params: _tp.Union[_Named[ModelParameter], _tp.List[_Named[ModelParameter]]]) \
|
246
|
-
-> _tp.Dict[str, ModelParameter]:
|
247
|
-
|
248
|
-
"""
|
249
|
-
.. deprecated:: 0.4.4
|
250
|
-
Use :py:func:`define_parameters` instead
|
251
|
-
|
252
|
-
This function is deprecated and will be removed in a future version.
|
253
|
-
Please use :py:func:`define_parameters() <tracdap.rt.api.define_parameters>` instead.
|
254
|
-
|
255
|
-
:type params: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`] |
|
256
|
-
List[_Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]]
|
257
|
-
:rtype: Dict[str, :py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
|
258
|
-
|
259
|
-
:display: False
|
260
|
-
"""
|
261
|
-
|
262
|
-
print("TRAC Warning: declare_parameters() is deprecated, please use define_parameters()", file=sys.stderr)
|
263
|
-
|
264
|
-
return define_parameters(*params)
|
265
|
-
|
266
|
-
|
267
215
|
def define_field(
|
268
216
|
field_name: str,
|
269
217
|
field_type: BasicType,
|
@@ -324,45 +272,6 @@ def define_field(
|
|
324
272
|
format_code, field_order)
|
325
273
|
|
326
274
|
|
327
|
-
def declare_field(
|
328
|
-
field_name: str,
|
329
|
-
field_type: BasicType,
|
330
|
-
label: str,
|
331
|
-
business_key: bool = False,
|
332
|
-
categorical: bool = False,
|
333
|
-
not_null: _tp.Optional[bool] = None,
|
334
|
-
format_code: _tp.Optional[str] = None,
|
335
|
-
field_order: _tp.Optional[int] = None) \
|
336
|
-
-> FieldSchema:
|
337
|
-
|
338
|
-
"""
|
339
|
-
.. deprecated:: 0.4.4
|
340
|
-
Use :py:func:`define_field` or :py:func:`F` instead.
|
341
|
-
|
342
|
-
This function is deprecated and will be removed in a future version.
|
343
|
-
Please use :py:func:`define_field() <tracdap.rt.api.define_field>` instead.
|
344
|
-
|
345
|
-
:type field_name: str
|
346
|
-
:type field_type: :py:class:`BasicType <tracdap.rt.metadata.BasicType>`
|
347
|
-
:type label: str
|
348
|
-
:type business_key: bool
|
349
|
-
:type categorical: bool
|
350
|
-
:type not_null: bool | None
|
351
|
-
:type format_code: str | None
|
352
|
-
:type field_order: int | None
|
353
|
-
:rtype: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`
|
354
|
-
|
355
|
-
:display: False
|
356
|
-
"""
|
357
|
-
|
358
|
-
print("TRAC Warning: declare_field() is deprecated, please use define_field()", file=sys.stderr)
|
359
|
-
|
360
|
-
return define_field(
|
361
|
-
field_name, field_type, label,
|
362
|
-
business_key, categorical, not_null,
|
363
|
-
format_code, field_order)
|
364
|
-
|
365
|
-
|
366
275
|
def F( # noqa
|
367
276
|
field_name: str,
|
368
277
|
field_type: BasicType,
|
@@ -396,7 +305,7 @@ def F( # noqa
|
|
396
305
|
|
397
306
|
def define_schema(
|
398
307
|
*fields: _tp.Union[FieldSchema, _tp.List[FieldSchema]],
|
399
|
-
schema_type: SchemaType = SchemaType.TABLE) \
|
308
|
+
schema_type: SchemaType = SchemaType.TABLE, dynamic: bool = False) \
|
400
309
|
-> SchemaDefinition:
|
401
310
|
|
402
311
|
"""
|
@@ -416,16 +325,18 @@ def define_schema(
|
|
416
325
|
|
417
326
|
:param fields: The list of fields to include in the schema
|
418
327
|
:param schema_type: The type of schema to create (currently only TABLE schemas are supported)
|
328
|
+
:param dynamic: Define a dynamic schema (fields list should be empty)
|
419
329
|
:return: A schema definition built from the supplied fields
|
420
330
|
|
421
331
|
:type fields: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>` |
|
422
332
|
List[:py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`]
|
423
333
|
:type schema_type: :py:class:`SchemaType <tracdap.rt.metadata.SchemaType>`
|
334
|
+
:type dynamic: bool
|
424
335
|
:rtype: :py:class:`SchemaDefinition <tracdap.rt.metadata.SchemaDefinition>`
|
425
336
|
"""
|
426
337
|
|
427
338
|
sa = _StaticApiHook.get_instance()
|
428
|
-
return sa.define_schema(*fields, schema_type=schema_type)
|
339
|
+
return sa.define_schema(*fields, schema_type=schema_type, dynamic=dynamic)
|
429
340
|
|
430
341
|
|
431
342
|
def load_schema(
|
@@ -471,6 +382,62 @@ def load_schema(
|
|
471
382
|
return sa.load_schema(package, schema_file, schema_type=schema_type)
|
472
383
|
|
473
384
|
|
385
|
+
def define_file_type(extension: str, mime_type: str) -> FileType:
|
386
|
+
|
387
|
+
"""
|
388
|
+
Define a :py:class:`FileType <tracdap.rt.metadata.FileType>` for use as a model input or output
|
389
|
+
|
390
|
+
:type extension: str
|
391
|
+
:type mime_type: str
|
392
|
+
:rtype: :py:class:`FileType <tracdap.rt.metadata.FileType>`
|
393
|
+
"""
|
394
|
+
|
395
|
+
sa = _StaticApiHook.get_instance()
|
396
|
+
return sa.define_file_type(extension, mime_type)
|
397
|
+
|
398
|
+
|
399
|
+
def define_input(
|
400
|
+
requirement: _tp.Union[SchemaDefinition, FileType], *,
|
401
|
+
label: _tp.Optional[str] = None,
|
402
|
+
optional: bool = False, dynamic: bool = False,
|
403
|
+
input_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None):
|
404
|
+
|
405
|
+
"""
|
406
|
+
Define a model input, which can be any type of dataset or file
|
407
|
+
|
408
|
+
:type requirement: :py:class:`SchemaDefinition <tracdap.rt.metadata.SchemaDefinition>` | :py:class:`FileType <tracdap.rt.metadata.FileType>`
|
409
|
+
:type label: str | None
|
410
|
+
:type optional: bool
|
411
|
+
:type dynamic: bool
|
412
|
+
:type input_props: dict[str, :py:class:`Value <tracdap.rt.metadata.Value>`
|
413
|
+
:rtype: :py:class:`ModelInputSchema <tracdap.rt.metadata.ModelInputSchema>`
|
414
|
+
"""
|
415
|
+
|
416
|
+
sa = _StaticApiHook.get_instance()
|
417
|
+
return sa.define_input(requirement, label=label, optional=optional, dynamic=dynamic, input_props=input_props)
|
418
|
+
|
419
|
+
|
420
|
+
def define_output(
|
421
|
+
requirement: _tp.Union[SchemaDefinition, FileType], *,
|
422
|
+
label: _tp.Optional[str] = None,
|
423
|
+
optional: bool = False, dynamic: bool = False,
|
424
|
+
output_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None):
|
425
|
+
|
426
|
+
"""
|
427
|
+
Define a model output, which can be any type of dataset or file
|
428
|
+
|
429
|
+
:type requirement: :py:class:`SchemaDefinition <tracdap.rt.metadata.SchemaDefinition>` | :py:class:`FileType <tracdap.rt.metadata.FileType>`
|
430
|
+
:type label: str | None
|
431
|
+
:type optional: bool
|
432
|
+
:type dynamic: bool
|
433
|
+
:type output_props: dict[str, :py:class:`Value <tracdap.rt.metadata.Value>`
|
434
|
+
:rtype: :py:class:`ModelOutputSchema <tracdap.rt.metadata.ModelOutputSchema>`
|
435
|
+
"""
|
436
|
+
|
437
|
+
sa = _StaticApiHook.get_instance()
|
438
|
+
return sa.define_output(requirement, label=label, optional=optional, dynamic=dynamic, output_props=output_props)
|
439
|
+
|
440
|
+
|
474
441
|
def define_input_table(
|
475
442
|
*fields: _tp.Union[FieldSchema, _tp.List[FieldSchema]],
|
476
443
|
label: _tp.Optional[str] = None, optional: bool = False, dynamic: bool = False,
|
@@ -478,7 +445,7 @@ def define_input_table(
|
|
478
445
|
-> ModelInputSchema:
|
479
446
|
|
480
447
|
"""
|
481
|
-
Define a model input
|
448
|
+
Define a model input for a :py:class:`TableSchema <tracdap.rt.metadata.TableSchema>`
|
482
449
|
|
483
450
|
Individual fields can be defined using :py:func:`define_field` or the shorthand alias :py:func:`F`.
|
484
451
|
This function takes a number of fields, either as individual arguments or as a list, and uses them
|
@@ -512,34 +479,8 @@ def define_input_table(
|
|
512
479
|
:rtype: :py:class:`ModelInputSchema <tracdap.rt.metadata.ModelInputSchema>`
|
513
480
|
"""
|
514
481
|
|
515
|
-
|
516
|
-
|
517
|
-
return sa.define_input_table(
|
518
|
-
*fields, label=label, optional=optional, dynamic=dynamic,
|
519
|
-
input_props=input_props)
|
520
|
-
|
521
|
-
|
522
|
-
def declare_input_table(
|
523
|
-
*fields: _tp.Union[FieldSchema, _tp.List[FieldSchema]]) \
|
524
|
-
-> ModelInputSchema:
|
525
|
-
|
526
|
-
"""
|
527
|
-
.. deprecated:: 0.4.4
|
528
|
-
Use :py:func:`define_input_table` instead.
|
529
|
-
|
530
|
-
This function is deprecated and will be removed in a future version.
|
531
|
-
Please use :py:func:`define_input_table() <tracdap.rt.api.define_input_table>` instead.
|
532
|
-
|
533
|
-
:type fields: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>` |
|
534
|
-
List[:py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`]
|
535
|
-
:rtype: :py:class:`ModelInputSchema <tracdap.rt.metadata.ModelInputSchema>`
|
536
|
-
|
537
|
-
:display: False
|
538
|
-
"""
|
539
|
-
|
540
|
-
print("TRAC Warning: declare_input_table() is deprecated, please use define_input_table()", file=sys.stderr)
|
541
|
-
|
542
|
-
return define_input_table(*fields)
|
482
|
+
schema = define_schema(*fields, schema_type=SchemaType.TABLE, dynamic=dynamic)
|
483
|
+
return define_input(schema, label=label, optional=optional, dynamic=dynamic, input_props=input_props)
|
543
484
|
|
544
485
|
|
545
486
|
def define_output_table(
|
@@ -549,7 +490,7 @@ def define_output_table(
|
|
549
490
|
-> ModelOutputSchema:
|
550
491
|
|
551
492
|
"""
|
552
|
-
Define a model output
|
493
|
+
Define a model output for a :py:class:`TableSchema <tracdap.rt.metadata.TableSchema>`
|
553
494
|
|
554
495
|
Individual fields can be defined using :py:func:`define_field` or the shorthand alias :py:func:`F`.
|
555
496
|
This function takes a number of fields, either as individual arguments or as a list, and uses them
|
@@ -581,11 +522,208 @@ def define_output_table(
|
|
581
522
|
:rtype: :py:class:`ModelOutputSchema <tracdap.rt.metadata.ModelOutputSchema>`
|
582
523
|
"""
|
583
524
|
|
584
|
-
|
525
|
+
schema = define_schema(*fields, schema_type=SchemaType.TABLE, dynamic=dynamic)
|
526
|
+
return define_output(schema, label=label, optional=optional, dynamic=dynamic, output_props=output_props)
|
527
|
+
|
528
|
+
|
529
|
+
def define_input_file(
|
530
|
+
extension: str, mime_type: str, *,
|
531
|
+
label: _tp.Optional[str] = None, optional: bool = False,
|
532
|
+
input_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
|
533
|
+
-> ModelInputSchema:
|
534
|
+
|
535
|
+
"""
|
536
|
+
Define a model input for a :py:class:`FileType <tracdap.rt.metadata.FileType>`
|
537
|
+
|
538
|
+
:type extension str
|
539
|
+
:type mime_type: sr
|
540
|
+
:type label: str | None
|
541
|
+
:type optional: bool
|
542
|
+
:type input_props: dict[str, Any] | None
|
543
|
+
:rtype: :py:class:`ModelInputSchema <tracdap.rt.metadata.ModelInputSchema>`
|
544
|
+
"""
|
545
|
+
|
546
|
+
file_type = define_file_type(extension, mime_type)
|
547
|
+
return define_input(file_type, label=label, optional=optional, input_props=input_props)
|
548
|
+
|
549
|
+
|
550
|
+
def define_output_file(
|
551
|
+
extension: str, mime_type: str, *,
|
552
|
+
label: _tp.Optional[str] = None, optional: bool = False,
|
553
|
+
output_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
|
554
|
+
-> ModelOutputSchema:
|
555
|
+
|
556
|
+
"""
|
557
|
+
Define a model output for a :py:class:`FileType <tracdap.rt.metadata.FileType>`
|
558
|
+
|
559
|
+
:type extension str
|
560
|
+
:type mime_type: sr
|
561
|
+
:type label: str | None
|
562
|
+
:type optional: bool
|
563
|
+
:type output_props: dict[str, Any] | None
|
564
|
+
:rtype: :py:class:`ModelOutputSchema <tracdap.rt.metadata.ModelOutputSchema>`
|
565
|
+
"""
|
566
|
+
|
567
|
+
file_type = define_file_type(extension, mime_type)
|
568
|
+
return define_output(file_type, label=label, optional=optional, output_props=output_props)
|
569
|
+
|
570
|
+
|
571
|
+
def ModelInputSchema( # noqa
|
572
|
+
schema: SchemaDefinition,
|
573
|
+
label: _tp.Optional[str] = None,
|
574
|
+
optional: bool = False,
|
575
|
+
dynamic: bool = False,
|
576
|
+
inputProps: _tp.Optional[_tp.Dict[str, Value]] = None): # noqa
|
577
|
+
|
578
|
+
"""
|
579
|
+
.. deprecated:: 0.8.0
|
580
|
+
Use :py:func:`define_input` instead.
|
581
|
+
|
582
|
+
This function is provided for compatibility with TRAC versions before 0.8.0.
|
583
|
+
Please use :py:func:`define_input() <tracdap.rt.api.define_input>` instead.
|
584
|
+
|
585
|
+
:display: False
|
586
|
+
"""
|
587
|
+
|
588
|
+
input_props = inputProps or dict()
|
589
|
+
return define_input(schema, label=label, optional=optional, dynamic=dynamic, input_props=input_props)
|
590
|
+
|
591
|
+
|
592
|
+
def ModelOutputSchema( # noqa
|
593
|
+
schema: SchemaDefinition,
|
594
|
+
label: _tp.Optional[str] = None,
|
595
|
+
optional: bool = False,
|
596
|
+
dynamic: bool = False,
|
597
|
+
outputProps: _tp.Optional[_tp.Dict[str, Value]] = None): # noqa
|
598
|
+
|
599
|
+
"""
|
600
|
+
.. deprecated:: 0.8.0
|
601
|
+
Use :py:func:`define_output` instead.
|
602
|
+
|
603
|
+
This function is provided for compatibility with TRAC versions before 0.8.0.
|
604
|
+
Please use :py:func:`define_output() <tracdap.rt.api.define_output>` instead.
|
605
|
+
|
606
|
+
:display: False
|
607
|
+
"""
|
608
|
+
|
609
|
+
output_props = outputProps or dict()
|
610
|
+
return define_output(schema, label=label, optional=optional, dynamic=dynamic, output_props=output_props)
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
def declare_parameter(
|
615
|
+
param_name: str,
|
616
|
+
param_type: _tp.Union[BasicType, TypeDescriptor],
|
617
|
+
label: str,
|
618
|
+
default_value: _tp.Optional[_tp.Any] = None) \
|
619
|
+
-> _Named[ModelParameter]:
|
620
|
+
|
621
|
+
"""
|
622
|
+
.. deprecated:: 0.4.4
|
623
|
+
Use :py:func:`define_parameter` or :py:func:`P` instead.
|
624
|
+
|
625
|
+
This function is deprecated and will be removed in a future version.
|
626
|
+
Please use :py:func:`define_parameter() <tracdap.rt.api.define_parameter>` instead.
|
627
|
+
|
628
|
+
:type param_name: str
|
629
|
+
:type param_type: :py:class:`BasicType <tracdap.rt.metadata.BasicType>` |
|
630
|
+
:py:class:`TypeDescriptor <tracdap.rt.metadata.TypeDescriptor>`
|
631
|
+
|
632
|
+
:type label: str
|
633
|
+
:type default_value: Any | None
|
634
|
+
:rtype: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
|
635
|
+
|
636
|
+
:display: False
|
637
|
+
"""
|
638
|
+
|
639
|
+
print("TRAC Warning: declare_parameter() is deprecated, please use define_parameter()", file=sys.stderr)
|
640
|
+
|
641
|
+
return define_parameter(param_name, param_type, label, default_value)
|
642
|
+
|
643
|
+
|
644
|
+
def declare_parameters(
|
645
|
+
*params: _tp.Union[_Named[ModelParameter], _tp.List[_Named[ModelParameter]]]) \
|
646
|
+
-> _tp.Dict[str, ModelParameter]:
|
647
|
+
|
648
|
+
"""
|
649
|
+
.. deprecated:: 0.4.4
|
650
|
+
Use :py:func:`define_parameters` instead
|
651
|
+
|
652
|
+
This function is deprecated and will be removed in a future version.
|
653
|
+
Please use :py:func:`define_parameters() <tracdap.rt.api.define_parameters>` instead.
|
654
|
+
|
655
|
+
:type params: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`] |
|
656
|
+
List[_Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]]
|
657
|
+
:rtype: Dict[str, :py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
|
658
|
+
|
659
|
+
:display: False
|
660
|
+
"""
|
661
|
+
|
662
|
+
print("TRAC Warning: declare_parameters() is deprecated, please use define_parameters()", file=sys.stderr)
|
663
|
+
|
664
|
+
return define_parameters(*params)
|
665
|
+
|
585
666
|
|
586
|
-
|
587
|
-
|
588
|
-
|
667
|
+
def declare_field(
|
668
|
+
field_name: str,
|
669
|
+
field_type: BasicType,
|
670
|
+
label: str,
|
671
|
+
business_key: bool = False,
|
672
|
+
categorical: bool = False,
|
673
|
+
not_null: _tp.Optional[bool] = None,
|
674
|
+
format_code: _tp.Optional[str] = None,
|
675
|
+
field_order: _tp.Optional[int] = None) \
|
676
|
+
-> FieldSchema:
|
677
|
+
|
678
|
+
"""
|
679
|
+
.. deprecated:: 0.4.4
|
680
|
+
Use :py:func:`define_field` or :py:func:`F` instead.
|
681
|
+
|
682
|
+
This function is deprecated and will be removed in a future version.
|
683
|
+
Please use :py:func:`define_field() <tracdap.rt.api.define_field>` instead.
|
684
|
+
|
685
|
+
:type field_name: str
|
686
|
+
:type field_type: :py:class:`BasicType <tracdap.rt.metadata.BasicType>`
|
687
|
+
:type label: str
|
688
|
+
:type business_key: bool
|
689
|
+
:type categorical: bool
|
690
|
+
:type not_null: bool | None
|
691
|
+
:type format_code: str | None
|
692
|
+
:type field_order: int | None
|
693
|
+
:rtype: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`
|
694
|
+
|
695
|
+
:display: False
|
696
|
+
"""
|
697
|
+
|
698
|
+
print("TRAC Warning: declare_field() is deprecated, please use define_field()", file=sys.stderr)
|
699
|
+
|
700
|
+
return define_field(
|
701
|
+
field_name, field_type, label,
|
702
|
+
business_key, categorical, not_null,
|
703
|
+
format_code, field_order)
|
704
|
+
|
705
|
+
|
706
|
+
def declare_input_table(
|
707
|
+
*fields: _tp.Union[FieldSchema, _tp.List[FieldSchema]]) \
|
708
|
+
-> ModelInputSchema:
|
709
|
+
|
710
|
+
"""
|
711
|
+
.. deprecated:: 0.4.4
|
712
|
+
Use :py:func:`define_input_table` instead.
|
713
|
+
|
714
|
+
This function is deprecated and will be removed in a future version.
|
715
|
+
Please use :py:func:`define_input_table() <tracdap.rt.api.define_input_table>` instead.
|
716
|
+
|
717
|
+
:type fields: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>` |
|
718
|
+
List[:py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`]
|
719
|
+
:rtype: :py:class:`ModelInputSchema <tracdap.rt.metadata.ModelInputSchema>`
|
720
|
+
|
721
|
+
:display: False
|
722
|
+
"""
|
723
|
+
|
724
|
+
print("TRAC Warning: declare_input_table() is deprecated, please use define_input_table()", file=sys.stderr)
|
725
|
+
|
726
|
+
return define_input_table(*fields)
|
589
727
|
|
590
728
|
|
591
729
|
def declare_output_table(
|
tracdap/rt/config/__init__.py
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
# Code generated by TRAC
|
2
2
|
|
3
|
+
from .result import TagUpdateList
|
4
|
+
from .result import JobResult
|
5
|
+
|
3
6
|
from .common import _ConfigFile
|
4
7
|
from .common import PluginConfig
|
5
8
|
from .common import PlatformInfo
|
6
|
-
from .common import AuthenticationConfig
|
7
9
|
from .common import StorageConfig
|
8
10
|
from .common import ServiceConfig
|
9
11
|
|
10
|
-
from .runtime import RuntimeConfig
|
11
|
-
from .runtime import SparkSettings
|
12
|
-
|
13
|
-
from .job import JobConfig
|
14
|
-
|
15
12
|
from .platform import RoutingProtocol
|
16
13
|
from .platform import DeploymentLayout
|
17
14
|
from .platform import PlatformConfig
|
18
15
|
from .platform import MetadataConfig
|
19
16
|
from .platform import TenantConfig
|
20
|
-
from .platform import WebServerConfig
|
21
|
-
from .platform import WebServerRewriteRule
|
22
|
-
from .platform import WebServerRedirect
|
23
17
|
from .platform import GatewayConfig
|
18
|
+
from .platform import GatewayRedirect
|
24
19
|
from .platform import RouteConfig
|
25
20
|
from .platform import RoutingMatch
|
26
21
|
from .platform import RoutingTarget
|
27
22
|
from .platform import DeploymentConfig
|
23
|
+
from .platform import ClientConfig
|
28
24
|
|
29
|
-
from .
|
30
|
-
from .
|
25
|
+
from .runtime import RuntimeConfig
|
26
|
+
from .runtime import SparkSettings
|
27
|
+
|
28
|
+
from .job import JobConfig
|
29
|
+
|
30
|
+
from .dynamic import DynamicConfig
|
tracdap/rt/config/common.py
CHANGED
@@ -33,32 +33,6 @@ class PlatformInfo:
|
|
33
33
|
deploymentInfo: "_tp.Dict[str, str]" = _dc.field(default_factory=dict)
|
34
34
|
|
35
35
|
|
36
|
-
@_dc.dataclass
|
37
|
-
class AuthenticationConfig:
|
38
|
-
|
39
|
-
jwtIssuer: "str" = ""
|
40
|
-
|
41
|
-
jwtExpiry: "int" = 0
|
42
|
-
|
43
|
-
jwtLimit: "int" = 0
|
44
|
-
|
45
|
-
jwtRefresh: "int" = 0
|
46
|
-
|
47
|
-
provider: "_tp.Optional[PluginConfig]" = None
|
48
|
-
|
49
|
-
disableAuth: "bool" = False
|
50
|
-
|
51
|
-
disableSigning: "bool" = False
|
52
|
-
|
53
|
-
systemUserId: "str" = ""
|
54
|
-
|
55
|
-
systemUserName: "str" = ""
|
56
|
-
|
57
|
-
systemTicketDuration: "int" = 0
|
58
|
-
|
59
|
-
systemTicketRefresh: "int" = 0
|
60
|
-
|
61
|
-
|
62
36
|
@_dc.dataclass
|
63
37
|
class StorageConfig:
|
64
38
|
|
@@ -81,3 +55,5 @@ class ServiceConfig:
|
|
81
55
|
alias: "str" = ""
|
82
56
|
|
83
57
|
port: "int" = 0
|
58
|
+
|
59
|
+
properties: "_tp.Dict[str, str]" = _dc.field(default_factory=dict)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Code generated by TRAC
|
2
|
+
|
3
|
+
import typing as _tp # noqa
|
4
|
+
import dataclasses as _dc # noqa
|
5
|
+
import enum as _enum # noqa
|
6
|
+
|
7
|
+
import tracdap.rt.metadata as metadata
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
@_dc.dataclass
|
12
|
+
class DynamicConfig:
|
13
|
+
|
14
|
+
"""
|
15
|
+
Represent config that is normally held in the metadata store
|
16
|
+
|
17
|
+
This can be used to supply config to isolated processes, including
|
18
|
+
the runtime when operating in batch mode. It can also be used to
|
19
|
+
to supply config for testing or to bootstrap the metadata store.
|
20
|
+
"""
|
21
|
+
|
22
|
+
configClass: "str" = ""
|
23
|
+
|
24
|
+
resourceClass: "str" = ""
|
25
|
+
|
26
|
+
config: "_tp.Dict[str, metadata.ConfigDefinition]" = _dc.field(default_factory=dict)
|
27
|
+
|
28
|
+
resources: "_tp.Dict[str, metadata.ResourceDefinition]" = _dc.field(default_factory=dict)
|
tracdap/rt/config/platform.py
CHANGED
@@ -39,8 +39,6 @@ class PlatformConfig:
|
|
39
39
|
|
40
40
|
platformInfo: "PlatformInfo" = _dc.field(default_factory=lambda: PlatformInfo())
|
41
41
|
|
42
|
-
authentication: "AuthenticationConfig" = _dc.field(default_factory=lambda: AuthenticationConfig())
|
43
|
-
|
44
42
|
metadata: "MetadataConfig" = _dc.field(default_factory=lambda: MetadataConfig())
|
45
43
|
|
46
44
|
storage: "StorageConfig" = _dc.field(default_factory=lambda: StorageConfig())
|
@@ -53,14 +51,16 @@ class PlatformConfig:
|
|
53
51
|
|
54
52
|
tenants: "_tp.Dict[str, TenantConfig]" = _dc.field(default_factory=dict)
|
55
53
|
|
56
|
-
|
57
|
-
|
58
|
-
gateway: "_tp.Optional[GatewayConfig]" = None
|
54
|
+
gateway: "GatewayConfig" = _dc.field(default_factory=lambda: GatewayConfig())
|
59
55
|
|
60
56
|
services: "_tp.Dict[str, ServiceConfig]" = _dc.field(default_factory=dict)
|
61
57
|
|
62
58
|
deployment: "DeploymentConfig" = _dc.field(default_factory=lambda: DeploymentConfig())
|
63
59
|
|
60
|
+
clientConfig: "_tp.Dict[str, ClientConfig]" = _dc.field(default_factory=dict)
|
61
|
+
|
62
|
+
extensions: "_tp.Dict[str, protobuf.Any]" = _dc.field(default_factory=dict)
|
63
|
+
|
64
64
|
|
65
65
|
@_dc.dataclass
|
66
66
|
class MetadataConfig:
|
@@ -79,27 +79,15 @@ class TenantConfig:
|
|
79
79
|
|
80
80
|
|
81
81
|
@_dc.dataclass
|
82
|
-
class
|
83
|
-
|
84
|
-
enabled: "bool" = False
|
85
|
-
|
86
|
-
contentRoot: "PluginConfig" = _dc.field(default_factory=lambda: PluginConfig())
|
87
|
-
|
88
|
-
rewriteRules: "_tp.List[WebServerRewriteRule]" = _dc.field(default_factory=list)
|
89
|
-
|
90
|
-
redirects: "_tp.List[WebServerRedirect]" = _dc.field(default_factory=list)
|
91
|
-
|
92
|
-
|
93
|
-
@_dc.dataclass
|
94
|
-
class WebServerRewriteRule:
|
82
|
+
class GatewayConfig:
|
95
83
|
|
96
|
-
|
84
|
+
routes: "_tp.List[RouteConfig]" = _dc.field(default_factory=list)
|
97
85
|
|
98
|
-
|
86
|
+
redirects: "_tp.List[GatewayRedirect]" = _dc.field(default_factory=list)
|
99
87
|
|
100
88
|
|
101
89
|
@_dc.dataclass
|
102
|
-
class
|
90
|
+
class GatewayRedirect:
|
103
91
|
|
104
92
|
source: "str" = ""
|
105
93
|
|
@@ -108,16 +96,6 @@ class WebServerRedirect:
|
|
108
96
|
status: "int" = 0
|
109
97
|
|
110
98
|
|
111
|
-
@_dc.dataclass
|
112
|
-
class GatewayConfig:
|
113
|
-
|
114
|
-
idleTimeout: "int" = 0
|
115
|
-
|
116
|
-
routes: "_tp.List[RouteConfig]" = _dc.field(default_factory=list)
|
117
|
-
|
118
|
-
redirects: "_tp.List[WebServerRedirect]" = _dc.field(default_factory=list)
|
119
|
-
|
120
|
-
|
121
99
|
@_dc.dataclass
|
122
100
|
class RouteConfig:
|
123
101
|
|
@@ -151,8 +129,16 @@ class RoutingTarget:
|
|
151
129
|
|
152
130
|
path: "str" = ""
|
153
131
|
|
132
|
+
hostAlias: "_tp.Optional[str]" = None
|
133
|
+
|
154
134
|
|
155
135
|
@_dc.dataclass
|
156
136
|
class DeploymentConfig:
|
157
137
|
|
158
138
|
layout: "DeploymentLayout" = DeploymentLayout.LAYOUT_NOT_SET
|
139
|
+
|
140
|
+
|
141
|
+
@_dc.dataclass
|
142
|
+
class ClientConfig:
|
143
|
+
|
144
|
+
properties: "_tp.Dict[str, str]" = _dc.field(default_factory=dict)
|
tracdap/rt/config/runtime.py
CHANGED
tracdap/rt/ext/embed.py
CHANGED
@@ -14,8 +14,8 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
16
|
import tracdap.rt.config as _cfg
|
17
|
-
import tracdap.rt._impl.guard_rails as _guard # noqa
|
18
|
-
import tracdap.rt.
|
17
|
+
import tracdap.rt._impl.core.guard_rails as _guard # noqa
|
18
|
+
import tracdap.rt._impl.runtime as _rt # noqa
|
19
19
|
|
20
20
|
|
21
21
|
class __EmbeddedRuntime:
|