tracdap-runtime 0.5.30__py3-none-any.whl → 0.6.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.
Files changed (45) hide show
  1. tracdap/rt/_exec/dev_mode.py +2 -1
  2. tracdap/rt/_impl/data.py +1 -28
  3. tracdap/rt/_impl/static_api.py +5 -1
  4. tracdap/rt/_impl/storage.py +586 -10
  5. tracdap/rt/_impl/util.py +24 -3
  6. tracdap/rt/_plugins/_helpers.py +26 -25
  7. tracdap/rt/_plugins/storage_aws.py +162 -76
  8. tracdap/rt/_plugins/storage_azure.py +155 -0
  9. tracdap/rt/_plugins/storage_gcp.py +183 -0
  10. tracdap/rt/_plugins/storage_local.py +249 -98
  11. tracdap/rt/_version.py +1 -1
  12. tracdap/rt/api/static_api.py +2 -1
  13. tracdap/rt/config/__init__.py +8 -13
  14. tracdap/rt/config/common.py +10 -0
  15. tracdap/rt/config/common_pb2.py +38 -31
  16. tracdap/rt/config/job_pb2.py +21 -20
  17. tracdap/rt/config/platform.py +60 -25
  18. tracdap/rt/config/platform_pb2.py +52 -45
  19. tracdap/rt/config/result_pb2.py +15 -14
  20. tracdap/rt/config/runtime.py +0 -1
  21. tracdap/rt/config/runtime_pb2.py +24 -24
  22. tracdap/rt/exceptions.py +9 -0
  23. tracdap/rt/ext/plugins.py +0 -12
  24. tracdap/rt/ext/storage.py +47 -29
  25. tracdap/rt/metadata/common_pb2.py +15 -14
  26. tracdap/rt/metadata/custom_pb2.py +9 -8
  27. tracdap/rt/metadata/data_pb2.py +31 -30
  28. tracdap/rt/metadata/file_pb2.py +9 -8
  29. tracdap/rt/metadata/flow_pb2.py +33 -32
  30. tracdap/rt/metadata/job_pb2.py +55 -54
  31. tracdap/rt/metadata/model_pb2.py +31 -30
  32. tracdap/rt/metadata/object_id_pb2.py +13 -12
  33. tracdap/rt/metadata/object_pb2.py +9 -8
  34. tracdap/rt/metadata/search_pb2.py +19 -18
  35. tracdap/rt/metadata/stoarge_pb2.py +31 -30
  36. tracdap/rt/metadata/tag_pb2.py +13 -12
  37. tracdap/rt/metadata/tag_update_pb2.py +11 -10
  38. tracdap/rt/metadata/type_pb2.py +29 -28
  39. {tracdap_runtime-0.5.30.dist-info → tracdap_runtime-0.6.0.dist-info}/METADATA +26 -15
  40. {tracdap_runtime-0.5.30.dist-info → tracdap_runtime-0.6.0.dist-info}/RECORD +43 -43
  41. tracdap/rt/config/gateway.py +0 -104
  42. tracdap/rt/config/gateway_pb2.py +0 -45
  43. {tracdap_runtime-0.5.30.dist-info → tracdap_runtime-0.6.0.dist-info}/LICENSE +0 -0
  44. {tracdap_runtime-0.5.30.dist-info → tracdap_runtime-0.6.0.dist-info}/WHEEL +0 -0
  45. {tracdap_runtime-0.5.30.dist-info → tracdap_runtime-0.6.0.dist-info}/top_level.txt +0 -0
@@ -648,7 +648,8 @@ class DevModeTranslator:
648
648
  x_name = x_orig_path.name
649
649
 
650
650
  if x_storage.exists(str(x_orig_path.parent)):
651
- existing_files = x_storage.ls(str(x_orig_path.parent))
651
+ listing = x_storage.ls(str(x_orig_path.parent))
652
+ existing_files = list(map(lambda stat: stat.file_name, listing))
652
653
  else:
653
654
  existing_files = []
654
655
 
tracdap/rt/_impl/data.py CHANGED
@@ -330,7 +330,7 @@ class DataMapping:
330
330
  DataConformance.check_duplicate_fields(table.schema.names, False)
331
331
 
332
332
  # Use Arrow's built-in function to convert to Pandas
333
- df_from_arrow = table.to_pandas(
333
+ return table.to_pandas(
334
334
 
335
335
  # Mapping for arrow -> pandas types for core types
336
336
  types_mapper=cls.__ARROW_TO_PANDAS_TYPE_MAPPING.get,
@@ -346,33 +346,6 @@ class DataMapping:
346
346
  # This is a significant performance win for very wide datasets
347
347
  split_blocks=True) # noqa
348
348
 
349
- # Arrow 12 doesn't support the new precision handling for datetime values supported in Pandas 2
350
- # However Arrow 13 dropped support for Python 3.7, which is a requirement for the TRAC 0.5.x series
351
- # So to backport Pandas 2 support, special handling is needed for datetime fields when using Pandas 2
352
- # This is not needed from TRAC 0.6 onward, which upgrades to Arrow 13 and drops Python 3.7 support
353
- # Also it is not needed if the temporal objects flag is set, since it only affects NumPy datetime64
354
-
355
- if cls.__PANDAS_MAJOR_VERSION == 2 and not temporal_objects_flag:
356
- # Use table.schema, it is always present and has been normalized if a separate schema was supplied
357
- return cls._fix_pandas_2_datetime_precision(df_from_arrow, table.schema)
358
- else:
359
- return df_from_arrow
360
-
361
- @classmethod
362
- def _fix_pandas_2_datetime_precision(cls, df: pd.DataFrame, schema: pa.Schema) -> pd.DataFrame:
363
-
364
- for field in schema:
365
- if pa.types.is_date(field.type):
366
- dtype = cls.__PANDAS_DATE_TYPE
367
- if df[field.name].dtype != dtype:
368
- df[field.name] = df[field.name].astype(dtype)
369
- if pa.types.is_timestamp(field.type):
370
- dtype = cls.__pandas_datetime_type(field.type.tz, field.type.unit)
371
- if df[field.name].dtype != dtype:
372
- df[field.name] = df[field.name].astype(dtype)
373
-
374
- return df
375
-
376
349
  @classmethod
377
350
  def pandas_to_arrow(cls, df: pd.DataFrame, schema: tp.Optional[pa.Schema] = None) -> pa.Table:
378
351
 
@@ -82,7 +82,11 @@ class StaticApiImpl(_StaticApiHook):
82
82
  param_type_descriptor = _meta.TypeDescriptor(param_type, None, None)
83
83
 
84
84
  if default_value is not None and not isinstance(default_value, _meta.Value):
85
- default_value = _type_system.MetadataCodec.encode_value(default_value)
85
+ try:
86
+ default_value = _type_system.MetadataCodec.convert_value(default_value, param_type_descriptor)
87
+ except _ex.ETrac as e:
88
+ msg = f"Default value for parameter [{param_name}] does not match the declared type"
89
+ raise _ex.EModelValidation(msg) from e
86
90
 
87
91
  return _Named(param_name, _meta.ModelParameter(param_type_descriptor, label, default_value))
88
92