ob-metaflow-stubs 6.0.3.117__py2.py3-none-any.whl → 6.0.3.119__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- metaflow-stubs/__init__.pyi +318 -2738
- metaflow-stubs/cards.pyi +19 -473
- metaflow-stubs/cli.pyi +17 -81
- metaflow-stubs/client/__init__.pyi +19 -1113
- metaflow-stubs/client/core.pyi +18 -158
- metaflow-stubs/client/filecache.pyi +8 -12
- metaflow-stubs/clone_util.pyi +6 -26
- metaflow-stubs/events.pyi +7 -6
- metaflow-stubs/exception.pyi +8 -6
- metaflow-stubs/flowspec.pyi +20 -104
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +16 -564
- metaflow-stubs/info_file.pyi +6 -5
- metaflow-stubs/metadata_provider/__init__.pyi +16 -0
- metaflow-stubs/metadata_provider/heartbeat.pyi +34 -0
- metaflow-stubs/{metadata → metadata_provider}/metadata.pyi +10 -22
- metaflow-stubs/metadata_provider/util.pyi +19 -0
- metaflow-stubs/metaflow_config.pyi +8 -13
- metaflow-stubs/metaflow_current.pyi +45 -44
- metaflow-stubs/mf_extensions/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +129 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +26 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +156 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +25 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +111 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +188 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +30 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +28 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +19 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +115 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +40 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +71 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +56 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +67 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +49 -0
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +130 -0
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +42 -0
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +17 -0
- metaflow-stubs/mflog/__init__.pyi +6 -0
- metaflow-stubs/mflog/mflog.pyi +52 -5
- metaflow-stubs/multicore_utils.pyi +6 -5
- metaflow-stubs/parameters.pyi +13 -23
- metaflow-stubs/plugins/__init__.pyi +52 -165
- metaflow-stubs/plugins/airflow/__init__.pyi +9 -5
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +7 -6
- metaflow-stubs/plugins/airflow/exception.pyi +7 -11
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +10 -97
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +9 -30
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +9 -40
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +9 -40
- metaflow-stubs/plugins/argo/__init__.pyi +12 -5
- metaflow-stubs/plugins/argo/argo_client.pyi +8 -26
- metaflow-stubs/plugins/argo/argo_events.pyi +7 -11
- metaflow-stubs/plugins/argo/argo_workflows.pyi +17 -129
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +22 -460
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +11 -403
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +63 -448
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +165 -0
- metaflow-stubs/plugins/aws/__init__.pyi +11 -5
- metaflow-stubs/plugins/aws/aws_client.pyi +6 -5
- metaflow-stubs/plugins/aws/aws_utils.pyi +6 -11
- metaflow-stubs/plugins/aws/batch/__init__.pyi +9 -5
- metaflow-stubs/plugins/aws/batch/batch.pyi +10 -55
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +7 -11
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +15 -140
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +7 -5
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +10 -21
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +9 -5
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +6 -5
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +6 -5
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +7 -5
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +11 -65
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +6 -5
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +52 -292
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +127 -0
- metaflow-stubs/plugins/azure/__init__.pyi +12 -7
- metaflow-stubs/plugins/azure/azure_credential.pyi +6 -5
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +7 -11
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +11 -24
- metaflow-stubs/plugins/azure/azure_utils.pyi +11 -29
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +8 -23
- metaflow-stubs/plugins/azure/includefile_support.pyi +7 -17
- metaflow-stubs/plugins/cards/__init__.pyi +15 -5
- metaflow-stubs/plugins/cards/card_cli.pyi +22 -491
- metaflow-stubs/plugins/cards/card_client.pyi +14 -76
- metaflow-stubs/plugins/cards/card_creator.pyi +7 -10
- metaflow-stubs/plugins/cards/card_datastore.pyi +10 -18
- metaflow-stubs/plugins/cards/card_decorator.pyi +10 -126
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +13 -81
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +13 -96
- metaflow-stubs/plugins/cards/card_modules/card.pyi +6 -5
- metaflow-stubs/plugins/cards/card_modules/components.pyi +24 -107
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +6 -5
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +6 -12
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +11 -88
- metaflow-stubs/plugins/cards/card_resolver.pyi +6 -49
- metaflow-stubs/plugins/cards/component_serializer.pyi +13 -63
- metaflow-stubs/plugins/cards/exception.pyi +7 -11
- metaflow-stubs/plugins/catch_decorator.pyi +10 -30
- metaflow-stubs/plugins/datatools/__init__.pyi +13 -392
- metaflow-stubs/plugins/datatools/local.pyi +7 -11
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +19 -653
- metaflow-stubs/plugins/datatools/s3/s3.pyi +15 -263
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +7 -10
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +6 -11
- metaflow-stubs/plugins/debug_logger.pyi +7 -5
- metaflow-stubs/plugins/debug_monitor.pyi +7 -5
- metaflow-stubs/plugins/environment_decorator.pyi +7 -5
- metaflow-stubs/plugins/events_decorator.pyi +8 -14
- metaflow-stubs/plugins/frameworks/__init__.pyi +7 -5
- metaflow-stubs/plugins/frameworks/pytorch.pyi +8 -45
- metaflow-stubs/plugins/gcp/__init__.pyi +11 -7
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +11 -24
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +7 -11
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +6 -5
- metaflow-stubs/plugins/gcp/gs_utils.pyi +8 -20
- metaflow-stubs/plugins/gcp/includefile_support.pyi +7 -17
- metaflow-stubs/plugins/kubernetes/__init__.pyi +12 -5
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +6 -10
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +10 -38
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +16 -155
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +7 -11
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +19 -142
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +7 -11
- metaflow-stubs/plugins/logs_cli.pyi +10 -9
- metaflow-stubs/plugins/package_cli.pyi +7 -5
- metaflow-stubs/plugins/parallel_decorator.pyi +11 -59
- metaflow-stubs/plugins/perimeters.pyi +6 -11
- metaflow-stubs/plugins/project_decorator.pyi +8 -14
- metaflow-stubs/plugins/pypi/__init__.pyi +12 -11
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +8 -27
- metaflow-stubs/plugins/pypi/conda_environment.pyi +14 -20
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +7 -5
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +7 -39
- metaflow-stubs/plugins/pypi/utils.pyi +7 -11
- metaflow-stubs/plugins/resources_decorator.pyi +7 -5
- metaflow-stubs/plugins/retry_decorator.pyi +7 -11
- metaflow-stubs/plugins/secrets/__init__.pyi +9 -5
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +8 -13
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +7 -11
- metaflow-stubs/plugins/storage_executor.pyi +6 -11
- metaflow-stubs/plugins/tag_cli.pyi +14 -396
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +9 -34
- metaflow-stubs/plugins/timeout_decorator.pyi +8 -12
- metaflow-stubs/procpoll.pyi +7 -5
- metaflow-stubs/profilers/__init__.pyi +7 -11
- metaflow-stubs/pylint_wrapper.pyi +7 -11
- metaflow-stubs/runner/__init__.pyi +13 -5
- metaflow-stubs/runner/deployer.pyi +99 -223
- metaflow-stubs/runner/deployer_impl.pyi +87 -0
- metaflow-stubs/runner/metaflow_runner.pyi +24 -508
- metaflow-stubs/runner/nbdeploy.pyi +16 -60
- metaflow-stubs/runner/nbrun.pyi +11 -148
- metaflow-stubs/runner/subprocess_manager.pyi +9 -10
- metaflow-stubs/runner/utils.pyi +44 -9
- metaflow-stubs/system/__init__.pyi +9 -107
- metaflow-stubs/system/system_logger.pyi +7 -16
- metaflow-stubs/system/system_monitor.pyi +6 -16
- metaflow-stubs/tagging_util.pyi +6 -10
- metaflow-stubs/tuple_util.pyi +6 -5
- {ob_metaflow_stubs-6.0.3.117.dist-info → ob_metaflow_stubs-6.0.3.119.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.119.dist-info/RECORD +174 -0
- metaflow-stubs/metadata/util.pyi +0 -18
- ob_metaflow_stubs-6.0.3.117.dist-info/RECORD +0 -140
- {ob_metaflow_stubs-6.0.3.117.dist-info → ob_metaflow_stubs-6.0.3.119.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.117.dist-info → ob_metaflow_stubs-6.0.3.119.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.813236 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import typing
|
10
|
+
if typing.TYPE_CHECKING:
|
11
|
+
import metaflow
|
12
|
+
import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
13
|
+
|
14
|
+
from ..datastructures import CheckpointArtifact as CheckpointArtifact
|
15
|
+
from .constructors import load_checkpoint as load_checkpoint
|
16
|
+
from .exceptions import CheckpointNotAvailableException as CheckpointNotAvailableException
|
17
|
+
|
18
|
+
TYPE_CHECKING: bool
|
19
|
+
|
20
|
+
CHECKPOINT_UID_ENV_VAR_NAME: str
|
21
|
+
|
22
|
+
DEFAULT_NAME: str
|
23
|
+
|
24
|
+
TASK_CHECKPOINTS_ARTIFACT_NAME: str
|
25
|
+
|
26
|
+
DEFAULT_STORAGE_FORMAT: str
|
27
|
+
|
28
|
+
class Checkpoint(object, metaclass=type):
|
29
|
+
def __init__(self, temp_dir_root = None, init_dir = False):
|
30
|
+
...
|
31
|
+
@property
|
32
|
+
def directory(self):
|
33
|
+
...
|
34
|
+
def save(self, path = None, metadata = None, latest = True, name = 'mfchckpt', storage_format = 'files'):
|
35
|
+
"""
|
36
|
+
Saves the checkpoint to the datastore
|
37
|
+
|
38
|
+
Parameters
|
39
|
+
----------
|
40
|
+
path : Optional[Union[str, os.PathLike]], default: None
|
41
|
+
The path to save the checkpoint. Accepts a file path or a directory path.
|
42
|
+
- If a directory path is provided, all the contents within that directory will be saved.
|
43
|
+
When a checkpoint is reloaded during task retries, `the current.checkpoint.directory` will
|
44
|
+
contain the contents of this directory.
|
45
|
+
- If a file path is provided, the file will be directly saved to the datastore (with the same filename).
|
46
|
+
When the checkpoint is reloaded during task retries, the file with the same name will be available in the
|
47
|
+
`current.checkpoint.directory`.
|
48
|
+
- If no path is provided then the `Checkpoint.directory` will be saved as the checkpoint.
|
49
|
+
|
50
|
+
name : Optional[str], default: "mfchckpt"
|
51
|
+
The name of the checkpoint.
|
52
|
+
|
53
|
+
metadata : Optional[Dict], default: {}
|
54
|
+
Any metadata that needs to be saved with the checkpoint.
|
55
|
+
|
56
|
+
latest : bool, default: True
|
57
|
+
If True, the checkpoint will be marked as the latest checkpoint.
|
58
|
+
This helps determine if the checkpoint gets loaded when the task restarts.
|
59
|
+
|
60
|
+
storage_format : str, default: files
|
61
|
+
If `tar`, the contents of the directory will be tarred before saving to the datastore.
|
62
|
+
If `files`, saves directory directly to the datastore.
|
63
|
+
"""
|
64
|
+
...
|
65
|
+
def __enter__(self):
|
66
|
+
...
|
67
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
68
|
+
...
|
69
|
+
def list(self, name: typing.Optional[str] = None, task: typing.Union["metaflow.Task", str, None] = None, attempt: typing.Union[int, str, None] = None, as_dict: bool = True, within_task: bool = True) -> typing.Iterable[typing.Union[typing.Dict, metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.CheckpointArtifact]]:
|
70
|
+
"""
|
71
|
+
lists the checkpoints in the datastore based on the Task.
|
72
|
+
It will always be task scoped.
|
73
|
+
|
74
|
+
Usage:
|
75
|
+
------
|
76
|
+
|
77
|
+
```python
|
78
|
+
|
79
|
+
Checkpoint().list(name="best") # lists checkpoints in the current task with the name "best"
|
80
|
+
Checkpoint().list(task="anotherflow/somerunid/somestep/sometask", name="best") # Identical as the above one but
|
81
|
+
Checkpoint().list() # lists all the checkpoints in the current task
|
82
|
+
|
83
|
+
```
|
84
|
+
|
85
|
+
Parameters
|
86
|
+
----------
|
87
|
+
|
88
|
+
- `name`:
|
89
|
+
- name of the checkpoint to filter for
|
90
|
+
- `task`:
|
91
|
+
- Task object outside the one that is currently set in the `Checkpoint` object; Can be a pathspec string.
|
92
|
+
- `attempt`:
|
93
|
+
- attempt number of the task (optional filter. If none, then lists all checkpoints from all attempts)
|
94
|
+
"""
|
95
|
+
...
|
96
|
+
def load(self, reference: typing.Union[str, typing.Dict, metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.CheckpointArtifact], path: typing.Optional[str] = None):
|
97
|
+
"""
|
98
|
+
loads a checkpoint reference from the datastore. (resembles a read op)
|
99
|
+
|
100
|
+
Parameters
|
101
|
+
----------
|
102
|
+
|
103
|
+
`reference` :
|
104
|
+
- can be a string, dict or a CheckpointArtifact object:
|
105
|
+
- string: a string reference to the checkpoint (checkpoint key)
|
106
|
+
- dict: a dictionary reference to the checkpoint
|
107
|
+
- CheckpointArtifact: a CheckpointArtifact object reference to the checkpoint
|
108
|
+
"""
|
109
|
+
...
|
110
|
+
...
|
111
|
+
|
metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.836248 #
|
5
|
+
######################################################################################################
|
6
|
+
|
metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.867198 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import typing
|
10
|
+
if typing.TYPE_CHECKING:
|
11
|
+
import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastore.core
|
12
|
+
import metaflow.datastore.datastore_storage
|
13
|
+
|
14
|
+
from ......exception import MetaflowException as MetaflowException
|
15
|
+
from ..utils.tar_utils import create_tarball_on_disk as create_tarball_on_disk
|
16
|
+
from ..utils.tar_utils import extract_tarball as extract_tarball
|
17
|
+
from ..utils.general import safe_serialize as safe_serialize
|
18
|
+
from ..exceptions import KeyNotFoundError as KeyNotFoundError
|
19
|
+
|
20
|
+
STORAGE_INJECTIONS_SINGLE_FILE_SAVE: dict
|
21
|
+
|
22
|
+
STORAGE_INJECTIONS_MULTIPLE_FILE_SAVE: dict
|
23
|
+
|
24
|
+
STORAGE_INJECTIONS_LOAD_FILES: dict
|
25
|
+
|
26
|
+
class DatastoreBlob(tuple, metaclass=type):
|
27
|
+
"""
|
28
|
+
DatastoreBlob(blob, url, path)
|
29
|
+
"""
|
30
|
+
@staticmethod
|
31
|
+
def __new__(_cls, blob, url, path):
|
32
|
+
"""
|
33
|
+
Create new instance of DatastoreBlob(blob, url, path)
|
34
|
+
"""
|
35
|
+
...
|
36
|
+
def __repr__(self):
|
37
|
+
"""
|
38
|
+
Return a nicely formatted representation string
|
39
|
+
"""
|
40
|
+
...
|
41
|
+
def __getnewargs__(self):
|
42
|
+
"""
|
43
|
+
Return self as a plain tuple. Used by copy and pickle.
|
44
|
+
"""
|
45
|
+
...
|
46
|
+
...
|
47
|
+
|
48
|
+
class ListPathResult(tuple, metaclass=type):
|
49
|
+
"""
|
50
|
+
ListPathResult(full_url, key)
|
51
|
+
"""
|
52
|
+
@staticmethod
|
53
|
+
def __new__(_cls, full_url, key):
|
54
|
+
"""
|
55
|
+
Create new instance of ListPathResult(full_url, key)
|
56
|
+
"""
|
57
|
+
...
|
58
|
+
def __repr__(self):
|
59
|
+
"""
|
60
|
+
Return a nicely formatted representation string
|
61
|
+
"""
|
62
|
+
...
|
63
|
+
def __getnewargs__(self):
|
64
|
+
"""
|
65
|
+
Return self as a plain tuple. Used by copy and pickle.
|
66
|
+
"""
|
67
|
+
...
|
68
|
+
...
|
69
|
+
|
70
|
+
COMPRESSION_METHOD: None
|
71
|
+
|
72
|
+
class STORAGE_FORMATS(object, metaclass=type):
|
73
|
+
...
|
74
|
+
|
75
|
+
def warning_message(message, logger = None, ts = False, prefix = '[@checkpoint][artifact-store]'):
|
76
|
+
...
|
77
|
+
|
78
|
+
def allow_safe(func):
|
79
|
+
...
|
80
|
+
|
81
|
+
class ObjectStorage(object, metaclass=type):
|
82
|
+
"""
|
83
|
+
`ObjectStorage` wraps around the DataStoreStorage object and provides the lower level
|
84
|
+
storage APIs needed by the subsequent classes. This datastore's main function that
|
85
|
+
distingushes it from the DataStoreStorage object is that it manages a generalizable
|
86
|
+
path structure over different storage backends (s3, azure, gs, local etc.).
|
87
|
+
|
88
|
+
This object will be used to create multiple "Logical" datastores for constructs like
|
89
|
+
`Checkpoints`, `Models` etc.
|
90
|
+
|
91
|
+
Usage
|
92
|
+
-----
|
93
|
+
```
|
94
|
+
storage = ObjectStorage(
|
95
|
+
storage_backend,
|
96
|
+
root_prefix = "mf.checkpoints",
|
97
|
+
path_components = ["artifacts", "MyFlow", "step_a", "cd2312rd12d", "x5avasdhtsdfqw"]
|
98
|
+
)
|
99
|
+
```
|
100
|
+
"""
|
101
|
+
def __init__(self, storage_backend: metaflow.datastore.datastore_storage.DataStoreStorage, root_prefix: str, path_components: typing.List):
|
102
|
+
...
|
103
|
+
@property
|
104
|
+
def path_components(self):
|
105
|
+
...
|
106
|
+
def set_full_prefix(self, root_prefix):
|
107
|
+
...
|
108
|
+
@staticmethod
|
109
|
+
def resolve_root(storage_type):
|
110
|
+
...
|
111
|
+
def full_base_url(self, prefix = None):
|
112
|
+
...
|
113
|
+
def create_key_name(self, *args):
|
114
|
+
...
|
115
|
+
@property
|
116
|
+
def datastore_root(self):
|
117
|
+
...
|
118
|
+
def resolve_key_relative_path(self, key):
|
119
|
+
...
|
120
|
+
def resolve_key_full_url(self, key):
|
121
|
+
...
|
122
|
+
def resolve_key_path(self, key):
|
123
|
+
...
|
124
|
+
def put(self, key: str, obj: typing.Union[str, bytes], overwrite: bool = False) -> str:
|
125
|
+
"""
|
126
|
+
TODO : [THIS IS TERRIBLY INEFFICIENT]
|
127
|
+
"""
|
128
|
+
...
|
129
|
+
def put_file(self, key: str, path: str, overwrite = False):
|
130
|
+
...
|
131
|
+
def put_files(self, key_paths: typing.List[typing.Tuple[str, str]], overwrite = False):
|
132
|
+
...
|
133
|
+
def get(self, key) -> DatastoreBlob:
|
134
|
+
"""
|
135
|
+
TODO : [THIS IS TERRIBLY INEFFICIENT]
|
136
|
+
"""
|
137
|
+
...
|
138
|
+
def get_file(self, key):
|
139
|
+
...
|
140
|
+
def list_paths(self, keys) -> typing.Iterator[ListPathResult]:
|
141
|
+
"""
|
142
|
+
List all objects in the datastore's `keys` index.
|
143
|
+
"""
|
144
|
+
...
|
145
|
+
...
|
146
|
+
|
147
|
+
class DatastoreInterface(object, metaclass=type):
|
148
|
+
"""
|
149
|
+
This is the root abstraction used by any underlying datastores like Checkpoint/Model etc.
|
150
|
+
to create the saving/loading mechanics using multiple ObjectStores.
|
151
|
+
|
152
|
+
The inherited classes require the following implemented:
|
153
|
+
- `ROOT_PREFIX` : The root prefix for the datastore such as `mf.checkpoints` or `mf.models`.
|
154
|
+
- `init_read_store` : The method to initialize the read store; The inheriting class can compose together any number of `BaseDatastore` objects
|
155
|
+
- `init_write_store` : The method to initialize the write store; The inheriting class can compose together any number of `BaseDatastore` objects
|
156
|
+
- `save` : The method to save the artifact data.
|
157
|
+
- `load` : The method to load the artifact data.
|
158
|
+
- `save_metadata` : The method to save the metadata about the artifact.
|
159
|
+
- `load_metadata` : The method to load the metadata about the artifact.
|
160
|
+
- `list` : The method to list all the artifacts.
|
161
|
+
"""
|
162
|
+
def set_root_prefix(self, root_prefix):
|
163
|
+
"""
|
164
|
+
This function helps ensuring that the root prefix of the datastore
|
165
|
+
and it's underlying ObjectStores can change trivially.
|
166
|
+
"""
|
167
|
+
...
|
168
|
+
def save(self, *args, **kwargs):
|
169
|
+
...
|
170
|
+
def load(self, *args, **kwargs):
|
171
|
+
...
|
172
|
+
def save_metadata(self, *args, **kwargs):
|
173
|
+
...
|
174
|
+
def load_metadata(self, *args, **kwargs):
|
175
|
+
...
|
176
|
+
def list(self, *args, **kwargs):
|
177
|
+
...
|
178
|
+
@classmethod
|
179
|
+
def init_read_store(cls, storage_backend: metaflow.datastore.datastore_storage.DataStoreStorage, *args, **kwargs):
|
180
|
+
...
|
181
|
+
@classmethod
|
182
|
+
def init_write_store(cls, storage_backend: metaflow.datastore.datastore_storage.DataStoreStorage, *args, **kwargs):
|
183
|
+
...
|
184
|
+
...
|
185
|
+
|
186
|
+
def resolve_root(datastore_type):
|
187
|
+
...
|
188
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.887397 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import metaflow
|
10
|
+
import typing
|
11
|
+
if typing.TYPE_CHECKING:
|
12
|
+
import metaflow.exception
|
13
|
+
|
14
|
+
from ......exception import MetaflowException as MetaflowException
|
15
|
+
|
16
|
+
class DatastoreReadInitException(metaflow.exception.MetaflowException, metaclass=type):
|
17
|
+
def __init__(self, message):
|
18
|
+
...
|
19
|
+
...
|
20
|
+
|
21
|
+
class DatastoreWriteInitException(metaflow.exception.MetaflowException, metaclass=type):
|
22
|
+
def __init__(self, message):
|
23
|
+
...
|
24
|
+
...
|
25
|
+
|
26
|
+
class DatastoreNotReadyException(metaflow.exception.MetaflowException, metaclass=type):
|
27
|
+
def __init__(self, message):
|
28
|
+
...
|
29
|
+
...
|
30
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.836299 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import metaflow
|
10
|
+
import typing
|
11
|
+
if typing.TYPE_CHECKING:
|
12
|
+
import metaflow
|
13
|
+
import metaflow.exception
|
14
|
+
|
15
|
+
from ......exception import MetaflowException as MetaflowException
|
16
|
+
from .core import resolve_root as resolve_root
|
17
|
+
|
18
|
+
TYPE_CHECKING: bool
|
19
|
+
|
20
|
+
class UnresolvableDatastoreException(metaflow.exception.MetaflowException, metaclass=type):
|
21
|
+
...
|
22
|
+
|
23
|
+
def init_datastorage_object():
|
24
|
+
...
|
25
|
+
|
26
|
+
def resolve_storage_backend(pathspec: typing.Union[str, "metaflow.Task"] = None):
|
27
|
+
...
|
28
|
+
|
metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.887615 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
def is_json_serializable(value):
|
12
|
+
"""
|
13
|
+
Check if value is JSON serializable.
|
14
|
+
"""
|
15
|
+
...
|
16
|
+
|
17
|
+
def safe_serialize(data):
|
18
|
+
...
|
19
|
+
|
metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.814163 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import metaflow
|
10
|
+
import typing
|
11
|
+
if typing.TYPE_CHECKING:
|
12
|
+
import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
13
|
+
|
14
|
+
from .exceptions import KeyNotCompatibleWithObjectException as KeyNotCompatibleWithObjectException
|
15
|
+
from .exceptions import KeyNotCompatibleException as KeyNotCompatibleException
|
16
|
+
from .exceptions import IncompatibleObjectTypeException as IncompatibleObjectTypeException
|
17
|
+
from .datastore.task_utils import init_datastorage_object as init_datastorage_object
|
18
|
+
|
19
|
+
class MetaflowDataArtifactReference(object, metaclass=type):
|
20
|
+
@property
|
21
|
+
def size(self):
|
22
|
+
...
|
23
|
+
@property
|
24
|
+
def url(self):
|
25
|
+
...
|
26
|
+
@property
|
27
|
+
def key(self):
|
28
|
+
...
|
29
|
+
@property
|
30
|
+
def pathspec(self):
|
31
|
+
...
|
32
|
+
@property
|
33
|
+
def attempt(self):
|
34
|
+
...
|
35
|
+
@property
|
36
|
+
def created_on(self):
|
37
|
+
...
|
38
|
+
@property
|
39
|
+
def metadata(self):
|
40
|
+
...
|
41
|
+
def __init__(self, **kwargs):
|
42
|
+
...
|
43
|
+
def validate(self, data):
|
44
|
+
...
|
45
|
+
@classmethod
|
46
|
+
def from_dict(cls, data) -> typing.Union["ModelArtifact", "CheckpointArtifact"]:
|
47
|
+
...
|
48
|
+
@classmethod
|
49
|
+
def hydrate(cls, data: typing.Union["ModelArtifact", "CheckpointArtifact", dict]):
|
50
|
+
...
|
51
|
+
def to_dict(self):
|
52
|
+
...
|
53
|
+
...
|
54
|
+
|
55
|
+
class ModelArtifact(MetaflowDataArtifactReference, metaclass=type):
|
56
|
+
def __init__(self, **kwargs):
|
57
|
+
...
|
58
|
+
@property
|
59
|
+
def blob(self):
|
60
|
+
...
|
61
|
+
@property
|
62
|
+
def uuid(self):
|
63
|
+
...
|
64
|
+
@property
|
65
|
+
def serializer(self):
|
66
|
+
...
|
67
|
+
@property
|
68
|
+
def source(self):
|
69
|
+
...
|
70
|
+
@property
|
71
|
+
def storage_format(self):
|
72
|
+
...
|
73
|
+
@classmethod
|
74
|
+
def create(cls, pathspec = None, attempt = None, key = None, url = None, model_uuid = None, metadata = None, storage_format = None, source = None, serializer = None, label = None):
|
75
|
+
...
|
76
|
+
...
|
77
|
+
|
78
|
+
class CheckpointArtifact(MetaflowDataArtifactReference, metaclass=type):
|
79
|
+
@property
|
80
|
+
def storage_format(self):
|
81
|
+
...
|
82
|
+
@property
|
83
|
+
def version_id(self):
|
84
|
+
...
|
85
|
+
@property
|
86
|
+
def name(self):
|
87
|
+
...
|
88
|
+
def __init__(self, **kwargs):
|
89
|
+
...
|
90
|
+
...
|
91
|
+
|
92
|
+
class Factory(object, metaclass=type):
|
93
|
+
@classmethod
|
94
|
+
def hydrate(cls, data):
|
95
|
+
...
|
96
|
+
@classmethod
|
97
|
+
def from_dict(cls, data):
|
98
|
+
...
|
99
|
+
@classmethod
|
100
|
+
def load(cls, data, local_path, storage_backend):
|
101
|
+
...
|
102
|
+
@classmethod
|
103
|
+
def object_type_from_key(cls, reference_key):
|
104
|
+
...
|
105
|
+
@classmethod
|
106
|
+
def load_from_key(cls, key_object, local_path, storage_backend):
|
107
|
+
...
|
108
|
+
@classmethod
|
109
|
+
def load_metadata_from_key(cls, key_object, storage_backend) -> typing.Union[CheckpointArtifact, ModelArtifact]:
|
110
|
+
...
|
111
|
+
...
|
112
|
+
|
113
|
+
def load_model(reference: typing.Union[str, MetaflowDataArtifactReference, dict], path: str):
|
114
|
+
...
|
115
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.835960 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import metaflow
|
10
|
+
import typing
|
11
|
+
if typing.TYPE_CHECKING:
|
12
|
+
import metaflow.exception
|
13
|
+
|
14
|
+
from .....exception import MetaflowException as MetaflowException
|
15
|
+
|
16
|
+
class TODOException(metaflow.exception.MetaflowException, metaclass=type):
|
17
|
+
def __init__(self, message):
|
18
|
+
...
|
19
|
+
...
|
20
|
+
|
21
|
+
class KeyNotFoundError(metaflow.exception.MetaflowException, metaclass=type):
|
22
|
+
def __init__(self, url):
|
23
|
+
...
|
24
|
+
...
|
25
|
+
|
26
|
+
class KeyNotCompatibleException(metaflow.exception.MetaflowException, metaclass=type):
|
27
|
+
def __init__(self, key, supported_types):
|
28
|
+
...
|
29
|
+
...
|
30
|
+
|
31
|
+
class KeyNotCompatibleWithObjectException(metaflow.exception.MetaflowException, metaclass=type):
|
32
|
+
def __init__(self, key, store, message = None):
|
33
|
+
...
|
34
|
+
...
|
35
|
+
|
36
|
+
class IncompatibleObjectTypeException(metaflow.exception.MetaflowException, metaclass=type):
|
37
|
+
def __init__(self, message):
|
38
|
+
...
|
39
|
+
...
|
40
|
+
|
metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.875777 #
|
5
|
+
######################################################################################################
|
6
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.875831 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import typing
|
10
|
+
if typing.TYPE_CHECKING:
|
11
|
+
import metaflow
|
12
|
+
|
13
|
+
from ......metaflow_current import current as current
|
14
|
+
from .identity_utils import TaskIdentifier as TaskIdentifier
|
15
|
+
from .identity_utils import FlowNotRunningException as FlowNotRunningException
|
16
|
+
|
17
|
+
TYPE_CHECKING: bool
|
18
|
+
|
19
|
+
class ResolvedTask(tuple, metaclass=type):
|
20
|
+
"""
|
21
|
+
ResolvedTask(flow_name, run_id, step_name, task_id, is_foreach, current_attempt, pathspec, control_task_pathspec)
|
22
|
+
"""
|
23
|
+
@staticmethod
|
24
|
+
def __new__(_cls, flow_name, run_id, step_name, task_id, is_foreach, current_attempt, pathspec, control_task_pathspec):
|
25
|
+
"""
|
26
|
+
Create new instance of ResolvedTask(flow_name, run_id, step_name, task_id, is_foreach, current_attempt, pathspec, control_task_pathspec)
|
27
|
+
"""
|
28
|
+
...
|
29
|
+
def __repr__(self):
|
30
|
+
"""
|
31
|
+
Return a nicely formatted representation string
|
32
|
+
"""
|
33
|
+
...
|
34
|
+
def __getnewargs__(self):
|
35
|
+
"""
|
36
|
+
Return self as a plain tuple. Used by copy and pickle.
|
37
|
+
"""
|
38
|
+
...
|
39
|
+
...
|
40
|
+
|
41
|
+
class OriginInfo(tuple, metaclass=type):
|
42
|
+
"""
|
43
|
+
OriginInfo(origin_run_id, origin_task_id, origin_attempt, is_foreach)
|
44
|
+
"""
|
45
|
+
@staticmethod
|
46
|
+
def __new__(_cls, origin_run_id, origin_task_id, origin_attempt, is_foreach):
|
47
|
+
"""
|
48
|
+
Create new instance of OriginInfo(origin_run_id, origin_task_id, origin_attempt, is_foreach)
|
49
|
+
"""
|
50
|
+
...
|
51
|
+
def __repr__(self):
|
52
|
+
"""
|
53
|
+
Return a nicely formatted representation string
|
54
|
+
"""
|
55
|
+
...
|
56
|
+
def __getnewargs__(self):
|
57
|
+
"""
|
58
|
+
Return self as a plain tuple. Used by copy and pickle.
|
59
|
+
"""
|
60
|
+
...
|
61
|
+
...
|
62
|
+
|
63
|
+
def resolve_pathspec_for_flowspec(run: "metaflow.FlowSpec" = None):
|
64
|
+
...
|
65
|
+
|
66
|
+
def resolve_storage_backend(run: "metaflow.FlowSpec" = None):
|
67
|
+
...
|
68
|
+
|
69
|
+
def resolve_task_identifier(run: "metaflow.FlowSpec", gang_scheduled_task = False, gang_schedule_task_idf_index = 0):
|
70
|
+
...
|
71
|
+
|
metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.2+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-21T22:12:20.877625 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
import typing
|
10
|
+
if typing.TYPE_CHECKING:
|
11
|
+
import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.utils.general
|
12
|
+
|
13
|
+
|
14
|
+
class PathSize(tuple, metaclass=type):
|
15
|
+
"""
|
16
|
+
PathSize(path, calculated_size, early_stopping, not_found)
|
17
|
+
"""
|
18
|
+
@staticmethod
|
19
|
+
def __new__(_cls, path, calculated_size, early_stopping, not_found):
|
20
|
+
"""
|
21
|
+
Create new instance of PathSize(path, calculated_size, early_stopping, not_found)
|
22
|
+
"""
|
23
|
+
...
|
24
|
+
def __repr__(self):
|
25
|
+
"""
|
26
|
+
Return a nicely formatted representation string
|
27
|
+
"""
|
28
|
+
...
|
29
|
+
def __getnewargs__(self):
|
30
|
+
"""
|
31
|
+
Return self as a plain tuple. Used by copy and pickle.
|
32
|
+
"""
|
33
|
+
...
|
34
|
+
...
|
35
|
+
|
36
|
+
def replace_start_and_end_slash(string):
|
37
|
+
...
|
38
|
+
|
39
|
+
def get_path_size(start_path, early_stopping_limit = None) -> PathSize:
|
40
|
+
...
|
41
|
+
|
42
|
+
def warning_message(message, logger = None, ts = False, prefix = '[no-prefix]'):
|
43
|
+
...
|
44
|
+
|
45
|
+
def unit_convert(number, base_unit, convert_unit):
|
46
|
+
...
|
47
|
+
|
48
|
+
def is_json_serializable(value):
|
49
|
+
"""
|
50
|
+
Check if value is JSON serializable.
|
51
|
+
"""
|
52
|
+
...
|
53
|
+
|
54
|
+
def safe_serialize(data):
|
55
|
+
...
|
56
|
+
|