metaflow-stubs 2.12.22__py2.py3-none-any.whl → 2.12.24__py2.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.
- metaflow-stubs/__init__.pyi +805 -414
- metaflow-stubs/cards.pyi +211 -5
- metaflow-stubs/cli.pyi +23 -3
- metaflow-stubs/client/__init__.pyi +128 -3
- metaflow-stubs/client/core.pyi +226 -6
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/clone_util.pyi +5 -2
- metaflow-stubs/events.pyi +21 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +71 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +158 -5
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata/metadata.pyi +9 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +26 -23
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +70 -4
- metaflow-stubs/plugins/__init__.pyi +14 -3
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +15 -3
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +66 -3
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +5 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +80 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +6 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +46 -4
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +46 -4
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +16 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +9 -5
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +98 -7
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +34 -6
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +49 -4
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +103 -3
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +16 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +21 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +70 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +5 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +49 -4
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +22 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +61 -3
- metaflow-stubs/plugins/cards/card_client.pyi +34 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +5 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +8 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +52 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +28 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +42 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +28 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +183 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +5 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +35 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +57 -4
- metaflow-stubs/plugins/cards/exception.pyi +8 -2
- metaflow-stubs/plugins/catch_decorator.pyi +20 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +63 -3
- metaflow-stubs/plugins/datatools/local.pyi +16 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +73 -4
- metaflow-stubs/plugins/datatools/s3/s3.pyi +82 -5
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +10 -2
- metaflow-stubs/plugins/events_decorator.pyi +106 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +24 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +16 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +66 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +100 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +5 -2
- metaflow-stubs/plugins/logs_cli.pyi +3 -3
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +29 -2
- metaflow-stubs/plugins/project_decorator.pyi +59 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +45 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +33 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +33 -2
- metaflow-stubs/plugins/retry_decorator.pyi +21 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +11 -2
- metaflow-stubs/plugins/storage_executor.pyi +6 -2
- metaflow-stubs/plugins/tag_cli.pyi +36 -5
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +10 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +24 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +70 -131
- metaflow-stubs/runner/metaflow_runner.pyi +118 -10
- metaflow-stubs/runner/nbdeploy.pyi +66 -2
- metaflow-stubs/runner/nbrun.pyi +79 -2
- metaflow-stubs/runner/subprocess_manager.pyi +16 -4
- metaflow-stubs/runner/utils.pyi +32 -2
- metaflow-stubs/system/__init__.pyi +3 -3
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +3 -3
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.12.22.dist-info → metaflow_stubs-2.12.24.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.24.dist-info/RECORD +152 -0
- metaflow_stubs-2.12.22.dist-info/RECORD +0 -152
- {metaflow_stubs-2.12.22.dist-info → metaflow_stubs-2.12.24.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.12.22.dist-info → metaflow_stubs-2.12.24.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24 #
|
4
|
+
# Generated on 2024-10-04T11:37:46.985801 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -9,137 +9,17 @@ from __future__ import annotations
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
11
|
import metaflow.runner.deployer
|
12
|
-
import metaflow.exception
|
13
12
|
import metaflow.runner.subprocess_manager
|
13
|
+
import metaflow.exception
|
14
14
|
|
15
15
|
class MetaflowNotFound(metaflow.exception.MetaflowException, metaclass=type):
|
16
16
|
...
|
17
17
|
|
18
|
-
class CommandManager(object, metaclass=type):
|
19
|
-
def __init__(self, command: typing.List[str], env: typing.Optional[typing.Dict[str, str]] = None, cwd: typing.Optional[str] = None):
|
20
|
-
"""
|
21
|
-
Create a new CommandManager object.
|
22
|
-
This does not run the process itself but sets it up.
|
23
|
-
|
24
|
-
Parameters
|
25
|
-
----------
|
26
|
-
command : List[str]
|
27
|
-
The command to run in List form.
|
28
|
-
env : Optional[Dict[str, str]], default None
|
29
|
-
Environment variables to set for the subprocess; if not specified,
|
30
|
-
the current enviornment variables are used.
|
31
|
-
cwd : Optional[str], default None
|
32
|
-
The directory to run the subprocess in; if not specified, the current
|
33
|
-
directory is used.
|
34
|
-
"""
|
35
|
-
...
|
36
|
-
def __aenter__(self) -> metaflow.runner.subprocess_manager.CommandManager:
|
37
|
-
...
|
38
|
-
def __aexit__(self, exc_type, exc_value, traceback):
|
39
|
-
...
|
40
|
-
def wait(self, timeout: typing.Optional[float] = None, stream: typing.Optional[str] = None):
|
41
|
-
"""
|
42
|
-
Wait for the subprocess to finish, optionally with a timeout
|
43
|
-
and optionally streaming its output.
|
44
|
-
|
45
|
-
You can only call `wait` if `async_run` has already been called.
|
46
|
-
|
47
|
-
Parameters
|
48
|
-
----------
|
49
|
-
timeout : Optional[float], default None
|
50
|
-
The maximum time to wait for the subprocess to finish.
|
51
|
-
If the timeout is reached, the subprocess is killed.
|
52
|
-
stream : Optional[str], default None
|
53
|
-
If specified, the specified stream is printed to stdout. `stream` can
|
54
|
-
be one of `stdout` or `stderr`.
|
55
|
-
"""
|
56
|
-
...
|
57
|
-
def run(self, show_output: bool = False):
|
58
|
-
"""
|
59
|
-
Run the subprocess synchronously. This can only be called once.
|
60
|
-
|
61
|
-
This also waits on the process implicitly.
|
62
|
-
|
63
|
-
Parameters
|
64
|
-
----------
|
65
|
-
show_output : bool, default False
|
66
|
-
Suppress the 'stdout' and 'stderr' to the console by default.
|
67
|
-
They can be accessed later by reading the files present in:
|
68
|
-
- self.log_files["stdout"]
|
69
|
-
- self.log_files["stderr"]
|
70
|
-
"""
|
71
|
-
...
|
72
|
-
def async_run(self):
|
73
|
-
"""
|
74
|
-
Run the subprocess asynchronously. This can only be called once.
|
75
|
-
|
76
|
-
Once this is called, you can then wait on the process (using `wait`), stream
|
77
|
-
logs (using `stream_logs`) or kill it (using `kill`).
|
78
|
-
"""
|
79
|
-
...
|
80
|
-
def stream_log(self, stream: str, position: typing.Optional[int] = None, timeout_per_line: typing.Optional[float] = None, log_write_delay: float = 0.01) -> typing.Iterator[typing.Tuple[int, str]]:
|
81
|
-
"""
|
82
|
-
Stream logs from the subprocess line by line.
|
83
|
-
|
84
|
-
Parameters
|
85
|
-
----------
|
86
|
-
stream : str
|
87
|
-
The stream to stream logs from. Can be one of "stdout" or "stderr".
|
88
|
-
position : Optional[int], default None
|
89
|
-
The position in the log file to start streaming from. If None, it starts
|
90
|
-
from the beginning of the log file. This allows resuming streaming from
|
91
|
-
a previously known position
|
92
|
-
timeout_per_line : Optional[float], default None
|
93
|
-
The time to wait for a line to be read from the log file. If None, it
|
94
|
-
waits indefinitely. If the timeout is reached, a LogReadTimeoutError
|
95
|
-
is raised. Note that this timeout is *per line* and not cumulative so this
|
96
|
-
function may take significantly more time than `timeout_per_line`
|
97
|
-
log_write_delay : float, default 0.01
|
98
|
-
Improves the probability of getting whole lines. This setting is for
|
99
|
-
advanced use cases.
|
100
|
-
|
101
|
-
Yields
|
102
|
-
------
|
103
|
-
Tuple[int, str]
|
104
|
-
A tuple containing the position in the log file and the line read. The
|
105
|
-
position returned can be used to feed into another `stream_logs` call
|
106
|
-
for example.
|
107
|
-
"""
|
108
|
-
...
|
109
|
-
def emit_logs(self, stream: str = "stdout", custom_logger: typing.Callable[..., None] = print):
|
110
|
-
"""
|
111
|
-
Helper function that can easily emit all the logs for a given stream.
|
112
|
-
|
113
|
-
This function will only terminate when all the log has been printed.
|
114
|
-
|
115
|
-
Parameters
|
116
|
-
----------
|
117
|
-
stream : str, default "stdout"
|
118
|
-
The stream to emit logs for. Can be one of "stdout" or "stderr".
|
119
|
-
custom_logger : Callable[..., None], default print
|
120
|
-
A custom logger function that takes in a string and "emits" it. By default,
|
121
|
-
the log is printed to stdout.
|
122
|
-
"""
|
123
|
-
...
|
124
|
-
def cleanup(self):
|
125
|
-
"""
|
126
|
-
Clean up log files for a running subprocesses.
|
127
|
-
"""
|
128
|
-
...
|
129
|
-
def kill(self, termination_timeout: float = 5):
|
130
|
-
"""
|
131
|
-
Kill the subprocess and its descendants.
|
132
|
-
|
133
|
-
Parameters
|
134
|
-
----------
|
135
|
-
termination_timeout : float, default 5
|
136
|
-
The time to wait after sending a SIGTERM to the process and its descendants
|
137
|
-
before sending a SIGKILL.
|
138
|
-
"""
|
139
|
-
...
|
140
|
-
...
|
141
|
-
|
142
18
|
class SubprocessManager(object, metaclass=type):
|
19
|
+
"""
|
20
|
+
A manager for subprocesses. The subprocess manager manages one or more
|
21
|
+
CommandManager objects, each of which manages an individual subprocess.
|
22
|
+
"""
|
143
23
|
def __init__(self):
|
144
24
|
...
|
145
25
|
def __aenter__(self) -> metaflow.runner.subprocess_manager.SubprocessManager:
|
@@ -215,10 +95,7 @@ class SubprocessManager(object, metaclass=type):
|
|
215
95
|
...
|
216
96
|
...
|
217
97
|
|
218
|
-
def
|
219
|
-
...
|
220
|
-
|
221
|
-
def handle_timeout(tfp_runner_attribute, command_obj: metaflow.runner.subprocess_manager.CommandManager, file_read_timeout: int):
|
98
|
+
def handle_timeout(tfp_runner_attribute, command_obj: "CommandManager", file_read_timeout: int):
|
222
99
|
"""
|
223
100
|
Handle the timeout for a running subprocess command that reads a file
|
224
101
|
and raises an error with appropriate logs if a TimeoutError occurs.
|
@@ -273,6 +150,30 @@ def get_lower_level_group(api, top_level_kwargs: typing.Dict, _type: typing.Opti
|
|
273
150
|
...
|
274
151
|
|
275
152
|
class Deployer(object, metaclass=type):
|
153
|
+
"""
|
154
|
+
Use the `Deployer` class to configure and access one of the production
|
155
|
+
orchestrators supported by Metaflow.
|
156
|
+
|
157
|
+
Parameters
|
158
|
+
----------
|
159
|
+
flow_file : str
|
160
|
+
Path to the flow file to deploy.
|
161
|
+
show_output : bool, default True
|
162
|
+
Show the 'stdout' and 'stderr' to the console by default.
|
163
|
+
profile : Optional[str], default None
|
164
|
+
Metaflow profile to use for the deployment. If not specified, the default
|
165
|
+
profile is used.
|
166
|
+
env : Optional[Dict[str, str]], default None
|
167
|
+
Additional environment variables to set for the deployment.
|
168
|
+
cwd : Optional[str], default None
|
169
|
+
The directory to run the subprocess in; if not specified, the current
|
170
|
+
directory is used.
|
171
|
+
file_read_timeout : int, default 3600
|
172
|
+
The timeout until which we try to read the deployer attribute file.
|
173
|
+
**kwargs : Any
|
174
|
+
Additional arguments that you would pass to `python myflow.py` before
|
175
|
+
the deployment command.
|
176
|
+
"""
|
276
177
|
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
|
277
178
|
...
|
278
179
|
def _Deployer__make_function(self, deployer_class):
|
@@ -293,6 +194,12 @@ class Deployer(object, metaclass=type):
|
|
293
194
|
...
|
294
195
|
|
295
196
|
class TriggeredRun(object, metaclass=type):
|
197
|
+
"""
|
198
|
+
TriggeredRun class represents a run that has been triggered on a production orchestrator.
|
199
|
+
|
200
|
+
Only when the `start` task starts running, the `run` object corresponding to the run
|
201
|
+
becomes available.
|
202
|
+
"""
|
296
203
|
def __init__(self, deployer: DeployerImpl, content: str):
|
297
204
|
...
|
298
205
|
def wait_for_run(self, timeout = None):
|
@@ -327,11 +234,43 @@ class TriggeredRun(object, metaclass=type):
|
|
327
234
|
...
|
328
235
|
|
329
236
|
class DeployedFlow(object, metaclass=type):
|
237
|
+
"""
|
238
|
+
DeployedFlow class represents a flow that has been deployed.
|
239
|
+
|
240
|
+
Parameters
|
241
|
+
----------
|
242
|
+
deployer : DeployerImpl
|
243
|
+
Instance of the deployer implementation.
|
244
|
+
"""
|
330
245
|
def __init__(self, deployer: DeployerImpl):
|
331
246
|
...
|
332
247
|
...
|
333
248
|
|
334
249
|
class DeployerImpl(object, metaclass=type):
|
250
|
+
"""
|
251
|
+
Base class for deployer implementations. Each implementation should define a TYPE
|
252
|
+
class variable that matches the name of the CLI group.
|
253
|
+
|
254
|
+
Parameters
|
255
|
+
----------
|
256
|
+
flow_file : str
|
257
|
+
Path to the flow file to deploy.
|
258
|
+
show_output : bool, default True
|
259
|
+
Show the 'stdout' and 'stderr' to the console by default.
|
260
|
+
profile : Optional[str], default None
|
261
|
+
Metaflow profile to use for the deployment. If not specified, the default
|
262
|
+
profile is used.
|
263
|
+
env : Optional[Dict], default None
|
264
|
+
Additional environment variables to set for the deployment.
|
265
|
+
cwd : Optional[str], default None
|
266
|
+
The directory to run the subprocess in; if not specified, the current
|
267
|
+
directory is used.
|
268
|
+
file_read_timeout : int, default 3600
|
269
|
+
The timeout until which we try to read the deployer attribute file.
|
270
|
+
**kwargs : Any
|
271
|
+
Additional arguments that you would pass to `python myflow.py` before
|
272
|
+
the deployment command.
|
273
|
+
"""
|
335
274
|
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
|
336
275
|
...
|
337
276
|
def __enter__(self) -> DeployerImpl:
|
@@ -1,20 +1,40 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24 #
|
4
|
+
# Generated on 2024-10-04T11:37:46.983038 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import metaflow.runner.metaflow_runner
|
12
|
-
import metaflow.events
|
13
|
-
import metaflow.runner.subprocess_manager
|
14
11
|
import metaflow.client.core
|
12
|
+
import metaflow.runner.subprocess_manager
|
15
13
|
import datetime
|
14
|
+
import metaflow.events
|
15
|
+
import metaflow.runner.metaflow_runner
|
16
16
|
|
17
17
|
class Run(metaflow.client.core.MetaflowObject, metaclass=type):
|
18
|
+
"""
|
19
|
+
A `Run` represents an execution of a `Flow`. It is a container of `Step`s.
|
20
|
+
|
21
|
+
Attributes
|
22
|
+
----------
|
23
|
+
data : MetaflowData
|
24
|
+
a shortcut to run['end'].task.data, i.e. data produced by this run.
|
25
|
+
successful : bool
|
26
|
+
True if the run completed successfully.
|
27
|
+
finished : bool
|
28
|
+
True if the run completed.
|
29
|
+
finished_at : datetime
|
30
|
+
Time this run finished.
|
31
|
+
code : MetaflowCode
|
32
|
+
Code package for this run (if present). See `MetaflowCode`.
|
33
|
+
trigger : MetaflowTrigger
|
34
|
+
Information about event(s) that triggered this run (if present). See `MetaflowTrigger`.
|
35
|
+
end_task : Task
|
36
|
+
`Task` for the end step (if it is present already).
|
37
|
+
"""
|
18
38
|
def steps(self, *tags: str) -> typing.Iterator[metaflow.client.core.Step]:
|
19
39
|
"""
|
20
40
|
[Legacy function - do not use]
|
@@ -274,13 +294,40 @@ def metadata(ms: str) -> str:
|
|
274
294
|
"""
|
275
295
|
...
|
276
296
|
|
277
|
-
def
|
297
|
+
def handle_timeout(tfp_runner_attribute, command_obj: "CommandManager", file_read_timeout: int):
|
298
|
+
"""
|
299
|
+
Handle the timeout for a running subprocess command that reads a file
|
300
|
+
and raises an error with appropriate logs if a TimeoutError occurs.
|
301
|
+
|
302
|
+
Parameters
|
303
|
+
----------
|
304
|
+
tfp_runner_attribute : NamedTemporaryFile
|
305
|
+
Temporary file that stores runner attribute data.
|
306
|
+
command_obj : CommandManager
|
307
|
+
Command manager object that encapsulates the running command details.
|
308
|
+
file_read_timeout : int
|
309
|
+
Timeout for reading the file.
|
310
|
+
|
311
|
+
Returns
|
312
|
+
-------
|
313
|
+
str
|
314
|
+
Content read from the temporary file.
|
315
|
+
|
316
|
+
Raises
|
317
|
+
------
|
318
|
+
RuntimeError
|
319
|
+
If a TimeoutError occurs, it raises a RuntimeError with the command's
|
320
|
+
stdout and stderr logs.
|
321
|
+
"""
|
278
322
|
...
|
279
323
|
|
280
|
-
def
|
324
|
+
def clear_and_set_os_environ(env: typing.Dict):
|
281
325
|
...
|
282
326
|
|
283
327
|
class CommandManager(object, metaclass=type):
|
328
|
+
"""
|
329
|
+
A manager for an individual subprocess.
|
330
|
+
"""
|
284
331
|
def __init__(self, command: typing.List[str], env: typing.Optional[typing.Dict[str, str]] = None, cwd: typing.Optional[str] = None):
|
285
332
|
"""
|
286
333
|
Create a new CommandManager object.
|
@@ -319,6 +366,8 @@ class CommandManager(object, metaclass=type):
|
|
319
366
|
be one of `stdout` or `stderr`.
|
320
367
|
"""
|
321
368
|
...
|
369
|
+
def sync_wait(self):
|
370
|
+
...
|
322
371
|
def run(self, show_output: bool = False):
|
323
372
|
"""
|
324
373
|
Run the subprocess synchronously. This can only be called once.
|
@@ -391,13 +440,13 @@ class CommandManager(object, metaclass=type):
|
|
391
440
|
Clean up log files for a running subprocesses.
|
392
441
|
"""
|
393
442
|
...
|
394
|
-
def kill(self, termination_timeout: float =
|
443
|
+
def kill(self, termination_timeout: float = 2):
|
395
444
|
"""
|
396
445
|
Kill the subprocess and its descendants.
|
397
446
|
|
398
447
|
Parameters
|
399
448
|
----------
|
400
|
-
termination_timeout : float, default
|
449
|
+
termination_timeout : float, default 2
|
401
450
|
The time to wait after sending a SIGTERM to the process and its descendants
|
402
451
|
before sending a SIGKILL.
|
403
452
|
"""
|
@@ -405,6 +454,10 @@ class CommandManager(object, metaclass=type):
|
|
405
454
|
...
|
406
455
|
|
407
456
|
class SubprocessManager(object, metaclass=type):
|
457
|
+
"""
|
458
|
+
A manager for subprocesses. The subprocess manager manages one or more
|
459
|
+
CommandManager objects, each of which manages an individual subprocess.
|
460
|
+
"""
|
408
461
|
def __init__(self):
|
409
462
|
...
|
410
463
|
def __aenter__(self) -> metaflow.runner.subprocess_manager.SubprocessManager:
|
@@ -481,6 +534,22 @@ class SubprocessManager(object, metaclass=type):
|
|
481
534
|
...
|
482
535
|
|
483
536
|
class ExecutingRun(object, metaclass=type):
|
537
|
+
"""
|
538
|
+
This class contains a reference to a `metaflow.Run` object representing
|
539
|
+
the currently executing or finished run, as well as metadata related
|
540
|
+
to the process.
|
541
|
+
|
542
|
+
`ExecutingRun` is returned by methods in `Runner` and `NBRunner`. It is not
|
543
|
+
meant to be instantiated directly.
|
544
|
+
|
545
|
+
This class works as a context manager, allowing you to use a pattern like
|
546
|
+
```python
|
547
|
+
with Runner(...).run() as running:
|
548
|
+
...
|
549
|
+
```
|
550
|
+
Note that you should use either this object as the context manager or
|
551
|
+
`Runner`, not both in a nested manner.
|
552
|
+
"""
|
484
553
|
def __init__(self, runner: Runner, command_obj: metaflow.runner.subprocess_manager.CommandManager, run_obj: metaflow.client.core.Run):
|
485
554
|
"""
|
486
555
|
Create a new ExecutingRun -- this should not be done by the user directly but
|
@@ -541,9 +610,10 @@ class ExecutingRun(object, metaclass=type):
|
|
541
610
|
for executing the run.
|
542
611
|
|
543
612
|
The return value is one of the following strings:
|
613
|
+
- `timeout` indicates that the run timed out.
|
544
614
|
- `running` indicates a currently executing run.
|
545
615
|
- `failed` indicates a failed run.
|
546
|
-
- `successful` a successful run.
|
616
|
+
- `successful` indicates a successful run.
|
547
617
|
|
548
618
|
Returns
|
549
619
|
-------
|
@@ -603,6 +673,44 @@ class ExecutingRun(object, metaclass=type):
|
|
603
673
|
...
|
604
674
|
|
605
675
|
class Runner(object, metaclass=type):
|
676
|
+
"""
|
677
|
+
Metaflow's Runner API that presents a programmatic interface
|
678
|
+
to run flows and perform other operations either synchronously or asynchronously.
|
679
|
+
The class expects a path to the flow file along with optional arguments
|
680
|
+
that match top-level options on the command-line.
|
681
|
+
|
682
|
+
This class works as a context manager, calling `cleanup()` to remove
|
683
|
+
temporary files at exit.
|
684
|
+
|
685
|
+
Example:
|
686
|
+
```python
|
687
|
+
with Runner('slowflow.py', pylint=False) as runner:
|
688
|
+
result = runner.run(alpha=5, tags=["abc", "def"], max_workers=5)
|
689
|
+
print(result.run.finished)
|
690
|
+
```
|
691
|
+
|
692
|
+
Parameters
|
693
|
+
----------
|
694
|
+
flow_file : str
|
695
|
+
Path to the flow file to run
|
696
|
+
show_output : bool, default True
|
697
|
+
Show the 'stdout' and 'stderr' to the console by default,
|
698
|
+
Only applicable for synchronous 'run' and 'resume' functions.
|
699
|
+
profile : Optional[str], default None
|
700
|
+
Metaflow profile to use to run this run. If not specified, the default
|
701
|
+
profile is used (or the one already set using `METAFLOW_PROFILE`)
|
702
|
+
env : Optional[Dict], default None
|
703
|
+
Additional environment variables to set for the Run. This overrides the
|
704
|
+
environment set for this process.
|
705
|
+
cwd : Optional[str], default None
|
706
|
+
The directory to run the subprocess in; if not specified, the current
|
707
|
+
directory is used.
|
708
|
+
file_read_timeout : int, default 3600
|
709
|
+
The timeout until which we try to read the runner attribute file.
|
710
|
+
**kwargs : Any
|
711
|
+
Additional arguments that you would pass to `python myflow.py` before
|
712
|
+
the `run` command.
|
713
|
+
"""
|
606
714
|
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
|
607
715
|
...
|
608
716
|
def __enter__(self) -> Runner:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24 #
|
4
|
+
# Generated on 2024-10-04T11:37:46.986533 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -9,6 +9,30 @@ from __future__ import annotations
|
|
9
9
|
import typing
|
10
10
|
|
11
11
|
class Deployer(object, metaclass=type):
|
12
|
+
"""
|
13
|
+
Use the `Deployer` class to configure and access one of the production
|
14
|
+
orchestrators supported by Metaflow.
|
15
|
+
|
16
|
+
Parameters
|
17
|
+
----------
|
18
|
+
flow_file : str
|
19
|
+
Path to the flow file to deploy.
|
20
|
+
show_output : bool, default True
|
21
|
+
Show the 'stdout' and 'stderr' to the console by default.
|
22
|
+
profile : Optional[str], default None
|
23
|
+
Metaflow profile to use for the deployment. If not specified, the default
|
24
|
+
profile is used.
|
25
|
+
env : Optional[Dict[str, str]], default None
|
26
|
+
Additional environment variables to set for the deployment.
|
27
|
+
cwd : Optional[str], default None
|
28
|
+
The directory to run the subprocess in; if not specified, the current
|
29
|
+
directory is used.
|
30
|
+
file_read_timeout : int, default 3600
|
31
|
+
The timeout until which we try to read the deployer attribute file.
|
32
|
+
**kwargs : Any
|
33
|
+
Additional arguments that you would pass to `python myflow.py` before
|
34
|
+
the deployment command.
|
35
|
+
"""
|
12
36
|
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
|
13
37
|
...
|
14
38
|
def _Deployer__make_function(self, deployer_class):
|
@@ -40,9 +64,49 @@ def format_flowfile(cell):
|
|
40
64
|
DEFAULT_DIR: str
|
41
65
|
|
42
66
|
class NBDeployerInitializationError(Exception, metaclass=type):
|
67
|
+
"""
|
68
|
+
Custom exception for errors during NBDeployer initialization.
|
69
|
+
"""
|
43
70
|
...
|
44
71
|
|
45
72
|
class NBDeployer(object, metaclass=type):
|
73
|
+
"""
|
74
|
+
A wrapper over `Deployer` for deploying flows defined in a Jupyter
|
75
|
+
notebook cell.
|
76
|
+
|
77
|
+
Instantiate this class on the last line of a notebook cell where
|
78
|
+
a `flow` is defined. In contrast to `Deployer`, this class is not
|
79
|
+
meant to be used in a context manager.
|
80
|
+
|
81
|
+
```python
|
82
|
+
deployer = NBDeployer(FlowName)
|
83
|
+
ar = deployer.argo_workflows(name="madhur")
|
84
|
+
ar_obj = ar.create()
|
85
|
+
result = ar_obj.trigger(alpha=300)
|
86
|
+
print(result.status)
|
87
|
+
print(result.run)
|
88
|
+
result.terminate()
|
89
|
+
```
|
90
|
+
|
91
|
+
Parameters
|
92
|
+
----------
|
93
|
+
flow : FlowSpec
|
94
|
+
Flow defined in the same cell
|
95
|
+
show_output : bool, default True
|
96
|
+
Show the 'stdout' and 'stderr' to the console by default,
|
97
|
+
profile : Optional[str], default None
|
98
|
+
Metaflow profile to use to deploy this run. If not specified, the default
|
99
|
+
profile is used (or the one already set using `METAFLOW_PROFILE`)
|
100
|
+
env : Optional[Dict[str, str]], default None
|
101
|
+
Additional environment variables to set. This overrides the
|
102
|
+
environment set for this process.
|
103
|
+
base_dir : Optional[str], default None
|
104
|
+
The directory to run the subprocess in; if not specified, a temporary
|
105
|
+
directory is used.
|
106
|
+
**kwargs : Any
|
107
|
+
Additional arguments that you would pass to `python myflow.py` i.e. options
|
108
|
+
listed in `python myflow.py --help`
|
109
|
+
"""
|
46
110
|
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", file_read_timeout: int = 3600, **kwargs):
|
47
111
|
...
|
48
112
|
def cleanup(self):
|
metaflow-stubs/runner/nbrun.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24 #
|
4
|
+
# Generated on 2024-10-04T11:37:46.984347 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -11,6 +11,44 @@ if typing.TYPE_CHECKING:
|
|
11
11
|
import metaflow.runner.metaflow_runner
|
12
12
|
|
13
13
|
class Runner(object, metaclass=type):
|
14
|
+
"""
|
15
|
+
Metaflow's Runner API that presents a programmatic interface
|
16
|
+
to run flows and perform other operations either synchronously or asynchronously.
|
17
|
+
The class expects a path to the flow file along with optional arguments
|
18
|
+
that match top-level options on the command-line.
|
19
|
+
|
20
|
+
This class works as a context manager, calling `cleanup()` to remove
|
21
|
+
temporary files at exit.
|
22
|
+
|
23
|
+
Example:
|
24
|
+
```python
|
25
|
+
with Runner('slowflow.py', pylint=False) as runner:
|
26
|
+
result = runner.run(alpha=5, tags=["abc", "def"], max_workers=5)
|
27
|
+
print(result.run.finished)
|
28
|
+
```
|
29
|
+
|
30
|
+
Parameters
|
31
|
+
----------
|
32
|
+
flow_file : str
|
33
|
+
Path to the flow file to run
|
34
|
+
show_output : bool, default True
|
35
|
+
Show the 'stdout' and 'stderr' to the console by default,
|
36
|
+
Only applicable for synchronous 'run' and 'resume' functions.
|
37
|
+
profile : Optional[str], default None
|
38
|
+
Metaflow profile to use to run this run. If not specified, the default
|
39
|
+
profile is used (or the one already set using `METAFLOW_PROFILE`)
|
40
|
+
env : Optional[Dict], default None
|
41
|
+
Additional environment variables to set for the Run. This overrides the
|
42
|
+
environment set for this process.
|
43
|
+
cwd : Optional[str], default None
|
44
|
+
The directory to run the subprocess in; if not specified, the current
|
45
|
+
directory is used.
|
46
|
+
file_read_timeout : int, default 3600
|
47
|
+
The timeout until which we try to read the runner attribute file.
|
48
|
+
**kwargs : Any
|
49
|
+
Additional arguments that you would pass to `python myflow.py` before
|
50
|
+
the `run` command.
|
51
|
+
"""
|
14
52
|
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
|
15
53
|
...
|
16
54
|
def __enter__(self) -> metaflow.runner.metaflow_runner.Runner:
|
@@ -114,9 +152,48 @@ def format_flowfile(cell):
|
|
114
152
|
DEFAULT_DIR: str
|
115
153
|
|
116
154
|
class NBRunnerInitializationError(Exception, metaclass=type):
|
155
|
+
"""
|
156
|
+
Custom exception for errors during NBRunner initialization.
|
157
|
+
"""
|
117
158
|
...
|
118
159
|
|
119
160
|
class NBRunner(object, metaclass=type):
|
161
|
+
"""
|
162
|
+
A wrapper over `Runner` for executing flows defined in a Jupyter
|
163
|
+
notebook cell.
|
164
|
+
|
165
|
+
Instantiate this class on the last line of a notebook cell where
|
166
|
+
a `flow` is defined. In contrast to `Runner`, this class is not
|
167
|
+
meant to be used in a context manager. Instead, use a blocking helper
|
168
|
+
function like `nbrun` (which calls `cleanup()` internally) or call
|
169
|
+
`cleanup()` explictly when using non-blocking APIs.
|
170
|
+
|
171
|
+
```python
|
172
|
+
run = NBRunner(FlowName).nbrun()
|
173
|
+
```
|
174
|
+
|
175
|
+
Parameters
|
176
|
+
----------
|
177
|
+
flow : FlowSpec
|
178
|
+
Flow defined in the same cell
|
179
|
+
show_output : bool, default True
|
180
|
+
Show the 'stdout' and 'stderr' to the console by default,
|
181
|
+
Only applicable for synchronous 'run' and 'resume' functions.
|
182
|
+
profile : Optional[str], default None
|
183
|
+
Metaflow profile to use to run this run. If not specified, the default
|
184
|
+
profile is used (or the one already set using `METAFLOW_PROFILE`)
|
185
|
+
env : Optional[Dict], default None
|
186
|
+
Additional environment variables to set for the Run. This overrides the
|
187
|
+
environment set for this process.
|
188
|
+
base_dir : Optional[str], default None
|
189
|
+
The directory to run the subprocess in; if not specified, a temporary
|
190
|
+
directory is used.
|
191
|
+
file_read_timeout : int, default 3600
|
192
|
+
The timeout until which we try to read the runner attribute file.
|
193
|
+
**kwargs : Any
|
194
|
+
Additional arguments that you would pass to `python myflow.py` before
|
195
|
+
the `run` command.
|
196
|
+
"""
|
120
197
|
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", file_read_timeout: int = 3600, **kwargs):
|
121
198
|
...
|
122
199
|
def nbrun(self, **kwargs):
|