ob-metaflow-stubs 6.0.3.139__py2.py3-none-any.whl → 6.0.3.141__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 +838 -258
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +2 -2
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +101 -101
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +10 -10
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -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 +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- 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_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- 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 +4 -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_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- 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 +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -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 +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +20 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +6 -6
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +5 -5
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +2 -4
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.139.dist-info → ob_metaflow_stubs-6.0.3.141.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.141.dist-info/RECORD +192 -0
- ob_metaflow_stubs-6.0.3.139.dist-info/RECORD +0 -192
- {ob_metaflow_stubs-6.0.3.139.dist-info → ob_metaflow_stubs-6.0.3.141.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.139.dist-info → ob_metaflow_stubs-6.0.3.141.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.
|
4
|
-
# Generated on 2025-02-
|
3
|
+
# MF version: 2.14.0.1+obcheckpoint(0.1.8);ob(v1) #
|
4
|
+
# Generated on 2025-02-13T16:37:07.058478 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -35,9 +35,9 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import cards as cards
|
39
|
-
from . import tuple_util as tuple_util
|
40
38
|
from . import events as events
|
39
|
+
from . import tuple_util as tuple_util
|
40
|
+
from . import cards as cards
|
41
41
|
from . import runner as runner
|
42
42
|
from . import plugins as plugins
|
43
43
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
@@ -146,57 +146,133 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
146
146
|
"""
|
147
147
|
...
|
148
148
|
|
149
|
+
def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
150
|
+
"""
|
151
|
+
Specifies that this step should execute on DGX cloud.
|
152
|
+
|
153
|
+
|
154
|
+
Parameters
|
155
|
+
----------
|
156
|
+
gpu : int
|
157
|
+
Number of GPUs to use.
|
158
|
+
gpu_type : str
|
159
|
+
Type of Nvidia GPU to use.
|
160
|
+
queue_timeout : int
|
161
|
+
Time to keep the job in NVCF's queue.
|
162
|
+
"""
|
163
|
+
...
|
164
|
+
|
149
165
|
@typing.overload
|
150
|
-
def
|
166
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
151
167
|
"""
|
152
|
-
Specifies
|
153
|
-
|
168
|
+
Specifies the Conda environment for the step.
|
169
|
+
|
170
|
+
Information in this decorator will augment any
|
171
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
172
|
+
you can use `@conda_base` to set packages required by all
|
173
|
+
steps and use `@conda` to specify step-specific overrides.
|
174
|
+
|
175
|
+
|
176
|
+
Parameters
|
177
|
+
----------
|
178
|
+
packages : Dict[str, str], default {}
|
179
|
+
Packages to use for this step. The key is the name of the package
|
180
|
+
and the value is the version to use.
|
181
|
+
libraries : Dict[str, str], default {}
|
182
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
183
|
+
python : str, optional, default None
|
184
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
185
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
186
|
+
disabled : bool, default False
|
187
|
+
If set to True, disables @conda.
|
154
188
|
"""
|
155
189
|
...
|
156
190
|
|
157
191
|
@typing.overload
|
158
|
-
def
|
192
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
159
193
|
...
|
160
194
|
|
161
195
|
@typing.overload
|
162
|
-
def
|
196
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
163
197
|
...
|
164
198
|
|
165
|
-
def
|
199
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
166
200
|
"""
|
167
|
-
Specifies
|
168
|
-
|
201
|
+
Specifies the Conda environment for the step.
|
202
|
+
|
203
|
+
Information in this decorator will augment any
|
204
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
205
|
+
you can use `@conda_base` to set packages required by all
|
206
|
+
steps and use `@conda` to specify step-specific overrides.
|
207
|
+
|
208
|
+
|
209
|
+
Parameters
|
210
|
+
----------
|
211
|
+
packages : Dict[str, str], default {}
|
212
|
+
Packages to use for this step. The key is the name of the package
|
213
|
+
and the value is the version to use.
|
214
|
+
libraries : Dict[str, str], default {}
|
215
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
216
|
+
python : str, optional, default None
|
217
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
218
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
219
|
+
disabled : bool, default False
|
220
|
+
If set to True, disables @conda.
|
169
221
|
"""
|
170
222
|
...
|
171
223
|
|
172
224
|
@typing.overload
|
173
|
-
def
|
225
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
174
226
|
"""
|
175
|
-
Specifies the
|
227
|
+
Specifies the number of times the task corresponding
|
228
|
+
to a step needs to be retried.
|
176
229
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
230
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
231
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
232
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
233
|
+
|
234
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
235
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
236
|
+
ensuring that the flow execution can continue.
|
237
|
+
|
238
|
+
|
239
|
+
Parameters
|
240
|
+
----------
|
241
|
+
times : int, default 3
|
242
|
+
Number of times to retry this task.
|
243
|
+
minutes_between_retries : int, default 2
|
244
|
+
Number of minutes between retries.
|
181
245
|
"""
|
182
246
|
...
|
183
247
|
|
184
248
|
@typing.overload
|
185
|
-
def
|
249
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
186
250
|
...
|
187
251
|
|
188
252
|
@typing.overload
|
189
|
-
def
|
253
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
190
254
|
...
|
191
255
|
|
192
|
-
def
|
256
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
193
257
|
"""
|
194
|
-
Specifies the
|
258
|
+
Specifies the number of times the task corresponding
|
259
|
+
to a step needs to be retried.
|
195
260
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
261
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
262
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
263
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
264
|
+
|
265
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
266
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
267
|
+
ensuring that the flow execution can continue.
|
268
|
+
|
269
|
+
|
270
|
+
Parameters
|
271
|
+
----------
|
272
|
+
times : int, default 3
|
273
|
+
Number of times to retry this task.
|
274
|
+
minutes_between_retries : int, default 2
|
275
|
+
Number of minutes between retries.
|
200
276
|
"""
|
201
277
|
...
|
202
278
|
|
@@ -206,6 +282,18 @@ def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typ
|
|
206
282
|
Creates a human-readable report, a Metaflow Card, after this step completes.
|
207
283
|
|
208
284
|
Note that you may add multiple `@card` decorators in a step with different parameters.
|
285
|
+
|
286
|
+
|
287
|
+
Parameters
|
288
|
+
----------
|
289
|
+
type : str, default 'default'
|
290
|
+
Card type.
|
291
|
+
id : str, optional, default None
|
292
|
+
If multiple cards are present, use this id to identify this card.
|
293
|
+
options : Dict[str, Any], default {}
|
294
|
+
Options passed to the card. The contents depend on the card type.
|
295
|
+
timeout : int, default 45
|
296
|
+
Interrupt reporting if it takes more than this many seconds.
|
209
297
|
"""
|
210
298
|
...
|
211
299
|
|
@@ -222,12 +310,206 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
222
310
|
Creates a human-readable report, a Metaflow Card, after this step completes.
|
223
311
|
|
224
312
|
Note that you may add multiple `@card` decorators in a step with different parameters.
|
313
|
+
|
314
|
+
|
315
|
+
Parameters
|
316
|
+
----------
|
317
|
+
type : str, default 'default'
|
318
|
+
Card type.
|
319
|
+
id : str, optional, default None
|
320
|
+
If multiple cards are present, use this id to identify this card.
|
321
|
+
options : Dict[str, Any], default {}
|
322
|
+
Options passed to the card. The contents depend on the card type.
|
323
|
+
timeout : int, default 45
|
324
|
+
Interrupt reporting if it takes more than this many seconds.
|
225
325
|
"""
|
226
326
|
...
|
227
327
|
|
228
|
-
def
|
328
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
229
329
|
"""
|
230
|
-
Specifies that this step should execute on
|
330
|
+
Specifies that this step should execute on Kubernetes.
|
331
|
+
|
332
|
+
|
333
|
+
Parameters
|
334
|
+
----------
|
335
|
+
cpu : int, default 1
|
336
|
+
Number of CPUs required for this step. If `@resources` is
|
337
|
+
also present, the maximum value from all decorators is used.
|
338
|
+
memory : int, default 4096
|
339
|
+
Memory size (in MB) required for this step. If
|
340
|
+
`@resources` is also present, the maximum value from all decorators is
|
341
|
+
used.
|
342
|
+
disk : int, default 10240
|
343
|
+
Disk size (in MB) required for this step. If
|
344
|
+
`@resources` is also present, the maximum value from all decorators is
|
345
|
+
used.
|
346
|
+
image : str, optional, default None
|
347
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
348
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
349
|
+
not, a default Docker image mapping to the current version of Python is used.
|
350
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
351
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
352
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
353
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
354
|
+
secrets : List[str], optional, default None
|
355
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
356
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
357
|
+
in Metaflow configuration.
|
358
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
359
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
360
|
+
Can be passed in as a comma separated string of values e.g.
|
361
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
362
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
363
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
364
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
365
|
+
gpu : int, optional, default None
|
366
|
+
Number of GPUs required for this step. A value of zero implies that
|
367
|
+
the scheduled node should not have GPUs.
|
368
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
369
|
+
The vendor of the GPUs to be used for this step.
|
370
|
+
tolerations : List[str], default []
|
371
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
372
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
373
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
374
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
375
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
376
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
377
|
+
use_tmpfs : bool, default False
|
378
|
+
This enables an explicit tmpfs mount for this step.
|
379
|
+
tmpfs_tempdir : bool, default True
|
380
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
381
|
+
tmpfs_size : int, optional, default: None
|
382
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
383
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
384
|
+
memory allocated for this step.
|
385
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
386
|
+
Path to tmpfs mount for this step.
|
387
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
388
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
389
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
390
|
+
shared_memory: int, optional
|
391
|
+
Shared memory size (in MiB) required for this step
|
392
|
+
port: int, optional
|
393
|
+
Port number to specify in the Kubernetes job object
|
394
|
+
compute_pool : str, optional, default None
|
395
|
+
Compute pool to be used for for this step.
|
396
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
397
|
+
hostname_resolution_timeout: int, default 10 * 60
|
398
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
399
|
+
Only applicable when @parallel is used.
|
400
|
+
qos: str, default: Burstable
|
401
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
402
|
+
"""
|
403
|
+
...
|
404
|
+
|
405
|
+
@typing.overload
|
406
|
+
def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
407
|
+
"""
|
408
|
+
Enables checkpointing for a step.
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
Parameters
|
413
|
+
----------
|
414
|
+
load_policy : str, default: "fresh"
|
415
|
+
The policy for loading the checkpoint. The following policies are supported:
|
416
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
417
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
418
|
+
will be loaded at the start of the task.
|
419
|
+
- "none": Do not load any checkpoint
|
420
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
421
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
422
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
423
|
+
created within the task will be loaded when the task is retries execution on failure.
|
424
|
+
|
425
|
+
temp_dir_root : str, default: None
|
426
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
427
|
+
"""
|
428
|
+
...
|
429
|
+
|
430
|
+
@typing.overload
|
431
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
432
|
+
...
|
433
|
+
|
434
|
+
@typing.overload
|
435
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
436
|
+
...
|
437
|
+
|
438
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
439
|
+
"""
|
440
|
+
Enables checkpointing for a step.
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
Parameters
|
445
|
+
----------
|
446
|
+
load_policy : str, default: "fresh"
|
447
|
+
The policy for loading the checkpoint. The following policies are supported:
|
448
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
449
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
450
|
+
will be loaded at the start of the task.
|
451
|
+
- "none": Do not load any checkpoint
|
452
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
453
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
454
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
455
|
+
created within the task will be loaded when the task is retries execution on failure.
|
456
|
+
|
457
|
+
temp_dir_root : str, default: None
|
458
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
459
|
+
"""
|
460
|
+
...
|
461
|
+
|
462
|
+
@typing.overload
|
463
|
+
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
464
|
+
"""
|
465
|
+
Specifies environment variables to be set prior to the execution of a step.
|
466
|
+
|
467
|
+
|
468
|
+
Parameters
|
469
|
+
----------
|
470
|
+
vars : Dict[str, str], default {}
|
471
|
+
Dictionary of environment variables to set.
|
472
|
+
"""
|
473
|
+
...
|
474
|
+
|
475
|
+
@typing.overload
|
476
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
477
|
+
...
|
478
|
+
|
479
|
+
@typing.overload
|
480
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
481
|
+
...
|
482
|
+
|
483
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
484
|
+
"""
|
485
|
+
Specifies environment variables to be set prior to the execution of a step.
|
486
|
+
|
487
|
+
|
488
|
+
Parameters
|
489
|
+
----------
|
490
|
+
vars : Dict[str, str], default {}
|
491
|
+
Dictionary of environment variables to set.
|
492
|
+
"""
|
493
|
+
...
|
494
|
+
|
495
|
+
@typing.overload
|
496
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
497
|
+
"""
|
498
|
+
Internal decorator to support Fast bakery
|
499
|
+
Parameters
|
500
|
+
----------
|
501
|
+
"""
|
502
|
+
...
|
503
|
+
|
504
|
+
@typing.overload
|
505
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
506
|
+
...
|
507
|
+
|
508
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
509
|
+
"""
|
510
|
+
Internal decorator to support Fast bakery
|
511
|
+
Parameters
|
512
|
+
----------
|
231
513
|
"""
|
232
514
|
...
|
233
515
|
|
@@ -244,6 +526,16 @@ def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Cal
|
|
244
526
|
|
245
527
|
Note that all the values specified in parameters are added together so if you specify
|
246
528
|
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
529
|
+
|
530
|
+
|
531
|
+
Parameters
|
532
|
+
----------
|
533
|
+
seconds : int, default 0
|
534
|
+
Number of seconds to wait prior to timing out.
|
535
|
+
minutes : int, default 0
|
536
|
+
Number of minutes to wait prior to timing out.
|
537
|
+
hours : int, default 0
|
538
|
+
Number of hours to wait prior to timing out.
|
247
539
|
"""
|
248
540
|
...
|
249
541
|
|
@@ -267,6 +559,41 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
267
559
|
|
268
560
|
Note that all the values specified in parameters are added together so if you specify
|
269
561
|
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
562
|
+
|
563
|
+
|
564
|
+
Parameters
|
565
|
+
----------
|
566
|
+
seconds : int, default 0
|
567
|
+
Number of seconds to wait prior to timing out.
|
568
|
+
minutes : int, default 0
|
569
|
+
Number of minutes to wait prior to timing out.
|
570
|
+
hours : int, default 0
|
571
|
+
Number of hours to wait prior to timing out.
|
572
|
+
"""
|
573
|
+
...
|
574
|
+
|
575
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
576
|
+
"""
|
577
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
578
|
+
|
579
|
+
|
580
|
+
Parameters
|
581
|
+
----------
|
582
|
+
temp_dir_root : str, optional
|
583
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
584
|
+
|
585
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
586
|
+
The list of repos (models/datasets) to load.
|
587
|
+
|
588
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
589
|
+
|
590
|
+
- If repo (model/dataset) is not found in the datastore:
|
591
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
592
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
593
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
594
|
+
|
595
|
+
- If repo is found in the datastore:
|
596
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
270
597
|
"""
|
271
598
|
...
|
272
599
|
|
@@ -279,6 +606,16 @@ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) ->
|
|
279
606
|
contains the exception raised. You can use it to detect the presence
|
280
607
|
of errors, indicating that all happy-path artifacts produced by the step
|
281
608
|
are missing.
|
609
|
+
|
610
|
+
|
611
|
+
Parameters
|
612
|
+
----------
|
613
|
+
var : str, optional, default None
|
614
|
+
Name of the artifact in which to store the caught exception.
|
615
|
+
If not specified, the exception is not stored.
|
616
|
+
print_exception : bool, default True
|
617
|
+
Determines whether or not the exception is printed to
|
618
|
+
stdout when caught.
|
282
619
|
"""
|
283
620
|
...
|
284
621
|
|
@@ -298,53 +635,75 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
298
635
|
contains the exception raised. You can use it to detect the presence
|
299
636
|
of errors, indicating that all happy-path artifacts produced by the step
|
300
637
|
are missing.
|
638
|
+
|
639
|
+
|
640
|
+
Parameters
|
641
|
+
----------
|
642
|
+
var : str, optional, default None
|
643
|
+
Name of the artifact in which to store the caught exception.
|
644
|
+
If not specified, the exception is not stored.
|
645
|
+
print_exception : bool, default True
|
646
|
+
Determines whether or not the exception is printed to
|
647
|
+
stdout when caught.
|
301
648
|
"""
|
302
649
|
...
|
303
650
|
|
304
651
|
@typing.overload
|
305
|
-
def
|
652
|
+
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
306
653
|
"""
|
307
|
-
Specifies the
|
308
|
-
to a step needs to be retried.
|
654
|
+
Specifies the PyPI packages for the step.
|
309
655
|
|
310
|
-
|
311
|
-
|
312
|
-
|
656
|
+
Information in this decorator will augment any
|
657
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
658
|
+
you can use `@pypi_base` to set packages required by all
|
659
|
+
steps and use `@pypi` to specify step-specific overrides.
|
313
660
|
|
314
|
-
|
315
|
-
|
316
|
-
|
661
|
+
|
662
|
+
Parameters
|
663
|
+
----------
|
664
|
+
packages : Dict[str, str], default: {}
|
665
|
+
Packages to use for this step. The key is the name of the package
|
666
|
+
and the value is the version to use.
|
667
|
+
python : str, optional, default: None
|
668
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
669
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
317
670
|
"""
|
318
671
|
...
|
319
672
|
|
320
673
|
@typing.overload
|
321
|
-
def
|
674
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
322
675
|
...
|
323
676
|
|
324
677
|
@typing.overload
|
325
|
-
def
|
678
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
326
679
|
...
|
327
680
|
|
328
|
-
def
|
681
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
329
682
|
"""
|
330
|
-
Specifies the
|
331
|
-
to a step needs to be retried.
|
683
|
+
Specifies the PyPI packages for the step.
|
332
684
|
|
333
|
-
|
334
|
-
|
335
|
-
|
685
|
+
Information in this decorator will augment any
|
686
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
687
|
+
you can use `@pypi_base` to set packages required by all
|
688
|
+
steps and use `@pypi` to specify step-specific overrides.
|
336
689
|
|
337
|
-
|
338
|
-
|
339
|
-
|
690
|
+
|
691
|
+
Parameters
|
692
|
+
----------
|
693
|
+
packages : Dict[str, str], default: {}
|
694
|
+
Packages to use for this step. The key is the name of the package
|
695
|
+
and the value is the version to use.
|
696
|
+
python : str, optional, default: None
|
697
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
698
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
340
699
|
"""
|
341
700
|
...
|
342
701
|
|
343
702
|
@typing.overload
|
344
703
|
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
345
704
|
"""
|
346
|
-
|
347
|
-
|
705
|
+
Parameters
|
706
|
+
----------
|
348
707
|
"""
|
349
708
|
...
|
350
709
|
|
@@ -354,31 +713,76 @@ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None])
|
|
354
713
|
|
355
714
|
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
356
715
|
"""
|
357
|
-
|
358
|
-
|
716
|
+
Parameters
|
717
|
+
----------
|
359
718
|
"""
|
360
719
|
...
|
361
720
|
|
362
|
-
|
721
|
+
@typing.overload
|
722
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
363
723
|
"""
|
364
|
-
Specifies
|
724
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
725
|
+
the execution of a step.
|
726
|
+
|
727
|
+
|
728
|
+
Parameters
|
729
|
+
----------
|
730
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
731
|
+
List of secret specs, defining how the secrets are to be retrieved
|
365
732
|
"""
|
366
733
|
...
|
367
734
|
|
368
735
|
@typing.overload
|
369
|
-
def
|
370
|
-
"""
|
371
|
-
Internal decorator to support Fast bakery
|
372
|
-
"""
|
736
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
373
737
|
...
|
374
738
|
|
375
739
|
@typing.overload
|
376
|
-
def
|
740
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
377
741
|
...
|
378
742
|
|
379
|
-
def
|
743
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
380
744
|
"""
|
381
|
-
|
745
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
746
|
+
the execution of a step.
|
747
|
+
|
748
|
+
|
749
|
+
Parameters
|
750
|
+
----------
|
751
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
752
|
+
List of secret specs, defining how the secrets are to be retrieved
|
753
|
+
"""
|
754
|
+
...
|
755
|
+
|
756
|
+
def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
757
|
+
"""
|
758
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
759
|
+
|
760
|
+
User code call
|
761
|
+
-----------
|
762
|
+
@nim(
|
763
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
764
|
+
backend='managed'
|
765
|
+
)
|
766
|
+
|
767
|
+
Valid backend options
|
768
|
+
---------------------
|
769
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
770
|
+
|
771
|
+
Valid model options
|
772
|
+
----------------
|
773
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
774
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
775
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
776
|
+
|
777
|
+
|
778
|
+
Parameters
|
779
|
+
----------
|
780
|
+
models: list[NIM]
|
781
|
+
List of NIM containers running models in sidecars.
|
782
|
+
backend: str
|
783
|
+
Compute provider to run the NIM container.
|
784
|
+
queue_timeout : int
|
785
|
+
Time to keep the job in NVCF's queue.
|
382
786
|
"""
|
383
787
|
...
|
384
788
|
|
@@ -400,6 +804,21 @@ def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Op
|
|
400
804
|
```
|
401
805
|
which executes the flow on the desired system using the
|
402
806
|
requirements specified in `@resources`.
|
807
|
+
|
808
|
+
|
809
|
+
Parameters
|
810
|
+
----------
|
811
|
+
cpu : int, default 1
|
812
|
+
Number of CPUs required for this step.
|
813
|
+
gpu : int, optional, default None
|
814
|
+
Number of GPUs required for this step.
|
815
|
+
disk : int, optional, default None
|
816
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
817
|
+
memory : int, default 4096
|
818
|
+
Memory size (in MB) required for this step.
|
819
|
+
shared_memory : int, optional, default None
|
820
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
821
|
+
This parameter maps to the `--shm-size` option in Docker.
|
403
822
|
"""
|
404
823
|
...
|
405
824
|
|
@@ -428,27 +847,21 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
428
847
|
```
|
429
848
|
which executes the flow on the desired system using the
|
430
849
|
requirements specified in `@resources`.
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
447
|
-
...
|
448
|
-
|
449
|
-
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
450
|
-
"""
|
451
|
-
Enables checkpointing for a step.
|
850
|
+
|
851
|
+
|
852
|
+
Parameters
|
853
|
+
----------
|
854
|
+
cpu : int, default 1
|
855
|
+
Number of CPUs required for this step.
|
856
|
+
gpu : int, optional, default None
|
857
|
+
Number of GPUs required for this step.
|
858
|
+
disk : int, optional, default None
|
859
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
860
|
+
memory : int, default 4096
|
861
|
+
Memory size (in MB) required for this step.
|
862
|
+
shared_memory : int, optional, default None
|
863
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
864
|
+
This parameter maps to the `--shm-size` option in Docker.
|
452
865
|
"""
|
453
866
|
...
|
454
867
|
|
@@ -456,6 +869,24 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
456
869
|
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
457
870
|
"""
|
458
871
|
Enables loading / saving of models within a step.
|
872
|
+
|
873
|
+
|
874
|
+
|
875
|
+
Parameters
|
876
|
+
----------
|
877
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
878
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
879
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
880
|
+
- `current.checkpoint`
|
881
|
+
- `current.model`
|
882
|
+
- `current.huggingface_hub`
|
883
|
+
|
884
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
885
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
886
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
887
|
+
|
888
|
+
temp_dir_root : str, default: None
|
889
|
+
The root directory under which `current.model.loaded` will store loaded models
|
459
890
|
"""
|
460
891
|
...
|
461
892
|
|
@@ -470,87 +901,59 @@ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) ->
|
|
470
901
|
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
471
902
|
"""
|
472
903
|
Enables loading / saving of models within a step.
|
473
|
-
"""
|
474
|
-
...
|
475
|
-
|
476
|
-
@typing.overload
|
477
|
-
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
478
|
-
"""
|
479
|
-
Specifies the Conda environment for the step.
|
480
904
|
|
481
|
-
Information in this decorator will augment any
|
482
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
483
|
-
you can use `@conda_base` to set packages required by all
|
484
|
-
steps and use `@conda` to specify step-specific overrides.
|
485
|
-
"""
|
486
|
-
...
|
487
|
-
|
488
|
-
@typing.overload
|
489
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
490
|
-
...
|
491
|
-
|
492
|
-
@typing.overload
|
493
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
494
|
-
...
|
495
|
-
|
496
|
-
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
497
|
-
"""
|
498
|
-
Specifies the Conda environment for the step.
|
499
905
|
|
500
|
-
Information in this decorator will augment any
|
501
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
502
|
-
you can use `@conda_base` to set packages required by all
|
503
|
-
steps and use `@conda` to specify step-specific overrides.
|
504
|
-
"""
|
505
|
-
...
|
506
|
-
|
507
|
-
@typing.overload
|
508
|
-
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
509
|
-
"""
|
510
|
-
Specifies environment variables to be set prior to the execution of a step.
|
511
|
-
"""
|
512
|
-
...
|
513
|
-
|
514
|
-
@typing.overload
|
515
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
516
|
-
...
|
517
|
-
|
518
|
-
@typing.overload
|
519
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
520
|
-
...
|
521
|
-
|
522
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
523
|
-
"""
|
524
|
-
Specifies environment variables to be set prior to the execution of a step.
|
525
|
-
"""
|
526
|
-
...
|
527
|
-
|
528
|
-
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
529
|
-
"""
|
530
|
-
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
531
|
-
"""
|
532
|
-
...
|
533
|
-
|
534
|
-
@typing.overload
|
535
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
536
|
-
"""
|
537
|
-
Specifies the PyPI packages for all steps of the flow.
|
538
906
|
|
539
|
-
|
540
|
-
|
907
|
+
Parameters
|
908
|
+
----------
|
909
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
910
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
911
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
912
|
+
- `current.checkpoint`
|
913
|
+
- `current.model`
|
914
|
+
- `current.huggingface_hub`
|
915
|
+
|
916
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
917
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
918
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
919
|
+
|
920
|
+
temp_dir_root : str, default: None
|
921
|
+
The root directory under which `current.model.loaded` will store loaded models
|
541
922
|
"""
|
542
923
|
...
|
543
924
|
|
544
|
-
|
545
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
546
|
-
...
|
547
|
-
|
548
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
925
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
549
926
|
"""
|
550
|
-
Specifies
|
927
|
+
Specifies what flows belong to the same project.
|
551
928
|
|
552
|
-
|
553
|
-
|
929
|
+
A project-specific namespace is created for all flows that
|
930
|
+
use the same `@project(name)`.
|
931
|
+
|
932
|
+
|
933
|
+
Parameters
|
934
|
+
----------
|
935
|
+
name : str
|
936
|
+
Project name. Make sure that the name is unique amongst all
|
937
|
+
projects that use the same production scheduler. The name may
|
938
|
+
contain only lowercase alphanumeric characters and underscores.
|
939
|
+
|
940
|
+
branch : Optional[str], default None
|
941
|
+
The branch to use. If not specified, the branch is set to
|
942
|
+
`user.<username>` unless `production` is set to `True`. This can
|
943
|
+
also be set on the command line using `--branch` as a top-level option.
|
944
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
945
|
+
|
946
|
+
production : bool, default False
|
947
|
+
Whether or not the branch is the production branch. This can also be set on the
|
948
|
+
command line using `--production` as a top-level option. It is an error to specify
|
949
|
+
`production` in the decorator and on the command line.
|
950
|
+
The project branch name will be:
|
951
|
+
- if `branch` is specified:
|
952
|
+
- if `production` is True: `prod.<branch>`
|
953
|
+
- if `production` is False: `test.<branch>`
|
954
|
+
- if `branch` is not specified:
|
955
|
+
- if `production` is True: `prod`
|
956
|
+
- if `production` is False: `user.<username>`
|
554
957
|
"""
|
555
958
|
...
|
556
959
|
|
@@ -558,87 +961,136 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
558
961
|
"""
|
559
962
|
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
560
963
|
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
964
|
+
|
965
|
+
|
966
|
+
Parameters
|
967
|
+
----------
|
968
|
+
timeout : int
|
969
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
970
|
+
poke_interval : int
|
971
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
972
|
+
mode : str
|
973
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
974
|
+
exponential_backoff : bool
|
975
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
976
|
+
pool : str
|
977
|
+
the slot pool this task should run in,
|
978
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
979
|
+
soft_fail : bool
|
980
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
981
|
+
name : str
|
982
|
+
Name of the sensor on Airflow
|
983
|
+
description : str
|
984
|
+
Description of sensor in the Airflow UI
|
985
|
+
external_dag_id : str
|
986
|
+
The dag_id that contains the task you want to wait for.
|
987
|
+
external_task_ids : List[str]
|
988
|
+
The list of task_ids that you want to wait for.
|
989
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
990
|
+
allowed_states : List[str]
|
991
|
+
Iterable of allowed states, (Default: ['success'])
|
992
|
+
failed_states : List[str]
|
993
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
994
|
+
execution_delta : datetime.timedelta
|
995
|
+
time difference with the previous execution to look at,
|
996
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
997
|
+
check_existence: bool
|
998
|
+
Set to True to check if the external task exists or check if
|
999
|
+
the DAG to wait for exists. (Default: True)
|
561
1000
|
"""
|
562
1001
|
...
|
563
1002
|
|
564
1003
|
@typing.overload
|
565
|
-
def
|
1004
|
+
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
566
1005
|
"""
|
567
|
-
Specifies the
|
568
|
-
|
569
|
-
```
|
570
|
-
@trigger_on_finish(flow='FooFlow')
|
571
|
-
```
|
572
|
-
or
|
573
|
-
```
|
574
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
575
|
-
```
|
576
|
-
This decorator respects the @project decorator and triggers the flow
|
577
|
-
when upstream runs within the same namespace complete successfully
|
1006
|
+
Specifies the Conda environment for all steps of the flow.
|
578
1007
|
|
579
|
-
|
580
|
-
|
581
|
-
```
|
582
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
583
|
-
```
|
584
|
-
or
|
585
|
-
```
|
586
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
587
|
-
```
|
1008
|
+
Use `@conda_base` to set common libraries required by all
|
1009
|
+
steps and use `@conda` to specify step-specific additions.
|
588
1010
|
|
589
|
-
You can also specify just the project or project branch (other values will be
|
590
|
-
inferred from the current project or project branch):
|
591
|
-
```
|
592
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
593
|
-
```
|
594
1011
|
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
1012
|
+
Parameters
|
1013
|
+
----------
|
1014
|
+
packages : Dict[str, str], default {}
|
1015
|
+
Packages to use for this flow. The key is the name of the package
|
1016
|
+
and the value is the version to use.
|
1017
|
+
libraries : Dict[str, str], default {}
|
1018
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1019
|
+
python : str, optional, default None
|
1020
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1021
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1022
|
+
disabled : bool, default False
|
1023
|
+
If set to True, disables Conda.
|
600
1024
|
"""
|
601
1025
|
...
|
602
1026
|
|
603
1027
|
@typing.overload
|
604
|
-
def
|
1028
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
605
1029
|
...
|
606
1030
|
|
607
|
-
def
|
1031
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
608
1032
|
"""
|
609
|
-
Specifies the
|
1033
|
+
Specifies the Conda environment for all steps of the flow.
|
610
1034
|
|
611
|
-
|
612
|
-
|
613
|
-
```
|
614
|
-
or
|
615
|
-
```
|
616
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
617
|
-
```
|
618
|
-
This decorator respects the @project decorator and triggers the flow
|
619
|
-
when upstream runs within the same namespace complete successfully
|
1035
|
+
Use `@conda_base` to set common libraries required by all
|
1036
|
+
steps and use `@conda` to specify step-specific additions.
|
620
1037
|
|
621
|
-
Additionally, you can specify project aware upstream flow dependencies
|
622
|
-
by specifying the fully qualified project_flow_name.
|
623
|
-
```
|
624
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
625
|
-
```
|
626
|
-
or
|
627
|
-
```
|
628
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
629
|
-
```
|
630
1038
|
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
1039
|
+
Parameters
|
1040
|
+
----------
|
1041
|
+
packages : Dict[str, str], default {}
|
1042
|
+
Packages to use for this flow. The key is the name of the package
|
1043
|
+
and the value is the version to use.
|
1044
|
+
libraries : Dict[str, str], default {}
|
1045
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1046
|
+
python : str, optional, default None
|
1047
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1048
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1049
|
+
disabled : bool, default False
|
1050
|
+
If set to True, disables Conda.
|
1051
|
+
"""
|
1052
|
+
...
|
1053
|
+
|
1054
|
+
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1055
|
+
"""
|
1056
|
+
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1057
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1058
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1059
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1060
|
+
starts only after all sensors finish.
|
636
1061
|
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
1062
|
+
|
1063
|
+
Parameters
|
1064
|
+
----------
|
1065
|
+
timeout : int
|
1066
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1067
|
+
poke_interval : int
|
1068
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1069
|
+
mode : str
|
1070
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1071
|
+
exponential_backoff : bool
|
1072
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1073
|
+
pool : str
|
1074
|
+
the slot pool this task should run in,
|
1075
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1076
|
+
soft_fail : bool
|
1077
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1078
|
+
name : str
|
1079
|
+
Name of the sensor on Airflow
|
1080
|
+
description : str
|
1081
|
+
Description of sensor in the Airflow UI
|
1082
|
+
bucket_key : Union[str, List[str]]
|
1083
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1084
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1085
|
+
bucket_name : str
|
1086
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1087
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1088
|
+
wildcard_match : bool
|
1089
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1090
|
+
aws_conn_id : str
|
1091
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1092
|
+
verify : bool
|
1093
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
642
1094
|
"""
|
643
1095
|
...
|
644
1096
|
|
@@ -647,6 +1099,22 @@ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False,
|
|
647
1099
|
"""
|
648
1100
|
Specifies the times when the flow should be run when running on a
|
649
1101
|
production scheduler.
|
1102
|
+
|
1103
|
+
|
1104
|
+
Parameters
|
1105
|
+
----------
|
1106
|
+
hourly : bool, default False
|
1107
|
+
Run the workflow hourly.
|
1108
|
+
daily : bool, default True
|
1109
|
+
Run the workflow daily.
|
1110
|
+
weekly : bool, default False
|
1111
|
+
Run the workflow weekly.
|
1112
|
+
cron : str, optional, default None
|
1113
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1114
|
+
specified by this expression.
|
1115
|
+
timezone : str, optional, default None
|
1116
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1117
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
650
1118
|
"""
|
651
1119
|
...
|
652
1120
|
|
@@ -658,39 +1126,63 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
658
1126
|
"""
|
659
1127
|
Specifies the times when the flow should be run when running on a
|
660
1128
|
production scheduler.
|
1129
|
+
|
1130
|
+
|
1131
|
+
Parameters
|
1132
|
+
----------
|
1133
|
+
hourly : bool, default False
|
1134
|
+
Run the workflow hourly.
|
1135
|
+
daily : bool, default True
|
1136
|
+
Run the workflow daily.
|
1137
|
+
weekly : bool, default False
|
1138
|
+
Run the workflow weekly.
|
1139
|
+
cron : str, optional, default None
|
1140
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1141
|
+
specified by this expression.
|
1142
|
+
timezone : str, optional, default None
|
1143
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1144
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
661
1145
|
"""
|
662
1146
|
...
|
663
1147
|
|
664
|
-
|
1148
|
+
@typing.overload
|
1149
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
665
1150
|
"""
|
666
|
-
Specifies
|
1151
|
+
Specifies the PyPI packages for all steps of the flow.
|
667
1152
|
|
668
|
-
|
669
|
-
use
|
1153
|
+
Use `@pypi_base` to set common packages required by all
|
1154
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1155
|
+
|
1156
|
+
Parameters
|
1157
|
+
----------
|
1158
|
+
packages : Dict[str, str], default: {}
|
1159
|
+
Packages to use for this flow. The key is the name of the package
|
1160
|
+
and the value is the version to use.
|
1161
|
+
python : str, optional, default: None
|
1162
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1163
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
670
1164
|
"""
|
671
1165
|
...
|
672
1166
|
|
673
|
-
|
1167
|
+
@typing.overload
|
1168
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1169
|
+
...
|
1170
|
+
|
1171
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
674
1172
|
"""
|
675
|
-
|
676
|
-
|
677
|
-
User code call
|
678
|
-
-----------
|
679
|
-
@nim(
|
680
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
681
|
-
backend='managed'
|
682
|
-
)
|
1173
|
+
Specifies the PyPI packages for all steps of the flow.
|
683
1174
|
|
684
|
-
|
685
|
-
|
686
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
687
|
-
- 🚧 'dataplane': Run in your account.
|
1175
|
+
Use `@pypi_base` to set common packages required by all
|
1176
|
+
steps and use `@pypi` to specify step-specific overrides.
|
688
1177
|
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
1178
|
+
Parameters
|
1179
|
+
----------
|
1180
|
+
packages : Dict[str, str], default: {}
|
1181
|
+
Packages to use for this flow. The key is the name of the package
|
1182
|
+
and the value is the version to use.
|
1183
|
+
python : str, optional, default: None
|
1184
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1185
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
694
1186
|
"""
|
695
1187
|
...
|
696
1188
|
|
@@ -726,6 +1218,16 @@ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = No
|
|
726
1218
|
```
|
727
1219
|
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
728
1220
|
```
|
1221
|
+
|
1222
|
+
|
1223
|
+
Parameters
|
1224
|
+
----------
|
1225
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1226
|
+
Event dependency for this flow.
|
1227
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1228
|
+
Events dependency for this flow.
|
1229
|
+
options : Dict[str, Any], default {}
|
1230
|
+
Backend-specific configuration for tuning eventing behavior.
|
729
1231
|
"""
|
730
1232
|
...
|
731
1233
|
|
@@ -764,39 +1266,117 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
764
1266
|
```
|
765
1267
|
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
766
1268
|
```
|
1269
|
+
|
1270
|
+
|
1271
|
+
Parameters
|
1272
|
+
----------
|
1273
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1274
|
+
Event dependency for this flow.
|
1275
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1276
|
+
Events dependency for this flow.
|
1277
|
+
options : Dict[str, Any], default {}
|
1278
|
+
Backend-specific configuration for tuning eventing behavior.
|
767
1279
|
"""
|
768
1280
|
...
|
769
1281
|
|
770
1282
|
@typing.overload
|
771
|
-
def
|
1283
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
772
1284
|
"""
|
773
|
-
Specifies the
|
1285
|
+
Specifies the flow(s) that this flow depends on.
|
774
1286
|
|
775
|
-
|
776
|
-
|
1287
|
+
```
|
1288
|
+
@trigger_on_finish(flow='FooFlow')
|
1289
|
+
```
|
1290
|
+
or
|
1291
|
+
```
|
1292
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1293
|
+
```
|
1294
|
+
This decorator respects the @project decorator and triggers the flow
|
1295
|
+
when upstream runs within the same namespace complete successfully
|
1296
|
+
|
1297
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1298
|
+
by specifying the fully qualified project_flow_name.
|
1299
|
+
```
|
1300
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1301
|
+
```
|
1302
|
+
or
|
1303
|
+
```
|
1304
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1305
|
+
```
|
1306
|
+
|
1307
|
+
You can also specify just the project or project branch (other values will be
|
1308
|
+
inferred from the current project or project branch):
|
1309
|
+
```
|
1310
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1311
|
+
```
|
1312
|
+
|
1313
|
+
Note that `branch` is typically one of:
|
1314
|
+
- `prod`
|
1315
|
+
- `user.bob`
|
1316
|
+
- `test.my_experiment`
|
1317
|
+
- `prod.staging`
|
1318
|
+
|
1319
|
+
|
1320
|
+
Parameters
|
1321
|
+
----------
|
1322
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1323
|
+
Upstream flow dependency for this flow.
|
1324
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1325
|
+
Upstream flow dependencies for this flow.
|
1326
|
+
options : Dict[str, Any], default {}
|
1327
|
+
Backend-specific configuration for tuning eventing behavior.
|
777
1328
|
"""
|
778
1329
|
...
|
779
1330
|
|
780
1331
|
@typing.overload
|
781
|
-
def
|
1332
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
782
1333
|
...
|
783
1334
|
|
784
|
-
def
|
1335
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
785
1336
|
"""
|
786
|
-
Specifies the
|
1337
|
+
Specifies the flow(s) that this flow depends on.
|
787
1338
|
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
1339
|
+
```
|
1340
|
+
@trigger_on_finish(flow='FooFlow')
|
1341
|
+
```
|
1342
|
+
or
|
1343
|
+
```
|
1344
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1345
|
+
```
|
1346
|
+
This decorator respects the @project decorator and triggers the flow
|
1347
|
+
when upstream runs within the same namespace complete successfully
|
1348
|
+
|
1349
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1350
|
+
by specifying the fully qualified project_flow_name.
|
1351
|
+
```
|
1352
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1353
|
+
```
|
1354
|
+
or
|
1355
|
+
```
|
1356
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1357
|
+
```
|
1358
|
+
|
1359
|
+
You can also specify just the project or project branch (other values will be
|
1360
|
+
inferred from the current project or project branch):
|
1361
|
+
```
|
1362
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1363
|
+
```
|
1364
|
+
|
1365
|
+
Note that `branch` is typically one of:
|
1366
|
+
- `prod`
|
1367
|
+
- `user.bob`
|
1368
|
+
- `test.my_experiment`
|
1369
|
+
- `prod.staging`
|
1370
|
+
|
1371
|
+
|
1372
|
+
Parameters
|
1373
|
+
----------
|
1374
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1375
|
+
Upstream flow dependency for this flow.
|
1376
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1377
|
+
Upstream flow dependencies for this flow.
|
1378
|
+
options : Dict[str, Any], default {}
|
1379
|
+
Backend-specific configuration for tuning eventing behavior.
|
800
1380
|
"""
|
801
1381
|
...
|
802
1382
|
|