metaflow-stubs 2.12.28__py2.py3-none-any.whl → 2.12.29__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 +297 -3001
- 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 -11
- metaflow-stubs/metaflow_current.pyi +10 -9
- 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 +51 -163
- metaflow-stubs/plugins/airflow/__init__.pyi +12 -5
- metaflow-stubs/plugins/airflow/airflow.pyi +19 -130
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +17 -136
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +7 -26
- 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 +16 -120
- 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 +65 -322
- 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 +10 -5
- metaflow-stubs/plugins/aws/batch/batch.pyi +10 -55
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +10 -31
- 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 +15 -5
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +6 -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_cli.pyi +19 -175
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +6 -5
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +8 -37
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +53 -290
- 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 +14 -81
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +14 -97
- metaflow-stubs/plugins/cards/card_modules/card.pyi +6 -5
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +12 -73
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +6 -61
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +6 -5
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +8 -45
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +7 -6
- metaflow-stubs/plugins/cards/card_modules/components.pyi +25 -108
- 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 +13 -5
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +6 -10
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +9 -29
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +16 -155
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +9 -72
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +19 -142
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +8 -41
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +7 -11
- metaflow-stubs/plugins/logs_cli.pyi +11 -10
- metaflow-stubs/plugins/package_cli.pyi +7 -5
- metaflow-stubs/plugins/parallel_decorator.pyi +11 -59
- 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 +9 -14
- 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/pylint_wrapper.pyi +7 -11
- metaflow-stubs/runner/__init__.pyi +13 -5
- metaflow-stubs/runner/deployer.pyi +102 -210
- 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 -87
- metaflow-stubs/system/system_logger.pyi +7 -6
- metaflow-stubs/system/system_monitor.pyi +6 -5
- metaflow-stubs/tagging_util.pyi +6 -10
- metaflow-stubs/tuple_util.pyi +6 -5
- metaflow-stubs/version.pyi +6 -5
- {metaflow_stubs-2.12.28.dist-info → metaflow_stubs-2.12.29.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.29.dist-info/RECORD +158 -0
- metaflow-stubs/metadata/util.pyi +0 -18
- metaflow_stubs-2.12.28.dist-info/RECORD +0 -152
- {metaflow_stubs-2.12.28.dist-info → metaflow_stubs-2.12.29.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.12.28.dist-info → metaflow_stubs-2.12.29.dist-info}/top_level.txt +0 -0
@@ -1,506 +1,21 @@
|
|
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.29 #
|
4
|
+
# Generated on 2024-11-07T22:19:34.574100 #
|
5
|
+
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import
|
11
|
+
import metaflow.client.core
|
12
12
|
import metaflow.runner.subprocess_manager
|
13
13
|
import metaflow.runner.metaflow_runner
|
14
|
-
import metaflow.client.core
|
15
|
-
import metaflow.events
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
"""
|
38
|
-
def steps(self, *tags: str) -> typing.Iterator[metaflow.client.core.Step]:
|
39
|
-
"""
|
40
|
-
[Legacy function - do not use]
|
41
|
-
|
42
|
-
Returns an iterator over all `Step` objects in the step. This is an alias
|
43
|
-
to iterating the object itself, i.e.
|
44
|
-
```
|
45
|
-
list(Run(...)) == list(Run(...).steps())
|
46
|
-
```
|
47
|
-
|
48
|
-
Parameters
|
49
|
-
----------
|
50
|
-
tags : str
|
51
|
-
No op (legacy functionality)
|
52
|
-
|
53
|
-
Yields
|
54
|
-
------
|
55
|
-
Step
|
56
|
-
`Step` objects in this run.
|
57
|
-
"""
|
58
|
-
...
|
59
|
-
@property
|
60
|
-
def code(self) -> typing.Optional[metaflow.client.core.MetaflowCode]:
|
61
|
-
"""
|
62
|
-
Returns the MetaflowCode object for this run, if present.
|
63
|
-
Code is packed if atleast one `Step` runs remotely, else None is returned.
|
64
|
-
|
65
|
-
Returns
|
66
|
-
-------
|
67
|
-
MetaflowCode, optional
|
68
|
-
Code package for this run
|
69
|
-
"""
|
70
|
-
...
|
71
|
-
@property
|
72
|
-
def data(self) -> typing.Optional[metaflow.client.core.MetaflowData]:
|
73
|
-
"""
|
74
|
-
Returns a container of data artifacts produced by this run.
|
75
|
-
|
76
|
-
You can access data produced by this run as follows:
|
77
|
-
```
|
78
|
-
print(run.data.my_var)
|
79
|
-
```
|
80
|
-
This is a shorthand for `run['end'].task.data`. If the 'end' step has not yet
|
81
|
-
executed, returns None.
|
82
|
-
|
83
|
-
Returns
|
84
|
-
-------
|
85
|
-
MetaflowData, optional
|
86
|
-
Container of all artifacts produced by this task
|
87
|
-
"""
|
88
|
-
...
|
89
|
-
@property
|
90
|
-
def successful(self) -> bool:
|
91
|
-
"""
|
92
|
-
Indicates whether or not the run completed successfully.
|
93
|
-
|
94
|
-
A run is successful if its 'end' step is successful.
|
95
|
-
|
96
|
-
Returns
|
97
|
-
-------
|
98
|
-
bool
|
99
|
-
True if the run completed successfully and False otherwise
|
100
|
-
"""
|
101
|
-
...
|
102
|
-
@property
|
103
|
-
def finished(self) -> bool:
|
104
|
-
"""
|
105
|
-
Indicates whether or not the run completed.
|
106
|
-
|
107
|
-
A run completed if its 'end' step completed.
|
108
|
-
|
109
|
-
Returns
|
110
|
-
-------
|
111
|
-
bool
|
112
|
-
True if the run completed and False otherwise
|
113
|
-
"""
|
114
|
-
...
|
115
|
-
@property
|
116
|
-
def finished_at(self) -> typing.Optional[datetime.datetime]:
|
117
|
-
"""
|
118
|
-
Returns the datetime object of when the run finished (successfully or not).
|
119
|
-
|
120
|
-
The completion time of a run is the same as the completion time of its 'end' step.
|
121
|
-
If the 'end' step has not completed, returns None.
|
122
|
-
|
123
|
-
Returns
|
124
|
-
-------
|
125
|
-
datetime, optional
|
126
|
-
Datetime of when the run finished
|
127
|
-
"""
|
128
|
-
...
|
129
|
-
@property
|
130
|
-
def end_task(self) -> typing.Optional[metaflow.client.core.Task]:
|
131
|
-
"""
|
132
|
-
Returns the Task corresponding to the 'end' step.
|
133
|
-
|
134
|
-
This returns None if the end step does not yet exist.
|
135
|
-
|
136
|
-
Returns
|
137
|
-
-------
|
138
|
-
Task, optional
|
139
|
-
The 'end' task
|
140
|
-
"""
|
141
|
-
...
|
142
|
-
def add_tag(self, tag: str):
|
143
|
-
"""
|
144
|
-
Add a tag to this `Run`.
|
145
|
-
|
146
|
-
Note that if the tag is already a system tag, it is not added as a user tag,
|
147
|
-
and no error is thrown.
|
148
|
-
|
149
|
-
Parameters
|
150
|
-
----------
|
151
|
-
tag : str
|
152
|
-
Tag to add.
|
153
|
-
"""
|
154
|
-
...
|
155
|
-
def add_tags(self, tags: typing.Iterable[str]):
|
156
|
-
"""
|
157
|
-
Add one or more tags to this `Run`.
|
158
|
-
|
159
|
-
Note that if any tag is already a system tag, it is not added as a user tag
|
160
|
-
and no error is thrown.
|
161
|
-
|
162
|
-
Parameters
|
163
|
-
----------
|
164
|
-
tags : Iterable[str]
|
165
|
-
Tags to add.
|
166
|
-
"""
|
167
|
-
...
|
168
|
-
def remove_tag(self, tag: str):
|
169
|
-
"""
|
170
|
-
Remove one tag from this `Run`.
|
171
|
-
|
172
|
-
Removing a system tag is an error. Removing a non-existent
|
173
|
-
user tag is a no-op.
|
174
|
-
|
175
|
-
Parameters
|
176
|
-
----------
|
177
|
-
tag : str
|
178
|
-
Tag to remove.
|
179
|
-
"""
|
180
|
-
...
|
181
|
-
def remove_tags(self, tags: typing.Iterable[str]):
|
182
|
-
"""
|
183
|
-
Remove one or more tags to this `Run`.
|
184
|
-
|
185
|
-
Removing a system tag will result in an error. Removing a non-existent
|
186
|
-
user tag is a no-op.
|
187
|
-
|
188
|
-
Parameters
|
189
|
-
----------
|
190
|
-
tags : Iterable[str]
|
191
|
-
Tags to remove.
|
192
|
-
"""
|
193
|
-
...
|
194
|
-
def replace_tag(self, tag_to_remove: str, tag_to_add: str):
|
195
|
-
"""
|
196
|
-
Remove a tag and add a tag atomically. Removal is done first.
|
197
|
-
The rules for `Run.add_tag` and `Run.remove_tag` also apply here.
|
198
|
-
|
199
|
-
Parameters
|
200
|
-
----------
|
201
|
-
tag_to_remove : str
|
202
|
-
Tag to remove.
|
203
|
-
tag_to_add : str
|
204
|
-
Tag to add.
|
205
|
-
"""
|
206
|
-
...
|
207
|
-
def replace_tags(self, tags_to_remove: typing.Iterable[str], tags_to_add: typing.Iterable[str]):
|
208
|
-
"""
|
209
|
-
Remove and add tags atomically; the removal is done first.
|
210
|
-
The rules for `Run.add_tag` and `Run.remove_tag` also apply here.
|
211
|
-
|
212
|
-
Parameters
|
213
|
-
----------
|
214
|
-
tags_to_remove : Iterable[str]
|
215
|
-
Tags to remove.
|
216
|
-
tags_to_add : Iterable[str]
|
217
|
-
Tags to add.
|
218
|
-
"""
|
219
|
-
...
|
220
|
-
def __iter__(self) -> typing.Iterator[metaflow.client.core.Step]:
|
221
|
-
"""
|
222
|
-
Iterate over all children Step of this Run
|
223
|
-
|
224
|
-
Yields
|
225
|
-
------
|
226
|
-
Step
|
227
|
-
A Step in this Run
|
228
|
-
"""
|
229
|
-
...
|
230
|
-
def __getitem__(self, name: str) -> metaflow.client.core.Step:
|
231
|
-
"""
|
232
|
-
Returns the Step object with the step name 'name'
|
233
|
-
|
234
|
-
Parameters
|
235
|
-
----------
|
236
|
-
name : str
|
237
|
-
Step name
|
238
|
-
|
239
|
-
Returns
|
240
|
-
-------
|
241
|
-
Step
|
242
|
-
Step for this step name in this Run
|
243
|
-
|
244
|
-
Raises
|
245
|
-
------
|
246
|
-
KeyError
|
247
|
-
If the name does not identify a valid Step object
|
248
|
-
"""
|
249
|
-
...
|
250
|
-
def __getstate__(self):
|
251
|
-
...
|
252
|
-
def __setstate__(self, state):
|
253
|
-
...
|
254
|
-
@property
|
255
|
-
def trigger(self) -> typing.Optional[metaflow.events.Trigger]:
|
256
|
-
"""
|
257
|
-
Returns a container of events that triggered this run.
|
258
|
-
|
259
|
-
This returns None if the run was not triggered by any events.
|
260
|
-
|
261
|
-
Returns
|
262
|
-
-------
|
263
|
-
Trigger, optional
|
264
|
-
Container of triggering events
|
265
|
-
"""
|
266
|
-
...
|
267
|
-
...
|
268
|
-
|
269
|
-
def handle_timeout(tfp_runner_attribute, command_obj: "CommandManager", file_read_timeout: int):
|
270
|
-
"""
|
271
|
-
Handle the timeout for a running subprocess command that reads a file
|
272
|
-
and raises an error with appropriate logs if a TimeoutError occurs.
|
273
|
-
|
274
|
-
Parameters
|
275
|
-
----------
|
276
|
-
tfp_runner_attribute : NamedTemporaryFile
|
277
|
-
Temporary file that stores runner attribute data.
|
278
|
-
command_obj : CommandManager
|
279
|
-
Command manager object that encapsulates the running command details.
|
280
|
-
file_read_timeout : int
|
281
|
-
Timeout for reading the file.
|
282
|
-
|
283
|
-
Returns
|
284
|
-
-------
|
285
|
-
str
|
286
|
-
Content read from the temporary file.
|
287
|
-
|
288
|
-
Raises
|
289
|
-
------
|
290
|
-
RuntimeError
|
291
|
-
If a TimeoutError occurs, it raises a RuntimeError with the command's
|
292
|
-
stdout and stderr logs.
|
293
|
-
"""
|
294
|
-
...
|
295
|
-
|
296
|
-
class CommandManager(object, metaclass=type):
|
297
|
-
"""
|
298
|
-
A manager for an individual subprocess.
|
299
|
-
"""
|
300
|
-
def __init__(self, command: typing.List[str], env: typing.Optional[typing.Dict[str, str]] = None, cwd: typing.Optional[str] = None):
|
301
|
-
"""
|
302
|
-
Create a new CommandManager object.
|
303
|
-
This does not run the process itself but sets it up.
|
304
|
-
|
305
|
-
Parameters
|
306
|
-
----------
|
307
|
-
command : List[str]
|
308
|
-
The command to run in List form.
|
309
|
-
env : Optional[Dict[str, str]], default None
|
310
|
-
Environment variables to set for the subprocess; if not specified,
|
311
|
-
the current enviornment variables are used.
|
312
|
-
cwd : Optional[str], default None
|
313
|
-
The directory to run the subprocess in; if not specified, the current
|
314
|
-
directory is used.
|
315
|
-
"""
|
316
|
-
...
|
317
|
-
def __aenter__(self) -> metaflow.runner.subprocess_manager.CommandManager:
|
318
|
-
...
|
319
|
-
def __aexit__(self, exc_type, exc_value, traceback):
|
320
|
-
...
|
321
|
-
def wait(self, timeout: typing.Optional[float] = None, stream: typing.Optional[str] = None):
|
322
|
-
"""
|
323
|
-
Wait for the subprocess to finish, optionally with a timeout
|
324
|
-
and optionally streaming its output.
|
325
|
-
|
326
|
-
You can only call `wait` if `async_run` has already been called.
|
327
|
-
|
328
|
-
Parameters
|
329
|
-
----------
|
330
|
-
timeout : Optional[float], default None
|
331
|
-
The maximum time to wait for the subprocess to finish.
|
332
|
-
If the timeout is reached, the subprocess is killed.
|
333
|
-
stream : Optional[str], default None
|
334
|
-
If specified, the specified stream is printed to stdout. `stream` can
|
335
|
-
be one of `stdout` or `stderr`.
|
336
|
-
"""
|
337
|
-
...
|
338
|
-
def sync_wait(self):
|
339
|
-
...
|
340
|
-
def run(self, show_output: bool = False):
|
341
|
-
"""
|
342
|
-
Run the subprocess synchronously. This can only be called once.
|
343
|
-
|
344
|
-
This also waits on the process implicitly.
|
345
|
-
|
346
|
-
Parameters
|
347
|
-
----------
|
348
|
-
show_output : bool, default False
|
349
|
-
Suppress the 'stdout' and 'stderr' to the console by default.
|
350
|
-
They can be accessed later by reading the files present in:
|
351
|
-
- self.log_files["stdout"]
|
352
|
-
- self.log_files["stderr"]
|
353
|
-
"""
|
354
|
-
...
|
355
|
-
def async_run(self):
|
356
|
-
"""
|
357
|
-
Run the subprocess asynchronously. This can only be called once.
|
358
|
-
|
359
|
-
Once this is called, you can then wait on the process (using `wait`), stream
|
360
|
-
logs (using `stream_logs`) or kill it (using `kill`).
|
361
|
-
"""
|
362
|
-
...
|
363
|
-
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]]:
|
364
|
-
"""
|
365
|
-
Stream logs from the subprocess line by line.
|
366
|
-
|
367
|
-
Parameters
|
368
|
-
----------
|
369
|
-
stream : str
|
370
|
-
The stream to stream logs from. Can be one of "stdout" or "stderr".
|
371
|
-
position : Optional[int], default None
|
372
|
-
The position in the log file to start streaming from. If None, it starts
|
373
|
-
from the beginning of the log file. This allows resuming streaming from
|
374
|
-
a previously known position
|
375
|
-
timeout_per_line : Optional[float], default None
|
376
|
-
The time to wait for a line to be read from the log file. If None, it
|
377
|
-
waits indefinitely. If the timeout is reached, a LogReadTimeoutError
|
378
|
-
is raised. Note that this timeout is *per line* and not cumulative so this
|
379
|
-
function may take significantly more time than `timeout_per_line`
|
380
|
-
log_write_delay : float, default 0.01
|
381
|
-
Improves the probability of getting whole lines. This setting is for
|
382
|
-
advanced use cases.
|
383
|
-
|
384
|
-
Yields
|
385
|
-
------
|
386
|
-
Tuple[int, str]
|
387
|
-
A tuple containing the position in the log file and the line read. The
|
388
|
-
position returned can be used to feed into another `stream_logs` call
|
389
|
-
for example.
|
390
|
-
"""
|
391
|
-
...
|
392
|
-
def emit_logs(self, stream: str = "stdout", custom_logger: typing.Callable[..., None] = print):
|
393
|
-
"""
|
394
|
-
Helper function that can easily emit all the logs for a given stream.
|
395
|
-
|
396
|
-
This function will only terminate when all the log has been printed.
|
397
|
-
|
398
|
-
Parameters
|
399
|
-
----------
|
400
|
-
stream : str, default "stdout"
|
401
|
-
The stream to emit logs for. Can be one of "stdout" or "stderr".
|
402
|
-
custom_logger : Callable[..., None], default print
|
403
|
-
A custom logger function that takes in a string and "emits" it. By default,
|
404
|
-
the log is printed to stdout.
|
405
|
-
"""
|
406
|
-
...
|
407
|
-
def cleanup(self):
|
408
|
-
"""
|
409
|
-
Clean up log files for a running subprocesses.
|
410
|
-
"""
|
411
|
-
...
|
412
|
-
def kill(self, termination_timeout: float = 2):
|
413
|
-
"""
|
414
|
-
Kill the subprocess and its descendants.
|
415
|
-
|
416
|
-
Parameters
|
417
|
-
----------
|
418
|
-
termination_timeout : float, default 2
|
419
|
-
The time to wait after sending a SIGTERM to the process and its descendants
|
420
|
-
before sending a SIGKILL.
|
421
|
-
"""
|
422
|
-
...
|
423
|
-
...
|
424
|
-
|
425
|
-
class SubprocessManager(object, metaclass=type):
|
426
|
-
"""
|
427
|
-
A manager for subprocesses. The subprocess manager manages one or more
|
428
|
-
CommandManager objects, each of which manages an individual subprocess.
|
429
|
-
"""
|
430
|
-
def __init__(self):
|
431
|
-
...
|
432
|
-
def __aenter__(self) -> metaflow.runner.subprocess_manager.SubprocessManager:
|
433
|
-
...
|
434
|
-
def __aexit__(self, exc_type, exc_value, traceback):
|
435
|
-
...
|
436
|
-
def run_command(self, command: typing.List[str], env: typing.Optional[typing.Dict[str, str]] = None, cwd: typing.Optional[str] = None, show_output: bool = False) -> int:
|
437
|
-
"""
|
438
|
-
Run a command synchronously and return its process ID.
|
439
|
-
|
440
|
-
Parameters
|
441
|
-
----------
|
442
|
-
command : List[str]
|
443
|
-
The command to run in List form.
|
444
|
-
env : Optional[Dict[str, str]], default None
|
445
|
-
Environment variables to set for the subprocess; if not specified,
|
446
|
-
the current enviornment variables are used.
|
447
|
-
cwd : Optional[str], default None
|
448
|
-
The directory to run the subprocess in; if not specified, the current
|
449
|
-
directory is used.
|
450
|
-
show_output : bool, default False
|
451
|
-
Suppress the 'stdout' and 'stderr' to the console by default.
|
452
|
-
They can be accessed later by reading the files present in the
|
453
|
-
CommandManager object:
|
454
|
-
- command_obj.log_files["stdout"]
|
455
|
-
- command_obj.log_files["stderr"]
|
456
|
-
Returns
|
457
|
-
-------
|
458
|
-
int
|
459
|
-
The process ID of the subprocess.
|
460
|
-
"""
|
461
|
-
...
|
462
|
-
def async_run_command(self, command: typing.List[str], env: typing.Optional[typing.Dict[str, str]] = None, cwd: typing.Optional[str] = None) -> int:
|
463
|
-
"""
|
464
|
-
Run a command asynchronously and return its process ID.
|
465
|
-
|
466
|
-
Parameters
|
467
|
-
----------
|
468
|
-
command : List[str]
|
469
|
-
The command to run in List form.
|
470
|
-
env : Optional[Dict[str, str]], default None
|
471
|
-
Environment variables to set for the subprocess; if not specified,
|
472
|
-
the current enviornment variables are used.
|
473
|
-
cwd : Optional[str], default None
|
474
|
-
The directory to run the subprocess in; if not specified, the current
|
475
|
-
directory is used.
|
476
|
-
|
477
|
-
Returns
|
478
|
-
-------
|
479
|
-
int
|
480
|
-
The process ID of the subprocess.
|
481
|
-
"""
|
482
|
-
...
|
483
|
-
def get(self, pid: int) -> typing.Optional["CommandManager"]:
|
484
|
-
"""
|
485
|
-
Get one of the CommandManager managed by this SubprocessManager.
|
486
|
-
|
487
|
-
Parameters
|
488
|
-
----------
|
489
|
-
pid : int
|
490
|
-
The process ID of the subprocess (returned by run_command or async_run_command).
|
491
|
-
|
492
|
-
Returns
|
493
|
-
-------
|
494
|
-
Optional[CommandManager]
|
495
|
-
The CommandManager object for the given process ID, or None if not found.
|
496
|
-
"""
|
497
|
-
...
|
498
|
-
def cleanup(self):
|
499
|
-
"""
|
500
|
-
Clean up log files for all running subprocesses.
|
501
|
-
"""
|
502
|
-
...
|
503
|
-
...
|
15
|
+
from ..client.core import Run as Run
|
16
|
+
from .utils import handle_timeout as handle_timeout
|
17
|
+
from .subprocess_manager import CommandManager as CommandManager
|
18
|
+
from .subprocess_manager import SubprocessManager as SubprocessManager
|
504
19
|
|
505
20
|
class ExecutingRun(object, metaclass=type):
|
506
21
|
"""
|
@@ -534,11 +49,11 @@ class ExecutingRun(object, metaclass=type):
|
|
534
49
|
Run object corresponding to this run.
|
535
50
|
"""
|
536
51
|
...
|
537
|
-
def __enter__(self) -> ExecutingRun:
|
52
|
+
def __enter__(self) -> "ExecutingRun":
|
538
53
|
...
|
539
54
|
def __exit__(self, exc_type, exc_value, traceback):
|
540
55
|
...
|
541
|
-
def wait(self, timeout: typing.Optional[float] = None, stream: typing.Optional[str] = None) -> ExecutingRun:
|
56
|
+
def wait(self, timeout: typing.Optional[float] = None, stream: typing.Optional[str] = None) -> "ExecutingRun":
|
542
57
|
"""
|
543
58
|
Wait for this run to finish, optionally with a timeout
|
544
59
|
and optionally streaming its output.
|
@@ -547,10 +62,11 @@ class ExecutingRun(object, metaclass=type):
|
|
547
62
|
|
548
63
|
Parameters
|
549
64
|
----------
|
550
|
-
timeout :
|
551
|
-
The maximum time to wait for the run to finish.
|
552
|
-
If the timeout is reached, the run is terminated
|
553
|
-
|
65
|
+
timeout : float, optional, default None
|
66
|
+
The maximum time, in seconds, to wait for the run to finish.
|
67
|
+
If the timeout is reached, the run is terminated. If not specified, wait
|
68
|
+
forever.
|
69
|
+
stream : str, optional, default None
|
554
70
|
If specified, the specified stream is printed to stdout. `stream` can
|
555
71
|
be one of `stdout` or `stderr`.
|
556
72
|
|
@@ -626,7 +142,7 @@ class ExecutingRun(object, metaclass=type):
|
|
626
142
|
----------
|
627
143
|
stream : str
|
628
144
|
The stream to stream logs from. Can be one of `stdout` or `stderr`.
|
629
|
-
position :
|
145
|
+
position : int, optional, default None
|
630
146
|
The position in the log file to start streaming from. If None, it starts
|
631
147
|
from the beginning of the log file. This allows resuming streaming from
|
632
148
|
a previously known position
|
@@ -665,13 +181,13 @@ class Runner(object, metaclass=type):
|
|
665
181
|
show_output : bool, default True
|
666
182
|
Show the 'stdout' and 'stderr' to the console by default,
|
667
183
|
Only applicable for synchronous 'run' and 'resume' functions.
|
668
|
-
profile :
|
184
|
+
profile : str, optional, default None
|
669
185
|
Metaflow profile to use to run this run. If not specified, the default
|
670
186
|
profile is used (or the one already set using `METAFLOW_PROFILE`)
|
671
|
-
env :
|
187
|
+
env : Dict[str, str], optional, default None
|
672
188
|
Additional environment variables to set for the Run. This overrides the
|
673
189
|
environment set for this process.
|
674
|
-
cwd :
|
190
|
+
cwd : str, optional, default None
|
675
191
|
The directory to run the subprocess in; if not specified, the current
|
676
192
|
directory is used.
|
677
193
|
file_read_timeout : int, default 3600
|
@@ -680,11 +196,11 @@ class Runner(object, metaclass=type):
|
|
680
196
|
Additional arguments that you would pass to `python myflow.py` before
|
681
197
|
the `run` command.
|
682
198
|
"""
|
683
|
-
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):
|
199
|
+
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict[str, str]] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
|
684
200
|
...
|
685
|
-
def __enter__(self) -> Runner:
|
201
|
+
def __enter__(self) -> "Runner":
|
686
202
|
...
|
687
|
-
def __aenter__(self) -> Runner:
|
203
|
+
def __aenter__(self) -> "Runner":
|
688
204
|
...
|
689
205
|
def _Runner__get_executing_run(self, tfp_runner_attribute, command_obj):
|
690
206
|
...
|
@@ -1,65 +1,16 @@
|
|
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.29 #
|
4
|
+
# Generated on 2024-11-07T22:19:34.575166 #
|
5
|
+
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
"""
|
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):
|
37
|
-
...
|
38
|
-
def _Deployer__make_function(self, deployer_class):
|
39
|
-
"""
|
40
|
-
Create a function for the given deployer class.
|
41
|
-
|
42
|
-
Parameters
|
43
|
-
----------
|
44
|
-
deployer_class : Type[DeployerImpl]
|
45
|
-
Deployer implementation class.
|
46
|
-
|
47
|
-
Returns
|
48
|
-
-------
|
49
|
-
Callable
|
50
|
-
Function that initializes and returns an instance of the deployer class.
|
51
|
-
"""
|
52
|
-
...
|
53
|
-
...
|
54
|
-
|
55
|
-
def get_current_cell(ipython):
|
56
|
-
...
|
57
|
-
|
58
|
-
def format_flowfile(cell):
|
59
|
-
"""
|
60
|
-
Formats the given cell content to create a valid Python script that can be executed as a Metaflow flow.
|
61
|
-
"""
|
62
|
-
...
|
11
|
+
from .deployer import Deployer as Deployer
|
12
|
+
from .utils import get_current_cell as get_current_cell
|
13
|
+
from .utils import format_flowfile as format_flowfile
|
63
14
|
|
64
15
|
class NBDeployerInitializationError(Exception, metaclass=type):
|
65
16
|
"""
|
@@ -92,13 +43,13 @@ class NBDeployer(object, metaclass=type):
|
|
92
43
|
Flow defined in the same cell
|
93
44
|
show_output : bool, default True
|
94
45
|
Show the 'stdout' and 'stderr' to the console by default,
|
95
|
-
profile :
|
46
|
+
profile : str, optional, default None
|
96
47
|
Metaflow profile to use to deploy this run. If not specified, the default
|
97
48
|
profile is used (or the one already set using `METAFLOW_PROFILE`)
|
98
|
-
env :
|
49
|
+
env : Dict[str, str], optional, default None
|
99
50
|
Additional environment variables to set. This overrides the
|
100
51
|
environment set for this process.
|
101
|
-
base_dir :
|
52
|
+
base_dir : str, optional, default None
|
102
53
|
The directory to run the subprocess in; if not specified, the current
|
103
54
|
working directory is used.
|
104
55
|
**kwargs : Any
|
@@ -107,6 +58,11 @@ class NBDeployer(object, metaclass=type):
|
|
107
58
|
"""
|
108
59
|
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
|
109
60
|
...
|
61
|
+
def __getattr__(self, name):
|
62
|
+
"""
|
63
|
+
Forward all attribute access to the underlying `Deployer` instance.
|
64
|
+
"""
|
65
|
+
...
|
110
66
|
def cleanup(self):
|
111
67
|
"""
|
112
68
|
Delete any temporary files created during execution.
|