tracdap-runtime 0.6.2__py3-none-any.whl → 0.6.4__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.
Files changed (71) hide show
  1. tracdap/rt/_exec/actors.py +87 -10
  2. tracdap/rt/_exec/context.py +207 -100
  3. tracdap/rt/_exec/dev_mode.py +52 -20
  4. tracdap/rt/_exec/engine.py +79 -14
  5. tracdap/rt/_exec/functions.py +14 -17
  6. tracdap/rt/_exec/runtime.py +83 -40
  7. tracdap/rt/_exec/server.py +306 -29
  8. tracdap/rt/_impl/config_parser.py +219 -49
  9. tracdap/rt/_impl/data.py +70 -5
  10. tracdap/rt/_impl/grpc/codec.py +60 -5
  11. tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.py +19 -19
  12. tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.pyi +11 -9
  13. tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2_grpc.py +25 -25
  14. tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.py +18 -18
  15. tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.py +28 -16
  16. tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.pyi +37 -6
  17. tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.py +8 -3
  18. tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.pyi +13 -2
  19. tracdap/rt/_impl/guard_rails.py +21 -0
  20. tracdap/rt/_impl/models.py +25 -0
  21. tracdap/rt/_impl/static_api.py +43 -13
  22. tracdap/rt/_impl/type_system.py +17 -0
  23. tracdap/rt/_impl/validation.py +47 -4
  24. tracdap/rt/_plugins/config_local.py +49 -0
  25. tracdap/rt/_version.py +1 -1
  26. tracdap/rt/api/hook.py +6 -5
  27. tracdap/rt/api/model_api.py +50 -7
  28. tracdap/rt/api/static_api.py +81 -23
  29. tracdap/rt/config/__init__.py +4 -4
  30. tracdap/rt/config/common.py +25 -15
  31. tracdap/rt/config/job.py +2 -2
  32. tracdap/rt/config/platform.py +25 -35
  33. tracdap/rt/config/result.py +2 -2
  34. tracdap/rt/config/runtime.py +4 -2
  35. tracdap/rt/ext/config.py +34 -0
  36. tracdap/rt/ext/embed.py +1 -3
  37. tracdap/rt/ext/plugins.py +47 -6
  38. tracdap/rt/launch/cli.py +11 -4
  39. tracdap/rt/launch/launch.py +53 -12
  40. tracdap/rt/metadata/__init__.py +17 -17
  41. tracdap/rt/metadata/common.py +2 -2
  42. tracdap/rt/metadata/custom.py +3 -3
  43. tracdap/rt/metadata/data.py +12 -12
  44. tracdap/rt/metadata/file.py +6 -6
  45. tracdap/rt/metadata/flow.py +6 -6
  46. tracdap/rt/metadata/job.py +8 -8
  47. tracdap/rt/metadata/model.py +21 -11
  48. tracdap/rt/metadata/object.py +3 -0
  49. tracdap/rt/metadata/object_id.py +8 -8
  50. tracdap/rt/metadata/search.py +5 -5
  51. tracdap/rt/metadata/stoarge.py +6 -6
  52. tracdap/rt/metadata/tag.py +1 -1
  53. tracdap/rt/metadata/tag_update.py +1 -1
  54. tracdap/rt/metadata/type.py +4 -4
  55. {tracdap_runtime-0.6.2.dist-info → tracdap_runtime-0.6.4.dist-info}/METADATA +4 -4
  56. tracdap_runtime-0.6.4.dist-info/RECORD +112 -0
  57. {tracdap_runtime-0.6.2.dist-info → tracdap_runtime-0.6.4.dist-info}/WHEEL +1 -1
  58. tracdap/rt/_impl/grpc/tracdap/config/common_pb2.py +0 -55
  59. tracdap/rt/_impl/grpc/tracdap/config/common_pb2.pyi +0 -103
  60. tracdap/rt/_impl/grpc/tracdap/config/job_pb2.py +0 -42
  61. tracdap/rt/_impl/grpc/tracdap/config/job_pb2.pyi +0 -44
  62. tracdap/rt/_impl/grpc/tracdap/config/platform_pb2.py +0 -71
  63. tracdap/rt/_impl/grpc/tracdap/config/platform_pb2.pyi +0 -197
  64. tracdap/rt/_impl/grpc/tracdap/config/result_pb2.py +0 -37
  65. tracdap/rt/_impl/grpc/tracdap/config/result_pb2.pyi +0 -35
  66. tracdap/rt/_impl/grpc/tracdap/config/runtime_pb2.py +0 -42
  67. tracdap/rt/_impl/grpc/tracdap/config/runtime_pb2.pyi +0 -46
  68. tracdap/rt/ext/_guard.py +0 -37
  69. tracdap_runtime-0.6.2.dist-info/RECORD +0 -121
  70. {tracdap_runtime-0.6.2.dist-info → tracdap_runtime-0.6.4.dist-info}/LICENSE +0 -0
  71. {tracdap_runtime-0.6.2.dist-info → tracdap_runtime-0.6.4.dist-info}/top_level.txt +0 -0
@@ -14,6 +14,7 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
+ import sys
17
18
  import typing as _tp
18
19
  import types as _ts
19
20
 
@@ -111,7 +112,8 @@ def A( # noqa
111
112
 
112
113
  def define_parameter(
113
114
  param_name: str, param_type: _tp.Union[TypeDescriptor, BasicType],
114
- label: str, default_value: _tp.Optional[_tp.Any] = None) \
115
+ label: str, default_value: _tp.Optional[_tp.Any] = None,
116
+ *, param_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
115
117
  -> _Named[ModelParameter]:
116
118
 
117
119
  """
@@ -128,6 +130,10 @@ def define_parameter(
128
130
  the model. TRAC will apply type coercion where possible to ensure the default value matches the parameter type,
129
131
  if the default value cannot be coerced to match the parameter type then model validation will fail.
130
132
 
133
+ You can use param_props to associate arbitrary key-value properties with this model parameter.
134
+ These properties are not used by the TRAC engine, but are stored in the model metadata for
135
+ the parameter and can be used as needed in 3rd-party applications.
136
+
131
137
  Once defined model parameters can be passed to :py:func:`define_parameters`,
132
138
  either as a list or as individual arguments, to create the set of parameters for a model.
133
139
 
@@ -135,6 +141,7 @@ def define_parameter(
135
141
  :param param_type: The parameter type, expressed in the TRAC type system
136
142
  :param label: A descriptive label for the parameter (required)
137
143
  :param default_value: A default value to use if no explicit value is supplied (optional)
144
+ :param param_props: Associate key-value properties with this parameter (not used by the TRAC engine)
138
145
  :return: A named model parameter, suitable for passing to :py:func:`define_parameters`
139
146
 
140
147
  :type param_name: str
@@ -142,11 +149,12 @@ def define_parameter(
142
149
  :py:class:`BasicType <tracdap.rt.metadata.BasicType>`
143
150
  :type label: str
144
151
  :type default_value: Optional[Any]
152
+ :type param_props: Optional[Dict[str, Any]]
145
153
  :rtype: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
146
154
  """
147
155
 
148
156
  sa = _StaticApiHook.get_instance()
149
- return sa.define_parameter(param_name, param_type, label, default_value)
157
+ return sa.define_parameter(param_name, param_type, label, default_value, param_props=param_props)
150
158
 
151
159
 
152
160
  def declare_parameter(
@@ -160,6 +168,9 @@ def declare_parameter(
160
168
  .. deprecated:: 0.4.4
161
169
  Use :py:func:`define_parameter` or :py:func:`P` instead.
162
170
 
171
+ This function is deprecated and will be removed in a future version.
172
+ Please use :py:func:`define_parameter() <tracdap.rt.api.define_parameter>` instead.
173
+
163
174
  :type param_name: str
164
175
  :type param_type: :py:class:`TypeDescriptor <tracdap.rt.metadata.TypeDescriptor>` |
165
176
  :py:class:`BasicType <tracdap.rt.metadata.BasicType>`
@@ -168,6 +179,8 @@ def declare_parameter(
168
179
  :rtype: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
169
180
  """
170
181
 
182
+ print("TRAC Warning: declare_parameter() is deprecated, please use define_parameter()", file=sys.stderr)
183
+
171
184
  return define_parameter(param_name, param_type, label, default_value)
172
185
 
173
186
 
@@ -175,7 +188,8 @@ def P( # noqa
175
188
  param_name: str,
176
189
  param_type: _tp.Union[TypeDescriptor, BasicType],
177
190
  label: str,
178
- default_value: _tp.Optional[_tp.Any] = None) \
191
+ default_value: _tp.Optional[_tp.Any] = None,
192
+ *, param_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
179
193
  -> _Named[ModelParameter]:
180
194
 
181
195
  """
@@ -186,12 +200,11 @@ def P( # noqa
186
200
  :py:class:`BasicType <tracdap.rt.metadata.BasicType>`
187
201
  :type label: str
188
202
  :type default_value: Optional[Any]
203
+ :type param_props: Optional[Dict[str, Any]]
189
204
  :rtype: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
190
205
  """
191
206
 
192
- return declare_parameter(
193
- param_name, param_type, label,
194
- default_value)
207
+ return define_parameter(param_name, param_type, label, default_value, param_props=param_props)
195
208
 
196
209
 
197
210
  def define_parameters(
@@ -226,11 +239,16 @@ def declare_parameters(
226
239
  .. deprecated:: 0.4.4
227
240
  Use :py:func:`define_parameters` instead.
228
241
 
242
+ This function is deprecated and will be removed in a future version.
243
+ Please use :py:func:`define_parameters() <tracdap.rt.api.define_parameters>` instead.
244
+
229
245
  :type params: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`] |
230
246
  List[_Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]]
231
247
  :rtype: Dict[str, :py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
232
248
  """
233
249
 
250
+ print("TRAC Warning: declare_parameters() is deprecated, please use define_parameters()", file=sys.stderr)
251
+
234
252
  return define_parameters(*params)
235
253
 
236
254
 
@@ -278,9 +296,9 @@ def define_field(
278
296
  :type label: str
279
297
  :type business_key: bool
280
298
  :type categorical: bool
281
- :type not_null: _tp.Optional[bool]
282
- :type format_code: _tp.Optional[str]
283
- :type field_order: _tp.Optional[int]
299
+ :type not_null: Optional[bool]
300
+ :type format_code: Optional[str]
301
+ :type field_order: Optional[int]
284
302
  :rtype: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`
285
303
  """
286
304
 
@@ -307,17 +325,22 @@ def declare_field(
307
325
  .. deprecated:: 0.4.4
308
326
  Use :py:func:`define_field` or :py:func:`F` instead.
309
327
 
328
+ This function is deprecated and will be removed in a future version.
329
+ Please use :py:func:`define_field() <tracdap.rt.api.define_field>` instead.
330
+
310
331
  :type field_name: str
311
332
  :type field_type: :py:class:`BasicType <tracdap.rt.metadata.BasicType>`
312
333
  :type label: str
313
334
  :type business_key: bool
314
335
  :type categorical: bool
315
- :type not_null: _tp.Optional[bool]
316
- :type format_code: _tp.Optional[str]
317
- :type field_order: _tp.Optional[int]
336
+ :type not_null: Optional[bool]
337
+ :type format_code: Optional[str]
338
+ :type field_order: Optional[int]
318
339
  :rtype: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`
319
340
  """
320
341
 
342
+ print("TRAC Warning: declare_field() is deprecated, please use define_field()", file=sys.stderr)
343
+
321
344
  return define_field(
322
345
  field_name, field_type, label,
323
346
  business_key, categorical, not_null,
@@ -343,9 +366,9 @@ def F( # noqa
343
366
  :type label: str
344
367
  :type business_key: bool
345
368
  :type categorical: bool
346
- :type not_null: _tp.Optional[bool]
347
- :type format_code: _tp.Optional[str]
348
- :type field_order: _tp.Optional[int]
369
+ :type not_null: Optional[bool]
370
+ :type format_code: Optional[str]
371
+ :type field_order: Optional[int]
349
372
  :rtype: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`
350
373
  """
351
374
 
@@ -428,8 +451,8 @@ def load_schema(
428
451
 
429
452
  def define_input_table(
430
453
  *fields: _tp.Union[FieldSchema, _tp.List[FieldSchema]],
431
- label: _tp.Optional[str] = None,
432
- optional: bool = False) \
454
+ label: _tp.Optional[str] = None, optional: bool = False, dynamic: bool = False,
455
+ input_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
433
456
  -> ModelInputSchema:
434
457
 
435
458
  """
@@ -438,20 +461,31 @@ def define_input_table(
438
461
  Fields can be supplied either as individual arguments to this function or as a list.
439
462
  Individual fields should be defined using :py:func:`define_field` or the shorthand alias :py:func:`F`.
440
463
 
464
+ You can use input_props to associate arbitrary key-value properties with this model input.
465
+ These properties are not used by the TRAC engine, but are stored in the model metadata for
466
+ the input and can be used as needed in 3rd-party applications.
467
+
441
468
  :param fields: A set of fields to make up a :py:class:`TableSchema <tracdap.rt.metadata.TableSchema>`
442
469
  :param label: An optional label (of type str) for a model input schema. Default value: None.
443
470
  :param optional: Mark this input as an optional model input
471
+ :param dynamic: Mark this input as a dynamic model input (the list of fields must be empty)
472
+ :param input_props: Associate key-value properties with this input (not used by the TRAC engine)
444
473
  :return: A model input schema, suitable for returning from :py:meth:`TracModel.define_inputs`
445
474
 
446
475
  :type fields: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>` |
447
476
  List[:py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`]
448
- :type label: _tp.Optional[str]
477
+ :type label: Optional[str]
449
478
  :type optional: bool
479
+ :type dynamic: bool
480
+ :type input_props: Optional[Dict[str, Any]]
450
481
  :rtype: :py:class:`ModelInputSchema <tracdap.rt.metadata.ModelInputSchema>`
451
482
  """
452
483
 
453
484
  sa = _StaticApiHook.get_instance()
454
- return sa.define_input_table(*fields, label=label, optional=optional)
485
+
486
+ return sa.define_input_table(
487
+ *fields, label=label, optional=optional, dynamic=dynamic,
488
+ input_props=input_props)
455
489
 
456
490
 
457
491
  def declare_input_table(
@@ -462,18 +496,23 @@ def declare_input_table(
462
496
  .. deprecated:: 0.4.4
463
497
  Use :py:func:`define_input_table` instead.
464
498
 
499
+ This function is deprecated and will be removed in a future version.
500
+ Please use :py:func:`define_input_table() <tracdap.rt.api.define_input_table>` instead.
501
+
465
502
  :type fields: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>` |
466
503
  List[:py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`]
467
504
  :rtype: :py:class:`ModelInputSchema <tracdap.rt.metadata.ModelInputSchema>`
468
505
  """
469
506
 
507
+ print("TRAC Warning: declare_input_table() is deprecated, please use define_input_table()", file=sys.stderr)
508
+
470
509
  return define_input_table(*fields)
471
510
 
472
511
 
473
512
  def define_output_table(
474
513
  *fields: _tp.Union[FieldSchema, _tp.List[FieldSchema]],
475
- label: _tp.Optional[str] = None,
476
- optional: bool = False) \
514
+ label: _tp.Optional[str] = None, optional: bool = False, dynamic: bool = False,
515
+ output_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
477
516
  -> ModelOutputSchema:
478
517
 
479
518
  """
@@ -482,20 +521,31 @@ def define_output_table(
482
521
  Fields can be supplied either as individual arguments to this function or as a list.
483
522
  Individual fields should be defined using :py:func:`define_field` or the shorthand alias :py:func:`F`.
484
523
 
524
+ You can use output_props to associate arbitrary key-value properties with this model output.
525
+ These properties are not used by the TRAC engine, but are stored in the model metadata for
526
+ the output and can be used as needed in 3rd-party applications.
527
+
485
528
  :param fields: A set of fields to make up a :py:class:`TableSchema <tracdap.rt.metadata.TableSchema>`
486
529
  :param label: An optional label (of type str) for a model output schema. Default value: None.
487
530
  :param optional: Mark this output as an optional model output
531
+ :param dynamic: Mark this output as a dynamic model output (the list of fields must be empty)
532
+ :param output_props: Associate key-value properties with this output (not used by the TRAC engine)
488
533
  :return: A model output schema, suitable for returning from :py:meth:`TracModel.define_outputs`
489
534
 
490
535
  :type fields: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>` |
491
536
  List[:py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`]
492
- :type label: _tp.Optional[str]
537
+ :type label: Optional[str]
493
538
  :type optional: bool
539
+ :type dynamic: bool
540
+ :type output_props: Optional[Dict[str, Any]]
494
541
  :rtype: :py:class:`ModelOutputSchema <tracdap.rt.metadata.ModelOutputSchema>`
495
542
  """
496
543
 
497
544
  sa = _StaticApiHook.get_instance()
498
- return sa.define_output_table(*fields, label=label, optional=optional)
545
+
546
+ return sa.define_output_table(
547
+ *fields, label=label, optional=optional, dynamic=dynamic,
548
+ output_props=output_props)
499
549
 
500
550
 
501
551
  def declare_output_table(
@@ -506,9 +556,17 @@ def declare_output_table(
506
556
  .. deprecated:: 0.4.4
507
557
  Use :py:func:`define_output_table` instead.
508
558
 
559
+ This function is deprecated and will be removed in a future version.
560
+ Please use :py:func:`define_output_table() <tracdap.rt.api.define_output_table>` instead.
561
+
562
+ This function is deprecated and will be removed in a future version.
563
+ Please use define_output_table() instead.
564
+
509
565
  :type fields: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>` |
510
566
  List[:py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`]
511
567
  :rtype: :py:class:`ModelOutputSchema <tracdap.rt.metadata.ModelOutputSchema>`
512
568
  """
513
569
 
570
+ print("TRAC Warning: declare_output_table() is deprecated, please use define_output_table()", file==sys.stderr)
571
+
514
572
  return define_output_table(*fields)
@@ -5,13 +5,11 @@ from .common import PluginConfig
5
5
  from .common import PlatformInfo
6
6
  from .common import AuthenticationConfig
7
7
  from .common import StorageConfig
8
+ from .common import ServiceConfig
8
9
 
9
10
  from .runtime import RuntimeConfig
10
11
  from .runtime import SparkSettings
11
12
 
12
- from .result import TagUpdateList
13
- from .result import JobResult
14
-
15
13
  from .platform import RoutingProtocol
16
14
  from .platform import DeploymentLayout
17
15
  from .platform import PlatformConfig
@@ -24,7 +22,9 @@ from .platform import GatewayConfig
24
22
  from .platform import RouteConfig
25
23
  from .platform import RoutingMatch
26
24
  from .platform import RoutingTarget
27
- from .platform import ServiceConfig
28
25
  from .platform import DeploymentConfig
29
26
 
30
27
  from .job import JobConfig
28
+
29
+ from .result import TagUpdateList
30
+ from .result import JobResult
@@ -15,7 +15,7 @@ class _ConfigFile:
15
15
  @_dc.dataclass
16
16
  class PluginConfig:
17
17
 
18
- protocol: str = None
18
+ protocol: str = ""
19
19
 
20
20
  properties: _tp.Dict[str, str] = _dc.field(default_factory=dict)
21
21
 
@@ -25,9 +25,9 @@ class PluginConfig:
25
25
  @_dc.dataclass
26
26
  class PlatformInfo:
27
27
 
28
- environment: str = None
28
+ environment: str = ""
29
29
 
30
- production: bool = None
30
+ production: bool = False
31
31
 
32
32
  deploymentInfo: _tp.Dict[str, str] = _dc.field(default_factory=dict)
33
33
 
@@ -35,27 +35,27 @@ class PlatformInfo:
35
35
  @_dc.dataclass
36
36
  class AuthenticationConfig:
37
37
 
38
- jwtIssuer: str = None
38
+ jwtIssuer: str = ""
39
39
 
40
- jwtExpiry: int = None
40
+ jwtExpiry: int = 0
41
41
 
42
- jwtLimit: int = None
42
+ jwtLimit: int = 0
43
43
 
44
- jwtRefresh: int = None
44
+ jwtRefresh: int = 0
45
45
 
46
46
  provider: _tp.Optional[PluginConfig] = None
47
47
 
48
- disableAuth: bool = None
48
+ disableAuth: bool = False
49
49
 
50
- disableSigning: bool = None
50
+ disableSigning: bool = False
51
51
 
52
- systemUserId: str = None
52
+ systemUserId: str = ""
53
53
 
54
- systemUserName: str = None
54
+ systemUserName: str = ""
55
55
 
56
- systemTicketDuration: int = None
56
+ systemTicketDuration: int = 0
57
57
 
58
- systemTicketRefresh: int = None
58
+ systemTicketRefresh: int = 0
59
59
 
60
60
 
61
61
  @_dc.dataclass
@@ -63,6 +63,16 @@ class StorageConfig:
63
63
 
64
64
  buckets: _tp.Dict[str, PluginConfig] = _dc.field(default_factory=dict)
65
65
 
66
- defaultBucket: str = None
66
+ defaultBucket: str = ""
67
67
 
68
- defaultFormat: str = None
68
+ defaultFormat: str = ""
69
+
70
+
71
+ @_dc.dataclass
72
+ class ServiceConfig:
73
+
74
+ enabled: _tp.Optional[bool] = None
75
+
76
+ alias: str = ""
77
+
78
+ port: int = 0
tracdap/rt/config/job.py CHANGED
@@ -12,9 +12,9 @@ import tracdap.rt.metadata as metadata
12
12
  @_dc.dataclass
13
13
  class JobConfig:
14
14
 
15
- jobId: metadata.TagHeader = None
15
+ jobId: metadata.TagHeader = _dc.field(default_factory=lambda: metadata.TagHeader())
16
16
 
17
- job: metadata.JobDefinition = None
17
+ job: metadata.JobDefinition = _dc.field(default_factory=lambda: metadata.JobDefinition())
18
18
 
19
19
  resources: _tp.Dict[str, metadata.ObjectDefinition] = _dc.field(default_factory=dict)
20
20
 
@@ -38,19 +38,19 @@ class PlatformConfig:
38
38
 
39
39
  config: _tp.Dict[str, str] = _dc.field(default_factory=dict)
40
40
 
41
- platformInfo: PlatformInfo = None
41
+ platformInfo: PlatformInfo = _dc.field(default_factory=lambda: PlatformInfo())
42
42
 
43
- authentication: AuthenticationConfig = None
43
+ authentication: AuthenticationConfig = _dc.field(default_factory=lambda: AuthenticationConfig())
44
44
 
45
- metadata: MetadataConfig = None
45
+ metadata: MetadataConfig = _dc.field(default_factory=lambda: MetadataConfig())
46
46
 
47
- storage: StorageConfig = None
47
+ storage: StorageConfig = _dc.field(default_factory=lambda: StorageConfig())
48
48
 
49
49
  repositories: _tp.Dict[str, PluginConfig] = _dc.field(default_factory=dict)
50
50
 
51
- executor: PluginConfig = None
51
+ executor: PluginConfig = _dc.field(default_factory=lambda: PluginConfig())
52
52
 
53
- jobCache: PluginConfig = None
53
+ jobCache: PluginConfig = _dc.field(default_factory=lambda: PluginConfig())
54
54
 
55
55
  tenants: _tp.Dict[str, TenantConfig] = _dc.field(default_factory=dict)
56
56
 
@@ -60,13 +60,13 @@ class PlatformConfig:
60
60
 
61
61
  services: _tp.Dict[str, ServiceConfig] = _dc.field(default_factory=dict)
62
62
 
63
- deployment: DeploymentConfig = None
63
+ deployment: DeploymentConfig = _dc.field(default_factory=lambda: DeploymentConfig())
64
64
 
65
65
 
66
66
  @_dc.dataclass
67
67
  class MetadataConfig:
68
68
 
69
- database: PluginConfig = None
69
+ database: PluginConfig = _dc.field(default_factory=lambda: PluginConfig())
70
70
 
71
71
  format: metadata.MetadataFormat = metadata.MetadataFormat.METADATA_FORMAT_NOT_SET
72
72
 
@@ -82,9 +82,9 @@ class TenantConfig:
82
82
  @_dc.dataclass
83
83
  class WebServerConfig:
84
84
 
85
- enabled: bool = None
85
+ enabled: bool = False
86
86
 
87
- contentRoot: PluginConfig = None
87
+ contentRoot: PluginConfig = _dc.field(default_factory=lambda: PluginConfig())
88
88
 
89
89
  rewriteRules: _tp.List[WebServerRewriteRule] = _dc.field(default_factory=list)
90
90
 
@@ -94,25 +94,25 @@ class WebServerConfig:
94
94
  @_dc.dataclass
95
95
  class WebServerRewriteRule:
96
96
 
97
- source: str = None
97
+ source: str = ""
98
98
 
99
- target: str = None
99
+ target: str = ""
100
100
 
101
101
 
102
102
  @_dc.dataclass
103
103
  class WebServerRedirect:
104
104
 
105
- source: str = None
105
+ source: str = ""
106
106
 
107
- target: str = None
107
+ target: str = ""
108
108
 
109
- status: int = None
109
+ status: int = 0
110
110
 
111
111
 
112
112
  @_dc.dataclass
113
113
  class GatewayConfig:
114
114
 
115
- idleTimeout: int = None
115
+ idleTimeout: int = 0
116
116
 
117
117
  routes: _tp.List[RouteConfig] = _dc.field(default_factory=list)
118
118
 
@@ -122,45 +122,35 @@ class GatewayConfig:
122
122
  @_dc.dataclass
123
123
  class RouteConfig:
124
124
 
125
- routeName: str = None
125
+ routeName: str = ""
126
126
 
127
127
  routeType: RoutingProtocol = RoutingProtocol.PROTOCOL_NOT_SET
128
128
 
129
129
  protocols: _tp.List[RoutingProtocol] = _dc.field(default_factory=list)
130
130
 
131
- match: RoutingMatch = None
131
+ match: RoutingMatch = _dc.field(default_factory=lambda: RoutingMatch())
132
132
 
133
- target: RoutingTarget = None
133
+ target: RoutingTarget = _dc.field(default_factory=lambda: RoutingTarget())
134
134
 
135
135
 
136
136
  @_dc.dataclass
137
137
  class RoutingMatch:
138
138
 
139
- host: str = None
139
+ host: str = ""
140
140
 
141
- path: str = None
141
+ path: str = ""
142
142
 
143
143
 
144
144
  @_dc.dataclass
145
145
  class RoutingTarget:
146
146
 
147
- scheme: str = None
147
+ scheme: str = ""
148
148
 
149
- host: str = None
149
+ host: str = ""
150
150
 
151
- port: int = None
151
+ port: int = 0
152
152
 
153
- path: str = None
154
-
155
-
156
- @_dc.dataclass
157
- class ServiceConfig:
158
-
159
- enabled: _tp.Optional[bool] = None
160
-
161
- alias: str = None
162
-
163
- port: int = None
153
+ path: str = ""
164
154
 
165
155
 
166
156
  @_dc.dataclass
@@ -18,10 +18,10 @@ class TagUpdateList:
18
18
  @_dc.dataclass
19
19
  class JobResult:
20
20
 
21
- jobId: metadata.TagHeader = None
21
+ jobId: metadata.TagHeader = _dc.field(default_factory=lambda: metadata.TagHeader())
22
22
 
23
23
  statusCode: metadata.JobStatusCode = metadata.JobStatusCode.JOB_STATUS_CODE_NOT_SET
24
24
 
25
- statusMessage: str = None
25
+ statusMessage: str = ""
26
26
 
27
27
  results: _tp.Dict[str, metadata.ObjectDefinition] = _dc.field(default_factory=dict)
@@ -14,11 +14,13 @@ class RuntimeConfig:
14
14
 
15
15
  config: _tp.Dict[str, str] = _dc.field(default_factory=dict)
16
16
 
17
- storage: StorageConfig = None
17
+ storage: StorageConfig = _dc.field(default_factory=lambda: StorageConfig())
18
18
 
19
19
  repositories: _tp.Dict[str, PluginConfig] = _dc.field(default_factory=dict)
20
20
 
21
- sparkSettings: SparkSettings = None
21
+ sparkSettings: SparkSettings = _dc.field(default_factory=lambda: SparkSettings())
22
+
23
+ runtimeApi: ServiceConfig = _dc.field(default_factory=lambda: ServiceConfig())
22
24
 
23
25
 
24
26
  @_dc.dataclass
@@ -0,0 +1,34 @@
1
+ # Copyright 2024 Accenture Global Solutions Limited
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import abc as _abc
16
+
17
+
18
+ class IConfigLoader:
19
+
20
+ @_abc.abstractmethod
21
+ def has_config_file(self, config_url: str) -> bool:
22
+ pass
23
+
24
+ @_abc.abstractmethod
25
+ def load_config_file(self, config_url: str) -> bytes:
26
+ pass
27
+
28
+ @_abc.abstractmethod
29
+ def has_config_dict(self, config_url: str) -> bool:
30
+ pass
31
+
32
+ @_abc.abstractmethod
33
+ def load_config_dict(self, config_url: str) -> dict:
34
+ pass
tracdap/rt/ext/embed.py CHANGED
@@ -13,9 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import tracdap.rt.config as _cfg
16
- import tracdap.rt.ext._guard as _guard
17
-
18
- # Dependency back into the main runtime implementation
16
+ import tracdap.rt._impl.guard_rails as _guard # noqa
19
17
  import tracdap.rt._exec.runtime as _rt # noqa
20
18
 
21
19