tracdap-runtime 0.7.0rc1__py3-none-any.whl → 0.8.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tracdap/rt/_exec/context.py +140 -64
- tracdap/rt/_exec/dev_mode.py +144 -69
- tracdap/rt/_exec/engine.py +9 -7
- tracdap/rt/_exec/functions.py +95 -33
- tracdap/rt/_exec/graph.py +22 -15
- tracdap/rt/_exec/graph_builder.py +221 -98
- tracdap/rt/_exec/runtime.py +19 -6
- tracdap/rt/_impl/data.py +86 -13
- tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.py +3 -1
- tracdap/rt/_impl/grpc/tracdap/metadata/file_pb2.pyi +8 -0
- tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.py +27 -25
- tracdap/rt/_impl/grpc/tracdap/metadata/model_pb2.pyi +14 -4
- tracdap/rt/_impl/models.py +9 -7
- tracdap/rt/_impl/static_api.py +53 -33
- tracdap/rt/_impl/util.py +1 -1
- tracdap/rt/_impl/validation.py +54 -28
- tracdap/rt/_version.py +1 -1
- tracdap/rt/api/__init__.py +6 -3
- tracdap/rt/api/file_types.py +29 -0
- tracdap/rt/api/hook.py +15 -7
- tracdap/rt/api/model_api.py +16 -0
- tracdap/rt/api/static_api.py +211 -125
- tracdap/rt/config/__init__.py +6 -6
- tracdap/rt/config/common.py +11 -1
- tracdap/rt/config/platform.py +4 -6
- tracdap/rt/launch/launch.py +9 -11
- tracdap/rt/metadata/__init__.py +10 -9
- tracdap/rt/metadata/file.py +8 -0
- tracdap/rt/metadata/model.py +12 -2
- {tracdap_runtime-0.7.0rc1.dist-info → tracdap_runtime-0.8.0b1.dist-info}/METADATA +15 -15
- {tracdap_runtime-0.7.0rc1.dist-info → tracdap_runtime-0.8.0b1.dist-info}/RECORD +34 -33
- {tracdap_runtime-0.7.0rc1.dist-info → tracdap_runtime-0.8.0b1.dist-info}/WHEEL +1 -1
- {tracdap_runtime-0.7.0rc1.dist-info → tracdap_runtime-0.8.0b1.dist-info}/LICENSE +0 -0
- {tracdap_runtime-0.7.0rc1.dist-info → tracdap_runtime-0.8.0b1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,29 @@
|
|
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
|
+
from tracdap.rt.metadata import * # DOCGEN_REMOVE
|
17
|
+
|
18
|
+
|
19
|
+
class CommonFileTypes:
|
20
|
+
|
21
|
+
TXT = FileType("txt", "text/plain")
|
22
|
+
|
23
|
+
JPG = FileType("jpg", "image/jpeg")
|
24
|
+
PNG = FileType("png", "image/png")
|
25
|
+
SVG = FileType("svg", "image/svg+xml")
|
26
|
+
|
27
|
+
WORD = FileType("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
|
28
|
+
EXCEL = FileType("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
29
|
+
POWERPOINT = FileType("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation")
|
tracdap/rt/api/hook.py
CHANGED
@@ -116,7 +116,7 @@ class _StaticApiHook:
|
|
116
116
|
@_abc.abstractmethod
|
117
117
|
def define_schema(
|
118
118
|
self, *fields: _tp.Union[_meta.FieldSchema, _tp.List[_meta.FieldSchema]],
|
119
|
-
schema_type: _meta.SchemaType = _meta.SchemaType.TABLE) \
|
119
|
+
schema_type: _meta.SchemaType = _meta.SchemaType.TABLE, dynamic: bool = False) \
|
120
120
|
-> _meta.SchemaDefinition:
|
121
121
|
|
122
122
|
pass
|
@@ -131,21 +131,29 @@ class _StaticApiHook:
|
|
131
131
|
|
132
132
|
@_abc.abstractmethod
|
133
133
|
def infer_schema(self, dataset: _tp.Any) -> _meta.SchemaDefinition:
|
134
|
+
|
134
135
|
pass
|
135
136
|
|
136
137
|
@_abc.abstractmethod
|
137
|
-
def
|
138
|
-
|
139
|
-
|
138
|
+
def define_file_type(self, extension: str, mime_type: str) -> _meta.FileType:
|
139
|
+
|
140
|
+
pass
|
141
|
+
|
142
|
+
@_abc.abstractmethod
|
143
|
+
def define_input(
|
144
|
+
self, requirement: _tp.Union[_meta.SchemaDefinition, _meta.FileType], *,
|
145
|
+
label: _tp.Optional[str] = None,
|
146
|
+
optional: bool = False, dynamic: bool = False,
|
140
147
|
input_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
|
141
148
|
-> _meta.ModelInputSchema:
|
142
149
|
|
143
150
|
pass
|
144
151
|
|
145
152
|
@_abc.abstractmethod
|
146
|
-
def
|
147
|
-
self,
|
148
|
-
label: _tp.Optional[str] = None,
|
153
|
+
def define_output(
|
154
|
+
self, requirement: _tp.Union[_meta.SchemaDefinition, _meta.FileType], *,
|
155
|
+
label: _tp.Optional[str] = None,
|
156
|
+
optional: bool = False, dynamic: bool = False,
|
149
157
|
output_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
|
150
158
|
-> _meta.ModelOutputSchema:
|
151
159
|
|
tracdap/rt/api/model_api.py
CHANGED
@@ -194,6 +194,14 @@ class TracContext(metaclass=_abc.ABCMeta):
|
|
194
194
|
|
195
195
|
pass
|
196
196
|
|
197
|
+
def get_file(self, file_name: str) -> bytes:
|
198
|
+
|
199
|
+
pass
|
200
|
+
|
201
|
+
def get_file_stream(self, file_name: str) -> _tp.ContextManager[_tp.BinaryIO]:
|
202
|
+
|
203
|
+
pass
|
204
|
+
|
197
205
|
def put_schema(self, dataset_name: str, schema: SchemaDefinition):
|
198
206
|
|
199
207
|
"""
|
@@ -283,6 +291,14 @@ class TracContext(metaclass=_abc.ABCMeta):
|
|
283
291
|
|
284
292
|
pass
|
285
293
|
|
294
|
+
def put_file(self, file_name: str, file_content: _tp.Union[bytes, bytearray]):
|
295
|
+
|
296
|
+
pass
|
297
|
+
|
298
|
+
def put_file_stream(self, file_name: str) -> _tp.ContextManager[_tp.BinaryIO]:
|
299
|
+
|
300
|
+
pass
|
301
|
+
|
286
302
|
def log(self) -> _logging.Logger:
|
287
303
|
|
288
304
|
"""
|
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,32 @@ 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
|
+
sa = _StaticApiHook.get_instance()
|
388
|
+
return sa.define_file_type(extension, mime_type)
|
389
|
+
|
390
|
+
|
391
|
+
def define_input(
|
392
|
+
requirement: _tp.Union[SchemaDefinition, FileType], *,
|
393
|
+
label: _tp.Optional[str] = None,
|
394
|
+
optional: bool = False, dynamic: bool = False,
|
395
|
+
input_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None):
|
396
|
+
|
397
|
+
sa = _StaticApiHook.get_instance()
|
398
|
+
return sa.define_input(requirement, label=label, optional=optional, dynamic=dynamic, input_props=input_props)
|
399
|
+
|
400
|
+
|
401
|
+
def define_output(
|
402
|
+
requirement: _tp.Union[SchemaDefinition, FileType], *,
|
403
|
+
label: _tp.Optional[str] = None,
|
404
|
+
optional: bool = False, dynamic: bool = False,
|
405
|
+
output_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None):
|
406
|
+
|
407
|
+
sa = _StaticApiHook.get_instance()
|
408
|
+
return sa.define_output(requirement, label=label, optional=optional, dynamic=dynamic, output_props=output_props)
|
409
|
+
|
410
|
+
|
474
411
|
def define_input_table(
|
475
412
|
*fields: _tp.Union[FieldSchema, _tp.List[FieldSchema]],
|
476
413
|
label: _tp.Optional[str] = None, optional: bool = False, dynamic: bool = False,
|
@@ -512,34 +449,8 @@ def define_input_table(
|
|
512
449
|
:rtype: :py:class:`ModelInputSchema <tracdap.rt.metadata.ModelInputSchema>`
|
513
450
|
"""
|
514
451
|
|
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)
|
452
|
+
schema = define_schema(*fields, schema_type=SchemaType.TABLE, dynamic=dynamic)
|
453
|
+
return define_input(schema, label=label, optional=optional, dynamic=dynamic, input_props=input_props)
|
543
454
|
|
544
455
|
|
545
456
|
def define_output_table(
|
@@ -581,11 +492,186 @@ def define_output_table(
|
|
581
492
|
:rtype: :py:class:`ModelOutputSchema <tracdap.rt.metadata.ModelOutputSchema>`
|
582
493
|
"""
|
583
494
|
|
584
|
-
|
495
|
+
schema = define_schema(*fields, schema_type=SchemaType.TABLE, dynamic=dynamic)
|
496
|
+
return define_output(schema, label=label, optional=optional, dynamic=dynamic, output_props=output_props)
|
497
|
+
|
498
|
+
|
499
|
+
def define_input_file(
|
500
|
+
extension: str, mime_type: str, *,
|
501
|
+
label: _tp.Optional[str] = None, optional: bool = False,
|
502
|
+
input_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
|
503
|
+
-> ModelInputSchema:
|
504
|
+
|
505
|
+
file_type = define_file_type(extension, mime_type)
|
506
|
+
return define_input(file_type, label=label, optional=optional, input_props=input_props)
|
507
|
+
|
585
508
|
|
586
|
-
|
587
|
-
|
588
|
-
|
509
|
+
def define_output_file(
|
510
|
+
extension: str, mime_type: str, *,
|
511
|
+
label: _tp.Optional[str] = None, optional: bool = False,
|
512
|
+
output_props: _tp.Optional[_tp.Dict[str, _tp.Any]] = None) \
|
513
|
+
-> ModelOutputSchema:
|
514
|
+
|
515
|
+
file_type = define_file_type(extension, mime_type)
|
516
|
+
return define_output(file_type, label=label, optional=optional, output_props=output_props)
|
517
|
+
|
518
|
+
|
519
|
+
def ModelInputSchema( # noqa
|
520
|
+
schema: SchemaDefinition,
|
521
|
+
label: _tp.Optional[str] = None,
|
522
|
+
optional: bool = False,
|
523
|
+
dynamic: bool = False,
|
524
|
+
inputProps: _tp.Optional[_tp.Dict[str, Value]] = None): # noqa
|
525
|
+
|
526
|
+
"""
|
527
|
+
.. deprecated:: 0.8.0
|
528
|
+
Use :py:func:`define_input` instead.
|
529
|
+
|
530
|
+
This function is provided for compatibility with TRAC versions before 0.8.0.
|
531
|
+
Please use :py:func:`define_input() <tracdap.rt.api.define_input>` instead.
|
532
|
+
|
533
|
+
:display: False
|
534
|
+
"""
|
535
|
+
|
536
|
+
input_props = inputProps or dict()
|
537
|
+
return define_input(schema, label=label, optional=optional, dynamic=dynamic, input_props=input_props)
|
538
|
+
|
539
|
+
|
540
|
+
def ModelOutputSchema( # noqa
|
541
|
+
schema: SchemaDefinition,
|
542
|
+
label: _tp.Optional[str] = None,
|
543
|
+
optional: bool = False,
|
544
|
+
dynamic: bool = False,
|
545
|
+
outputProps: _tp.Optional[_tp.Dict[str, Value]] = None): # noqa
|
546
|
+
|
547
|
+
"""
|
548
|
+
.. deprecated:: 0.8.0
|
549
|
+
Use :py:func:`define_output` instead.
|
550
|
+
|
551
|
+
This function is provided for compatibility with TRAC versions before 0.8.0.
|
552
|
+
Please use :py:func:`define_output() <tracdap.rt.api.define_output>` instead.
|
553
|
+
|
554
|
+
:display: False
|
555
|
+
"""
|
556
|
+
|
557
|
+
output_props = outputProps or dict()
|
558
|
+
return define_output(schema, label=label, optional=optional, dynamic=dynamic, output_props=output_props)
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
def declare_parameter(
|
563
|
+
param_name: str,
|
564
|
+
param_type: _tp.Union[BasicType, TypeDescriptor],
|
565
|
+
label: str,
|
566
|
+
default_value: _tp.Optional[_tp.Any] = None) \
|
567
|
+
-> _Named[ModelParameter]:
|
568
|
+
|
569
|
+
"""
|
570
|
+
.. deprecated:: 0.4.4
|
571
|
+
Use :py:func:`define_parameter` or :py:func:`P` instead.
|
572
|
+
|
573
|
+
This function is deprecated and will be removed in a future version.
|
574
|
+
Please use :py:func:`define_parameter() <tracdap.rt.api.define_parameter>` instead.
|
575
|
+
|
576
|
+
:type param_name: str
|
577
|
+
:type param_type: :py:class:`BasicType <tracdap.rt.metadata.BasicType>` |
|
578
|
+
:py:class:`TypeDescriptor <tracdap.rt.metadata.TypeDescriptor>`
|
579
|
+
|
580
|
+
:type label: str
|
581
|
+
:type default_value: Any | None
|
582
|
+
:rtype: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
|
583
|
+
|
584
|
+
:display: False
|
585
|
+
"""
|
586
|
+
|
587
|
+
print("TRAC Warning: declare_parameter() is deprecated, please use define_parameter()", file=sys.stderr)
|
588
|
+
|
589
|
+
return define_parameter(param_name, param_type, label, default_value)
|
590
|
+
|
591
|
+
|
592
|
+
def declare_parameters(
|
593
|
+
*params: _tp.Union[_Named[ModelParameter], _tp.List[_Named[ModelParameter]]]) \
|
594
|
+
-> _tp.Dict[str, ModelParameter]:
|
595
|
+
|
596
|
+
"""
|
597
|
+
.. deprecated:: 0.4.4
|
598
|
+
Use :py:func:`define_parameters` instead
|
599
|
+
|
600
|
+
This function is deprecated and will be removed in a future version.
|
601
|
+
Please use :py:func:`define_parameters() <tracdap.rt.api.define_parameters>` instead.
|
602
|
+
|
603
|
+
:type params: _Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`] |
|
604
|
+
List[_Named[:py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]]
|
605
|
+
:rtype: Dict[str, :py:class:`ModelParameter <tracdap.rt.metadata.ModelParameter>`]
|
606
|
+
|
607
|
+
:display: False
|
608
|
+
"""
|
609
|
+
|
610
|
+
print("TRAC Warning: declare_parameters() is deprecated, please use define_parameters()", file=sys.stderr)
|
611
|
+
|
612
|
+
return define_parameters(*params)
|
613
|
+
|
614
|
+
|
615
|
+
def declare_field(
|
616
|
+
field_name: str,
|
617
|
+
field_type: BasicType,
|
618
|
+
label: str,
|
619
|
+
business_key: bool = False,
|
620
|
+
categorical: bool = False,
|
621
|
+
not_null: _tp.Optional[bool] = None,
|
622
|
+
format_code: _tp.Optional[str] = None,
|
623
|
+
field_order: _tp.Optional[int] = None) \
|
624
|
+
-> FieldSchema:
|
625
|
+
|
626
|
+
"""
|
627
|
+
.. deprecated:: 0.4.4
|
628
|
+
Use :py:func:`define_field` or :py:func:`F` instead.
|
629
|
+
|
630
|
+
This function is deprecated and will be removed in a future version.
|
631
|
+
Please use :py:func:`define_field() <tracdap.rt.api.define_field>` instead.
|
632
|
+
|
633
|
+
:type field_name: str
|
634
|
+
:type field_type: :py:class:`BasicType <tracdap.rt.metadata.BasicType>`
|
635
|
+
:type label: str
|
636
|
+
:type business_key: bool
|
637
|
+
:type categorical: bool
|
638
|
+
:type not_null: bool | None
|
639
|
+
:type format_code: str | None
|
640
|
+
:type field_order: int | None
|
641
|
+
:rtype: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`
|
642
|
+
|
643
|
+
:display: False
|
644
|
+
"""
|
645
|
+
|
646
|
+
print("TRAC Warning: declare_field() is deprecated, please use define_field()", file=sys.stderr)
|
647
|
+
|
648
|
+
return define_field(
|
649
|
+
field_name, field_type, label,
|
650
|
+
business_key, categorical, not_null,
|
651
|
+
format_code, field_order)
|
652
|
+
|
653
|
+
|
654
|
+
def declare_input_table(
|
655
|
+
*fields: _tp.Union[FieldSchema, _tp.List[FieldSchema]]) \
|
656
|
+
-> ModelInputSchema:
|
657
|
+
|
658
|
+
"""
|
659
|
+
.. deprecated:: 0.4.4
|
660
|
+
Use :py:func:`define_input_table` instead.
|
661
|
+
|
662
|
+
This function is deprecated and will be removed in a future version.
|
663
|
+
Please use :py:func:`define_input_table() <tracdap.rt.api.define_input_table>` instead.
|
664
|
+
|
665
|
+
:type fields: :py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>` |
|
666
|
+
List[:py:class:`FieldSchema <tracdap.rt.metadata.FieldSchema>`]
|
667
|
+
:rtype: :py:class:`ModelInputSchema <tracdap.rt.metadata.ModelInputSchema>`
|
668
|
+
|
669
|
+
:display: False
|
670
|
+
"""
|
671
|
+
|
672
|
+
print("TRAC Warning: declare_input_table() is deprecated, please use define_input_table()", file=sys.stderr)
|
673
|
+
|
674
|
+
return define_input_table(*fields)
|
589
675
|
|
590
676
|
|
591
677
|
def declare_output_table(
|
tracdap/rt/config/__init__.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Code generated by TRAC
|
2
2
|
|
3
|
+
from .job import JobConfig
|
4
|
+
|
3
5
|
from .common import _ConfigFile
|
4
6
|
from .common import PluginConfig
|
5
7
|
from .common import PlatformInfo
|
@@ -7,10 +9,8 @@ from .common import AuthenticationConfig
|
|
7
9
|
from .common import StorageConfig
|
8
10
|
from .common import ServiceConfig
|
9
11
|
|
10
|
-
from .
|
11
|
-
from .
|
12
|
-
|
13
|
-
from .job import JobConfig
|
12
|
+
from .result import TagUpdateList
|
13
|
+
from .result import JobResult
|
14
14
|
|
15
15
|
from .platform import RoutingProtocol
|
16
16
|
from .platform import DeploymentLayout
|
@@ -26,5 +26,5 @@ from .platform import RoutingMatch
|
|
26
26
|
from .platform import RoutingTarget
|
27
27
|
from .platform import DeploymentConfig
|
28
28
|
|
29
|
-
from .
|
30
|
-
from .
|
29
|
+
from .runtime import RuntimeConfig
|
30
|
+
from .runtime import SparkSettings
|
tracdap/rt/config/common.py
CHANGED
@@ -44,7 +44,13 @@ class AuthenticationConfig:
|
|
44
44
|
|
45
45
|
jwtRefresh: "int" = 0
|
46
46
|
|
47
|
-
provider: "
|
47
|
+
provider: "PluginConfig" = _dc.field(default_factory=lambda: PluginConfig())
|
48
|
+
|
49
|
+
loginPath: "_tp.Optional[str]" = None
|
50
|
+
|
51
|
+
refreshPath: "_tp.Optional[str]" = None
|
52
|
+
|
53
|
+
returnPath: "_tp.Optional[str]" = None
|
48
54
|
|
49
55
|
disableAuth: "bool" = False
|
50
56
|
|
@@ -58,6 +64,8 @@ class AuthenticationConfig:
|
|
58
64
|
|
59
65
|
systemTicketRefresh: "int" = 0
|
60
66
|
|
67
|
+
externalSystems: "_tp.Dict[str, PluginConfig]" = _dc.field(default_factory=dict)
|
68
|
+
|
61
69
|
|
62
70
|
@_dc.dataclass
|
63
71
|
class StorageConfig:
|
@@ -81,3 +89,5 @@ class ServiceConfig:
|
|
81
89
|
alias: "str" = ""
|
82
90
|
|
83
91
|
port: "int" = 0
|
92
|
+
|
93
|
+
properties: "_tp.Dict[str, str]" = _dc.field(default_factory=dict)
|
tracdap/rt/config/platform.py
CHANGED
@@ -53,9 +53,9 @@ class PlatformConfig:
|
|
53
53
|
|
54
54
|
tenants: "_tp.Dict[str, TenantConfig]" = _dc.field(default_factory=dict)
|
55
55
|
|
56
|
-
webServer: "
|
56
|
+
webServer: "WebServerConfig" = _dc.field(default_factory=lambda: WebServerConfig())
|
57
57
|
|
58
|
-
gateway: "
|
58
|
+
gateway: "GatewayConfig" = _dc.field(default_factory=lambda: GatewayConfig())
|
59
59
|
|
60
60
|
services: "_tp.Dict[str, ServiceConfig]" = _dc.field(default_factory=dict)
|
61
61
|
|
@@ -81,8 +81,6 @@ class TenantConfig:
|
|
81
81
|
@_dc.dataclass
|
82
82
|
class WebServerConfig:
|
83
83
|
|
84
|
-
enabled: "bool" = False
|
85
|
-
|
86
84
|
contentRoot: "PluginConfig" = _dc.field(default_factory=lambda: PluginConfig())
|
87
85
|
|
88
86
|
rewriteRules: "_tp.List[WebServerRewriteRule]" = _dc.field(default_factory=list)
|
@@ -111,8 +109,6 @@ class WebServerRedirect:
|
|
111
109
|
@_dc.dataclass
|
112
110
|
class GatewayConfig:
|
113
111
|
|
114
|
-
idleTimeout: "int" = 0
|
115
|
-
|
116
112
|
routes: "_tp.List[RouteConfig]" = _dc.field(default_factory=list)
|
117
113
|
|
118
114
|
redirects: "_tp.List[WebServerRedirect]" = _dc.field(default_factory=list)
|
@@ -151,6 +147,8 @@ class RoutingTarget:
|
|
151
147
|
|
152
148
|
path: "str" = ""
|
153
149
|
|
150
|
+
hostAlias: "_tp.Optional[str]" = None
|
151
|
+
|
154
152
|
|
155
153
|
@_dc.dataclass
|
156
154
|
class DeploymentConfig:
|
tracdap/rt/launch/launch.py
CHANGED
@@ -112,9 +112,10 @@ def launch_model(
|
|
112
112
|
runtime_instance = _runtime.TracRuntime(_sys_config, dev_mode=True, plugin_packages=plugin_packages)
|
113
113
|
runtime_instance.pre_start()
|
114
114
|
|
115
|
-
job = runtime_instance.load_job_config(_job_config, model_class=model_class)
|
116
|
-
|
117
115
|
with runtime_instance as rt:
|
116
|
+
|
117
|
+
job = rt.load_job_config(_job_config, model_class=model_class)
|
118
|
+
|
118
119
|
rt.submit_job(job)
|
119
120
|
rt.wait_for_job(job.jobId)
|
120
121
|
|
@@ -160,9 +161,10 @@ def launch_job(
|
|
160
161
|
runtime_instance = _runtime.TracRuntime(_sys_config, dev_mode=dev_mode, plugin_packages=plugin_packages)
|
161
162
|
runtime_instance.pre_start()
|
162
163
|
|
163
|
-
job = runtime_instance.load_job_config(_job_config)
|
164
|
-
|
165
164
|
with runtime_instance as rt:
|
165
|
+
|
166
|
+
job = rt.load_job_config(_job_config)
|
167
|
+
|
166
168
|
rt.submit_job(job)
|
167
169
|
rt.wait_for_job(job.jobId)
|
168
170
|
|
@@ -184,6 +186,7 @@ def launch_cli(programmatic_args: _tp.Optional[_tp.List[str]] = None):
|
|
184
186
|
launch_args = _cli_args()
|
185
187
|
|
186
188
|
_sys_config = _resolve_config_file(launch_args.sys_config, None)
|
189
|
+
_job_config = _resolve_config_file(launch_args.job_config, None) if launch_args.job_config else None
|
187
190
|
|
188
191
|
runtime_instance = _runtime.TracRuntime(
|
189
192
|
_sys_config,
|
@@ -196,15 +199,10 @@ def launch_cli(programmatic_args: _tp.Optional[_tp.List[str]] = None):
|
|
196
199
|
|
197
200
|
runtime_instance.pre_start()
|
198
201
|
|
199
|
-
if launch_args.job_config is not None:
|
200
|
-
_job_config = _resolve_config_file(launch_args.job_config, None)
|
201
|
-
job = runtime_instance.load_job_config(_job_config)
|
202
|
-
else:
|
203
|
-
job = None
|
204
|
-
|
205
202
|
with runtime_instance as rt:
|
206
203
|
|
207
|
-
if
|
204
|
+
if _job_config is not None:
|
205
|
+
job = rt.load_job_config(_job_config)
|
208
206
|
rt.submit_job(job)
|
209
207
|
|
210
208
|
if rt.is_oneshot():
|
tracdap/rt/metadata/__init__.py
CHANGED
@@ -21,6 +21,9 @@ from .data import SchemaDefinition
|
|
21
21
|
from .data import PartKey
|
22
22
|
from .data import DataDefinition
|
23
23
|
|
24
|
+
from .file import FileDefinition
|
25
|
+
from .file import FileType
|
26
|
+
|
24
27
|
from .model import ModelType
|
25
28
|
from .model import ModelParameter
|
26
29
|
from .model import ModelInputSchema
|
@@ -56,9 +59,9 @@ from .job import JobGroup
|
|
56
59
|
from .job import SequentialJobGroup
|
57
60
|
from .job import ParallelJobGroup
|
58
61
|
|
59
|
-
from .
|
60
|
-
|
61
|
-
from .
|
62
|
+
from .common import MetadataFormat
|
63
|
+
from .common import MetadataVersion
|
64
|
+
from .common import TenantInfo
|
62
65
|
|
63
66
|
from .stoarge import CopyStatus
|
64
67
|
from .stoarge import IncarnationStatus
|
@@ -67,12 +70,10 @@ from .stoarge import StorageIncarnation
|
|
67
70
|
from .stoarge import StorageItem
|
68
71
|
from .stoarge import StorageDefinition
|
69
72
|
|
70
|
-
from .
|
71
|
-
|
72
|
-
from .resource import ResourceType
|
73
|
+
from .custom import CustomDefinition
|
73
74
|
|
74
|
-
from .
|
75
|
-
from .common import MetadataVersion
|
76
|
-
from .common import TenantInfo
|
75
|
+
from .object import ObjectDefinition
|
77
76
|
|
78
77
|
from .tag import Tag
|
78
|
+
|
79
|
+
from .resource import ResourceType
|