ob-metaflow-stubs 6.0.3.117__py2.py3-none-any.whl → 6.0.3.118__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 +319 -2739
- 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 +6 -5
- metaflow-stubs/exception.pyi +8 -6
- metaflow-stubs/flowspec.pyi +22 -106
- 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 +134 -133
- 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 +18 -130
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +22 -460
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +12 -404
- 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 +13 -75
- 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 +16 -264
- 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 +8 -33
- 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 +6 -15
- 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.118.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.118.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.118.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.117.dist-info → ob_metaflow_stubs-6.0.3.118.dist-info}/top_level.txt +0 -0
metaflow-stubs/includefile.pyi
CHANGED
@@ -1,574 +1,26 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-11-
|
5
|
-
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-13T23:34:52.838778 #
|
5
|
+
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
|
+
import metaflow
|
9
10
|
import typing
|
10
11
|
if typing.TYPE_CHECKING:
|
11
|
-
import metaflow.plugins.datatools.s3.s3
|
12
|
-
import typing
|
13
|
-
import io
|
14
12
|
import metaflow.parameters
|
15
13
|
import metaflow._vendor.click.types
|
14
|
+
import typing
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
class DelayedEvaluationParameter(object, metaclass=type):
|
25
|
-
"""
|
26
|
-
This is a very simple wrapper to allow parameter "conversion" to be delayed until
|
27
|
-
the `_set_constants` function in FlowSpec. Typically, parameters are converted
|
28
|
-
by click when the command line option is processed. For some parameters, like
|
29
|
-
IncludeFile, this is too early as it would mean we would trigger the upload
|
30
|
-
of the file too early. If a parameter converts to a DelayedEvaluationParameter
|
31
|
-
object through the usual click mechanisms, `_set_constants` knows to invoke the
|
32
|
-
__call__ method on that DelayedEvaluationParameter; in that case, the __call__
|
33
|
-
method is invoked without any parameter. The return_str parameter will be used
|
34
|
-
by schedulers when they need to convert DelayedEvaluationParameters to a
|
35
|
-
string to store them
|
36
|
-
"""
|
37
|
-
def __init__(self, name, field, fun):
|
38
|
-
...
|
39
|
-
def __call__(self, return_str = False):
|
40
|
-
...
|
41
|
-
...
|
42
|
-
|
43
|
-
class DeployTimeField(object, metaclass=type):
|
44
|
-
"""
|
45
|
-
This a wrapper object for a user-defined function that is called
|
46
|
-
at deploy time to populate fields in a Parameter. The wrapper
|
47
|
-
is needed to make Click show the actual value returned by the
|
48
|
-
function instead of a function pointer in its help text. Also, this
|
49
|
-
object curries the context argument for the function, and pretty
|
50
|
-
prints any exceptions that occur during evaluation.
|
51
|
-
"""
|
52
|
-
def __init__(self, parameter_name, parameter_type, field, fun, return_str = True, print_representation = None):
|
53
|
-
...
|
54
|
-
def __call__(self, deploy_time = False):
|
55
|
-
...
|
56
|
-
@property
|
57
|
-
def description(self):
|
58
|
-
...
|
59
|
-
def __str__(self):
|
60
|
-
...
|
61
|
-
def __repr__(self):
|
62
|
-
...
|
63
|
-
...
|
64
|
-
|
65
|
-
class Parameter(object, metaclass=type):
|
66
|
-
"""
|
67
|
-
Defines a parameter for a flow.
|
68
|
-
|
69
|
-
Parameters must be instantiated as class variables in flow classes, e.g.
|
70
|
-
```
|
71
|
-
class MyFlow(FlowSpec):
|
72
|
-
param = Parameter('myparam')
|
73
|
-
```
|
74
|
-
in this case, the parameter is specified on the command line as
|
75
|
-
```
|
76
|
-
python myflow.py run --myparam=5
|
77
|
-
```
|
78
|
-
and its value is accessible through a read-only artifact like this:
|
79
|
-
```
|
80
|
-
print(self.param == 5)
|
81
|
-
```
|
82
|
-
Note that the user-visible parameter name, `myparam` above, can be
|
83
|
-
different from the artifact name, `param` above.
|
84
|
-
|
85
|
-
The parameter value is converted to a Python type based on the `type`
|
86
|
-
argument or to match the type of `default`, if it is set.
|
87
|
-
|
88
|
-
Parameters
|
89
|
-
----------
|
90
|
-
name : str
|
91
|
-
User-visible parameter name.
|
92
|
-
default : str or float or int or bool or `JSONType` or a function.
|
93
|
-
Default value for the parameter. Use a special `JSONType` class to
|
94
|
-
indicate that the value must be a valid JSON object. A function
|
95
|
-
implies that the parameter corresponds to a *deploy-time parameter*.
|
96
|
-
The type of the default value is used as the parameter `type`.
|
97
|
-
type : Type, default None
|
98
|
-
If `default` is not specified, define the parameter type. Specify
|
99
|
-
one of `str`, `float`, `int`, `bool`, or `JSONType`. If None, defaults
|
100
|
-
to the type of `default` or `str` if none specified.
|
101
|
-
help : str, optional
|
102
|
-
Help text to show in `run --help`.
|
103
|
-
required : bool, default False
|
104
|
-
Require that the user specified a value for the parameter.
|
105
|
-
`required=True` implies that the `default` is not used.
|
106
|
-
show_default : bool, default True
|
107
|
-
If True, show the default value in the help text.
|
108
|
-
"""
|
109
|
-
def __init__(self, name: str, default: typing.Union[str, float, int, bool, typing.Dict[str, typing.Any], typing.Callable[[], typing.Union[str, float, int, bool, typing.Dict[str, typing.Any]]], None] = None, type: typing.Union[typing.Type[str], typing.Type[float], typing.Type[int], typing.Type[bool], metaflow.parameters.JSONTypeClass, None] = None, help: typing.Optional[str] = None, required: bool = False, show_default: bool = True, **kwargs: typing.Dict[str, typing.Any]):
|
110
|
-
...
|
111
|
-
def __repr__(self):
|
112
|
-
...
|
113
|
-
def __str__(self):
|
114
|
-
...
|
115
|
-
def option_kwargs(self, deploy_mode):
|
116
|
-
...
|
117
|
-
def load_parameter(self, v):
|
118
|
-
...
|
119
|
-
@property
|
120
|
-
def is_string_type(self):
|
121
|
-
...
|
122
|
-
def __getitem__(self, x):
|
123
|
-
...
|
124
|
-
...
|
125
|
-
|
126
|
-
class ParameterContext(tuple, metaclass=type):
|
127
|
-
"""
|
128
|
-
ParameterContext(flow_name, user_name, parameter_name, logger, ds_type)
|
129
|
-
"""
|
130
|
-
@staticmethod
|
131
|
-
def __new__(_cls, flow_name: str, user_name: str, parameter_name: str, logger: typing.Callable[..., None], ds_type: str):
|
132
|
-
"""
|
133
|
-
Create new instance of ParameterContext(flow_name, user_name, parameter_name, logger, ds_type)
|
134
|
-
"""
|
135
|
-
...
|
136
|
-
def __repr__(self):
|
137
|
-
"""
|
138
|
-
Return a nicely formatted representation string
|
139
|
-
"""
|
140
|
-
...
|
141
|
-
def __getnewargs__(self):
|
142
|
-
"""
|
143
|
-
Return self as a plain tuple. Used by copy and pickle.
|
144
|
-
"""
|
145
|
-
...
|
146
|
-
def __init__(self, flow_name: str, user_name: str, parameter_name: str, logger: typing.Callable[..., None], ds_type: str):
|
147
|
-
...
|
148
|
-
...
|
149
|
-
|
150
|
-
class Local(object, metaclass=type):
|
151
|
-
"""
|
152
|
-
This class allows you to access the local filesystem in a way similar to the S3 datatools
|
153
|
-
client. It is a stripped down version for now and only implements the functionality needed
|
154
|
-
for this use case.
|
155
|
-
|
156
|
-
In the future, we may want to allow it to be used in a way similar to the S3() client.
|
157
|
-
"""
|
158
|
-
@classmethod
|
159
|
-
def get_root_from_config(cls, echo, create_on_absent = True):
|
160
|
-
...
|
161
|
-
def __init__(self):
|
162
|
-
"""
|
163
|
-
Initialize a new context for Local file operations. This object is based used as
|
164
|
-
a context manager for a with statement.
|
165
|
-
"""
|
166
|
-
...
|
167
|
-
def __enter__(self):
|
168
|
-
...
|
169
|
-
def __exit__(self, *args):
|
170
|
-
...
|
171
|
-
def get(self, key = None, return_missing = False):
|
172
|
-
...
|
173
|
-
def put(self, key, obj, overwrite = True):
|
174
|
-
...
|
175
|
-
def info(self, key = None, return_missing = False):
|
176
|
-
...
|
177
|
-
...
|
178
|
-
|
179
|
-
class S3(object, metaclass=type):
|
180
|
-
"""
|
181
|
-
The Metaflow S3 client.
|
182
|
-
|
183
|
-
This object manages the connection to S3 and a temporary diretory that is used
|
184
|
-
to download objects. Note that in most cases when the data fits in memory, no local
|
185
|
-
disk IO is needed as operations are cached by the operating system, which makes
|
186
|
-
operations fast as long as there is enough memory available.
|
187
|
-
|
188
|
-
The easiest way is to use this object as a context manager:
|
189
|
-
```
|
190
|
-
with S3() as s3:
|
191
|
-
data = [obj.blob for obj in s3.get_many(urls)]
|
192
|
-
print(data)
|
193
|
-
```
|
194
|
-
The context manager takes care of creating and deleting a temporary directory
|
195
|
-
automatically. Without a context manager, you must call `.close()` to delete
|
196
|
-
the directory explicitly:
|
197
|
-
```
|
198
|
-
s3 = S3()
|
199
|
-
data = [obj.blob for obj in s3.get_many(urls)]
|
200
|
-
s3.close()
|
201
|
-
```
|
202
|
-
You can customize the location of the temporary directory with `tmproot`. It
|
203
|
-
defaults to the current working directory.
|
204
|
-
|
205
|
-
To make it easier to deal with object locations, the client can be initialized
|
206
|
-
with an S3 path prefix. There are three ways to handle locations:
|
207
|
-
|
208
|
-
1. Use a `metaflow.Run` object or `self`, e.g. `S3(run=self)` which
|
209
|
-
initializes the prefix with the global `DATATOOLS_S3ROOT` path, combined
|
210
|
-
with the current run ID. This mode makes it easy to version data based
|
211
|
-
on the run ID consistently. You can use the `bucket` and `prefix` to
|
212
|
-
override parts of `DATATOOLS_S3ROOT`.
|
213
|
-
|
214
|
-
2. Specify an S3 prefix explicitly with `s3root`,
|
215
|
-
e.g. `S3(s3root='s3://mybucket/some/path')`.
|
216
|
-
|
217
|
-
3. Specify nothing, i.e. `S3()`, in which case all operations require
|
218
|
-
a full S3 url prefixed with `s3://`.
|
219
|
-
|
220
|
-
Parameters
|
221
|
-
----------
|
222
|
-
tmproot : str, default: '.'
|
223
|
-
Where to store the temporary directory.
|
224
|
-
bucket : str, optional
|
225
|
-
Override the bucket from `DATATOOLS_S3ROOT` when `run` is specified.
|
226
|
-
prefix : str, optional
|
227
|
-
Override the path from `DATATOOLS_S3ROOT` when `run` is specified.
|
228
|
-
run : FlowSpec or Run, optional
|
229
|
-
Derive path prefix from the current or a past run ID, e.g. S3(run=self).
|
230
|
-
s3root : str, optional
|
231
|
-
If `run` is not specified, use this as the S3 prefix.
|
232
|
-
"""
|
233
|
-
@classmethod
|
234
|
-
def get_root_from_config(cls, echo, create_on_absent = True):
|
235
|
-
...
|
236
|
-
def __enter__(self) -> metaflow.plugins.datatools.s3.s3.S3:
|
237
|
-
...
|
238
|
-
def __exit__(self, *args):
|
239
|
-
...
|
240
|
-
def close(self):
|
241
|
-
"""
|
242
|
-
Delete all temporary files downloaded in this context.
|
243
|
-
"""
|
244
|
-
...
|
245
|
-
def list_paths(self, keys: typing.Optional[typing.Iterable[str]] = None) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
|
246
|
-
"""
|
247
|
-
List the next level of paths in S3.
|
248
|
-
|
249
|
-
If multiple keys are specified, listings are done in parallel. The returned
|
250
|
-
S3Objects have `.exists == False` if the path refers to a prefix, not an
|
251
|
-
existing S3 object.
|
252
|
-
|
253
|
-
For instance, if the directory hierarchy is
|
254
|
-
```
|
255
|
-
a/0.txt
|
256
|
-
a/b/1.txt
|
257
|
-
a/c/2.txt
|
258
|
-
a/d/e/3.txt
|
259
|
-
f/4.txt
|
260
|
-
```
|
261
|
-
The `list_paths(['a', 'f'])` call returns
|
262
|
-
```
|
263
|
-
a/0.txt (exists == True)
|
264
|
-
a/b/ (exists == False)
|
265
|
-
a/c/ (exists == False)
|
266
|
-
a/d/ (exists == False)
|
267
|
-
f/4.txt (exists == True)
|
268
|
-
```
|
269
|
-
|
270
|
-
Parameters
|
271
|
-
----------
|
272
|
-
keys : Iterable[str], optional, default None
|
273
|
-
List of paths.
|
274
|
-
|
275
|
-
Returns
|
276
|
-
-------
|
277
|
-
List[S3Object]
|
278
|
-
S3Objects under the given paths, including prefixes (directories) that
|
279
|
-
do not correspond to leaf objects.
|
280
|
-
"""
|
281
|
-
...
|
282
|
-
def list_recursive(self, keys: typing.Optional[typing.Iterable[str]] = None) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
|
283
|
-
"""
|
284
|
-
List all objects recursively under the given prefixes.
|
285
|
-
|
286
|
-
If multiple keys are specified, listings are done in parallel. All objects
|
287
|
-
returned have `.exists == True` as this call always returns leaf objects.
|
288
|
-
|
289
|
-
For instance, if the directory hierarchy is
|
290
|
-
```
|
291
|
-
a/0.txt
|
292
|
-
a/b/1.txt
|
293
|
-
a/c/2.txt
|
294
|
-
a/d/e/3.txt
|
295
|
-
f/4.txt
|
296
|
-
```
|
297
|
-
The `list_paths(['a', 'f'])` call returns
|
298
|
-
```
|
299
|
-
a/0.txt (exists == True)
|
300
|
-
a/b/1.txt (exists == True)
|
301
|
-
a/c/2.txt (exists == True)
|
302
|
-
a/d/e/3.txt (exists == True)
|
303
|
-
f/4.txt (exists == True)
|
304
|
-
```
|
305
|
-
|
306
|
-
Parameters
|
307
|
-
----------
|
308
|
-
keys : Iterable[str], optional, default None
|
309
|
-
List of paths.
|
310
|
-
|
311
|
-
Returns
|
312
|
-
-------
|
313
|
-
List[S3Object]
|
314
|
-
S3Objects under the given paths.
|
315
|
-
"""
|
316
|
-
...
|
317
|
-
def info(self, key: typing.Optional[str] = None, return_missing: bool = False) -> metaflow.plugins.datatools.s3.s3.S3Object:
|
318
|
-
"""
|
319
|
-
Get metadata about a single object in S3.
|
320
|
-
|
321
|
-
This call makes a single `HEAD` request to S3 which can be
|
322
|
-
much faster than downloading all data with `get`.
|
323
|
-
|
324
|
-
Parameters
|
325
|
-
----------
|
326
|
-
key : str, optional, default None
|
327
|
-
Object to query. It can be an S3 url or a path suffix.
|
328
|
-
return_missing : bool, default False
|
329
|
-
If set to True, do not raise an exception for a missing key but
|
330
|
-
return it as an `S3Object` with `.exists == False`.
|
331
|
-
|
332
|
-
Returns
|
333
|
-
-------
|
334
|
-
S3Object
|
335
|
-
An S3Object corresponding to the object requested. The object
|
336
|
-
will have `.downloaded == False`.
|
337
|
-
"""
|
338
|
-
...
|
339
|
-
def info_many(self, keys: typing.Iterable[str], return_missing: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
|
340
|
-
"""
|
341
|
-
Get metadata about many objects in S3 in parallel.
|
342
|
-
|
343
|
-
This call makes a single `HEAD` request to S3 which can be
|
344
|
-
much faster than downloading all data with `get`.
|
345
|
-
|
346
|
-
Parameters
|
347
|
-
----------
|
348
|
-
keys : Iterable[str]
|
349
|
-
Objects to query. Each key can be an S3 url or a path suffix.
|
350
|
-
return_missing : bool, default False
|
351
|
-
If set to True, do not raise an exception for a missing key but
|
352
|
-
return it as an `S3Object` with `.exists == False`.
|
353
|
-
|
354
|
-
Returns
|
355
|
-
-------
|
356
|
-
List[S3Object]
|
357
|
-
A list of S3Objects corresponding to the paths requested. The
|
358
|
-
objects will have `.downloaded == False`.
|
359
|
-
"""
|
360
|
-
...
|
361
|
-
def get(self, key: typing.Union[str, metaflow.plugins.datatools.s3.s3.S3GetObject, None] = None, return_missing: bool = False, return_info: bool = True) -> metaflow.plugins.datatools.s3.s3.S3Object:
|
362
|
-
"""
|
363
|
-
Get a single object from S3.
|
364
|
-
|
365
|
-
Parameters
|
366
|
-
----------
|
367
|
-
key : Union[str, S3GetObject], optional, default None
|
368
|
-
Object to download. It can be an S3 url, a path suffix, or
|
369
|
-
an S3GetObject that defines a range of data to download. If None, or
|
370
|
-
not provided, gets the S3 root.
|
371
|
-
return_missing : bool, default False
|
372
|
-
If set to True, do not raise an exception for a missing key but
|
373
|
-
return it as an `S3Object` with `.exists == False`.
|
374
|
-
return_info : bool, default True
|
375
|
-
If set to True, fetch the content-type and user metadata associated
|
376
|
-
with the object at no extra cost, included for symmetry with `get_many`
|
377
|
-
|
378
|
-
Returns
|
379
|
-
-------
|
380
|
-
S3Object
|
381
|
-
An S3Object corresponding to the object requested.
|
382
|
-
"""
|
383
|
-
...
|
384
|
-
def get_many(self, keys: typing.Iterable[typing.Union[str, metaflow.plugins.datatools.s3.s3.S3GetObject]], return_missing: bool = False, return_info: bool = True) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
|
385
|
-
"""
|
386
|
-
Get many objects from S3 in parallel.
|
387
|
-
|
388
|
-
Parameters
|
389
|
-
----------
|
390
|
-
keys : Iterable[Union[str, S3GetObject]]
|
391
|
-
Objects to download. Each object can be an S3 url, a path suffix, or
|
392
|
-
an S3GetObject that defines a range of data to download.
|
393
|
-
return_missing : bool, default False
|
394
|
-
If set to True, do not raise an exception for a missing key but
|
395
|
-
return it as an `S3Object` with `.exists == False`.
|
396
|
-
return_info : bool, default True
|
397
|
-
If set to True, fetch the content-type and user metadata associated
|
398
|
-
with the object at no extra cost, included for symmetry with `get_many`.
|
399
|
-
|
400
|
-
Returns
|
401
|
-
-------
|
402
|
-
List[S3Object]
|
403
|
-
S3Objects corresponding to the objects requested.
|
404
|
-
"""
|
405
|
-
...
|
406
|
-
def get_recursive(self, keys: typing.Iterable[str], return_info: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
|
407
|
-
"""
|
408
|
-
Get many objects from S3 recursively in parallel.
|
409
|
-
|
410
|
-
Parameters
|
411
|
-
----------
|
412
|
-
keys : Iterable[str]
|
413
|
-
Prefixes to download recursively. Each prefix can be an S3 url or a path suffix
|
414
|
-
which define the root prefix under which all objects are downloaded.
|
415
|
-
return_info : bool, default False
|
416
|
-
If set to True, fetch the content-type and user metadata associated
|
417
|
-
with the object.
|
418
|
-
|
419
|
-
Returns
|
420
|
-
-------
|
421
|
-
List[S3Object]
|
422
|
-
S3Objects stored under the given prefixes.
|
423
|
-
"""
|
424
|
-
...
|
425
|
-
def get_all(self, return_info: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
|
426
|
-
"""
|
427
|
-
Get all objects under the prefix set in the `S3` constructor.
|
428
|
-
|
429
|
-
This method requires that the `S3` object is initialized either with `run` or
|
430
|
-
`s3root`.
|
431
|
-
|
432
|
-
Parameters
|
433
|
-
----------
|
434
|
-
return_info : bool, default False
|
435
|
-
If set to True, fetch the content-type and user metadata associated
|
436
|
-
with the object.
|
437
|
-
|
438
|
-
Returns
|
439
|
-
-------
|
440
|
-
Iterable[S3Object]
|
441
|
-
S3Objects stored under the main prefix.
|
442
|
-
"""
|
443
|
-
...
|
444
|
-
def put(self, key: typing.Union[str, metaflow.plugins.datatools.s3.s3.S3PutObject], obj: typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes], overwrite: bool = True, content_type: typing.Optional[str] = None, metadata: typing.Optional[typing.Dict[str, str]] = None) -> str:
|
445
|
-
"""
|
446
|
-
Upload a single object to S3.
|
447
|
-
|
448
|
-
Parameters
|
449
|
-
----------
|
450
|
-
key : Union[str, S3PutObject]
|
451
|
-
Object path. It can be an S3 url or a path suffix.
|
452
|
-
obj : PutValue
|
453
|
-
An object to store in S3. Strings are converted to UTF-8 encoding.
|
454
|
-
overwrite : bool, default True
|
455
|
-
Overwrite the object if it exists. If set to False, the operation
|
456
|
-
succeeds without uploading anything if the key already exists.
|
457
|
-
content_type : str, optional, default None
|
458
|
-
Optional MIME type for the object.
|
459
|
-
metadata : Dict[str, str], optional, default None
|
460
|
-
A JSON-encodable dictionary of additional headers to be stored
|
461
|
-
as metadata with the object.
|
462
|
-
|
463
|
-
Returns
|
464
|
-
-------
|
465
|
-
str
|
466
|
-
URL of the object stored.
|
467
|
-
"""
|
468
|
-
...
|
469
|
-
def put_many(self, key_objs: typing.List[typing.Union[typing.Tuple[str, typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes]], metaflow.plugins.datatools.s3.s3.S3PutObject]], overwrite: bool = True) -> typing.List[typing.Tuple[str, str]]:
|
470
|
-
"""
|
471
|
-
Upload many objects to S3.
|
472
|
-
|
473
|
-
Each object to be uploaded can be specified in two ways:
|
474
|
-
|
475
|
-
1. As a `(key, obj)` tuple where `key` is a string specifying
|
476
|
-
the path and `obj` is a string or a bytes object.
|
477
|
-
|
478
|
-
2. As a `S3PutObject` which contains additional metadata to be
|
479
|
-
stored with the object.
|
480
|
-
|
481
|
-
Parameters
|
482
|
-
----------
|
483
|
-
key_objs : List[Union[Tuple[str, PutValue], S3PutObject]]
|
484
|
-
List of key-object pairs to upload.
|
485
|
-
overwrite : bool, default True
|
486
|
-
Overwrite the object if it exists. If set to False, the operation
|
487
|
-
succeeds without uploading anything if the key already exists.
|
488
|
-
|
489
|
-
Returns
|
490
|
-
-------
|
491
|
-
List[Tuple[str, str]]
|
492
|
-
List of `(key, url)` pairs corresponding to the objects uploaded.
|
493
|
-
"""
|
494
|
-
...
|
495
|
-
def put_files(self, key_paths: typing.List[typing.Union[typing.Tuple[str, typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes]], metaflow.plugins.datatools.s3.s3.S3PutObject]], overwrite: bool = True) -> typing.List[typing.Tuple[str, str]]:
|
496
|
-
"""
|
497
|
-
Upload many local files to S3.
|
498
|
-
|
499
|
-
Each file to be uploaded can be specified in two ways:
|
500
|
-
|
501
|
-
1. As a `(key, path)` tuple where `key` is a string specifying
|
502
|
-
the S3 path and `path` is the path to a local file.
|
503
|
-
|
504
|
-
2. As a `S3PutObject` which contains additional metadata to be
|
505
|
-
stored with the file.
|
506
|
-
|
507
|
-
Parameters
|
508
|
-
----------
|
509
|
-
key_paths : List[Union[Tuple[str, PutValue], S3PutObject]]
|
510
|
-
List of files to upload.
|
511
|
-
overwrite : bool, default True
|
512
|
-
Overwrite the object if it exists. If set to False, the operation
|
513
|
-
succeeds without uploading anything if the key already exists.
|
514
|
-
|
515
|
-
Returns
|
516
|
-
-------
|
517
|
-
List[Tuple[str, str]]
|
518
|
-
List of `(key, url)` pairs corresponding to the files uploaded.
|
519
|
-
"""
|
520
|
-
...
|
521
|
-
...
|
522
|
-
|
523
|
-
class Azure(object, metaclass=type):
|
524
|
-
@classmethod
|
525
|
-
def get_root_from_config(cls, echo, create_on_absent = True):
|
526
|
-
...
|
527
|
-
def __init__(self):
|
528
|
-
...
|
529
|
-
def __enter__(self):
|
530
|
-
...
|
531
|
-
def __exit__(self, *args):
|
532
|
-
...
|
533
|
-
def get(self, key = None, return_missing = False):
|
534
|
-
"""
|
535
|
-
Key MUST be a fully qualified path with uri scheme. azure://<container_name>/b/l/o/b/n/a/m/e
|
536
|
-
"""
|
537
|
-
...
|
538
|
-
def put(self, key, obj, overwrite = True):
|
539
|
-
"""
|
540
|
-
Key MUST be a fully qualified path. <container_name>/b/l/o/b/n/a/m/e
|
541
|
-
"""
|
542
|
-
...
|
543
|
-
def info(self, key = None, return_missing = False):
|
544
|
-
...
|
545
|
-
...
|
546
|
-
|
547
|
-
class GS(object, metaclass=type):
|
548
|
-
@classmethod
|
549
|
-
def get_root_from_config(cls, echo, create_on_absent = True):
|
550
|
-
...
|
551
|
-
def __init__(self):
|
552
|
-
...
|
553
|
-
def __enter__(self):
|
554
|
-
...
|
555
|
-
def __exit__(self, *args):
|
556
|
-
...
|
557
|
-
def get(self, key = None, return_missing = False):
|
558
|
-
"""
|
559
|
-
Key MUST be a fully qualified path. gs://<bucket_name>/b/l/o/b/n/a/m/e
|
560
|
-
"""
|
561
|
-
...
|
562
|
-
def put(self, key, obj, overwrite = True):
|
563
|
-
"""
|
564
|
-
Key MUST be a fully qualified path. gs://<bucket_name>/b/l/o/b/n/a/m/e
|
565
|
-
"""
|
566
|
-
...
|
567
|
-
def info(self, key = None, return_missing = False):
|
568
|
-
...
|
569
|
-
...
|
16
|
+
from ._vendor import click as click
|
17
|
+
from .exception import MetaflowException as MetaflowException
|
18
|
+
from .parameters import DelayedEvaluationParameter as DelayedEvaluationParameter
|
19
|
+
from .parameters import DeployTimeField as DeployTimeField
|
20
|
+
from .parameters import Parameter as Parameter
|
21
|
+
from .parameters import ParameterContext as ParameterContext
|
570
22
|
|
571
|
-
DATACLIENTS:
|
23
|
+
DATACLIENTS: list
|
572
24
|
|
573
25
|
class IncludedFile(object, metaclass=type):
|
574
26
|
def __init__(self, descriptor: typing.Dict[str, typing.Any]):
|
@@ -579,7 +31,7 @@ class IncludedFile(object, metaclass=type):
|
|
579
31
|
@property
|
580
32
|
def size(self):
|
581
33
|
...
|
582
|
-
def decode(self, name, var_type =
|
34
|
+
def decode(self, name, var_type = 'Artifact'):
|
583
35
|
...
|
584
36
|
...
|
585
37
|
|
@@ -622,7 +74,7 @@ class IncludeFile(metaflow.parameters.Parameter, metaclass=type):
|
|
622
74
|
show_default : bool, default True
|
623
75
|
If True, show the default value in the help text.
|
624
76
|
"""
|
625
|
-
def __init__(self, name: str, required: bool = False, is_text: bool = True, encoding: str =
|
77
|
+
def __init__(self, name: str, required: bool = False, is_text: bool = True, encoding: str = 'utf-8', help: typing.Optional[str] = None, **kwargs: typing.Dict[str, str]):
|
626
78
|
...
|
627
79
|
def load_parameter(self, v):
|
628
80
|
...
|
metaflow-stubs/info_file.pyi
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-11-
|
5
|
-
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-13T23:34:52.830557 #
|
5
|
+
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
|
10
|
+
|
10
11
|
CURRENT_DIRECTORY: str
|
11
12
|
|
12
13
|
INFO_FILE: str
|
@@ -0,0 +1,16 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-13T23:34:52.834492 #
|
5
|
+
######################################################################################################
|
6
|
+
|
7
|
+
from __future__ import annotations
|
8
|
+
|
9
|
+
|
10
|
+
from . import metadata as metadata
|
11
|
+
from .metadata import DataArtifact as DataArtifact
|
12
|
+
from .metadata import MetadataProvider as MetadataProvider
|
13
|
+
from .metadata import MetaDatum as MetaDatum
|
14
|
+
from . import util as util
|
15
|
+
from . import heartbeat as heartbeat
|
16
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
######################################################################################################
|
2
|
+
# Auto-generated Metaflow stub file #
|
3
|
+
# MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
|
4
|
+
# Generated on 2024-11-13T23:34:52.851998 #
|
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
|
+
SERVICE_HEADERS: dict
|
17
|
+
|
18
|
+
HB_URL_KEY: str
|
19
|
+
|
20
|
+
class HeartBeatException(metaflow.exception.MetaflowException, metaclass=type):
|
21
|
+
def __init__(self, msg):
|
22
|
+
...
|
23
|
+
...
|
24
|
+
|
25
|
+
class MetadataHeartBeat(object, metaclass=type):
|
26
|
+
def __init__(self):
|
27
|
+
...
|
28
|
+
def process_message(self, msg):
|
29
|
+
...
|
30
|
+
@classmethod
|
31
|
+
def get_worker(cls):
|
32
|
+
...
|
33
|
+
...
|
34
|
+
|