ob-metaflow-stubs 6.0.3.144__py2.py3-none-any.whl → 6.0.3.146__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 +635 -635
- 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 +3 -3
- 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 +2 -2
- 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 +4 -2
- metaflow-stubs/metaflow_current.pyi +106 -106
- 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 +3 -3
- 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 +3 -3
- 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 +5 -5
- 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 +4 -4
- 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 +3 -3
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.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 +2 -2
- metaflow-stubs/plugins/__init__.pyi +13 -13
- 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 +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +6 -6
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- 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/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +29 -29
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- 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 +6 -6
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.144.dist-info → ob_metaflow_stubs-6.0.3.146.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.146.dist-info/RECORD +197 -0
- ob_metaflow_stubs-6.0.3.144.dist-info/RECORD +0 -197
- {ob_metaflow_stubs-6.0.3.144.dist-info → ob_metaflow_stubs-6.0.3.146.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.144.dist-info → ob_metaflow_stubs-6.0.3.146.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.15.0.1+obcheckpoint(0.1.8);ob(v1) #
|
4
|
+
# Generated on 2025-02-25T21:49:22.675350 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -147,94 +147,200 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
147
147
|
...
|
148
148
|
|
149
149
|
@typing.overload
|
150
|
-
def
|
150
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
151
151
|
"""
|
152
|
-
|
152
|
+
Parameters
|
153
|
+
----------
|
154
|
+
"""
|
155
|
+
...
|
156
|
+
|
157
|
+
@typing.overload
|
158
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
159
|
+
...
|
160
|
+
|
161
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
162
|
+
"""
|
163
|
+
Parameters
|
164
|
+
----------
|
165
|
+
"""
|
166
|
+
...
|
167
|
+
|
168
|
+
@typing.overload
|
169
|
+
def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> 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]]]:
|
170
|
+
"""
|
171
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
153
172
|
|
173
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
154
174
|
|
155
175
|
|
156
176
|
Parameters
|
157
177
|
----------
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
167
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
168
|
-
|
169
|
-
temp_dir_root : str, default: None
|
170
|
-
The root directory under which `current.model.loaded` will store loaded models
|
178
|
+
type : str, default 'default'
|
179
|
+
Card type.
|
180
|
+
id : str, optional, default None
|
181
|
+
If multiple cards are present, use this id to identify this card.
|
182
|
+
options : Dict[str, Any], default {}
|
183
|
+
Options passed to the card. The contents depend on the card type.
|
184
|
+
timeout : int, default 45
|
185
|
+
Interrupt reporting if it takes more than this many seconds.
|
171
186
|
"""
|
172
187
|
...
|
173
188
|
|
174
189
|
@typing.overload
|
175
|
-
def
|
190
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
176
191
|
...
|
177
192
|
|
178
193
|
@typing.overload
|
179
|
-
def
|
194
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
180
195
|
...
|
181
196
|
|
182
|
-
def
|
197
|
+
def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
|
183
198
|
"""
|
184
|
-
|
199
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
185
200
|
|
201
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
186
202
|
|
187
203
|
|
188
204
|
Parameters
|
189
205
|
----------
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
206
|
+
type : str, default 'default'
|
207
|
+
Card type.
|
208
|
+
id : str, optional, default None
|
209
|
+
If multiple cards are present, use this id to identify this card.
|
210
|
+
options : Dict[str, Any], default {}
|
211
|
+
Options passed to the card. The contents depend on the card type.
|
212
|
+
timeout : int, default 45
|
213
|
+
Interrupt reporting if it takes more than this many seconds.
|
214
|
+
"""
|
215
|
+
...
|
216
|
+
|
217
|
+
@typing.overload
|
218
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = 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]]]:
|
219
|
+
"""
|
220
|
+
Specifies the resources needed when executing this step.
|
196
221
|
|
197
|
-
|
198
|
-
|
199
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
222
|
+
Use `@resources` to specify the resource requirements
|
223
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
200
224
|
|
201
|
-
|
202
|
-
|
225
|
+
You can choose the compute layer on the command line by executing e.g.
|
226
|
+
```
|
227
|
+
python myflow.py run --with batch
|
228
|
+
```
|
229
|
+
or
|
230
|
+
```
|
231
|
+
python myflow.py run --with kubernetes
|
232
|
+
```
|
233
|
+
which executes the flow on the desired system using the
|
234
|
+
requirements specified in `@resources`.
|
235
|
+
|
236
|
+
|
237
|
+
Parameters
|
238
|
+
----------
|
239
|
+
cpu : int, default 1
|
240
|
+
Number of CPUs required for this step.
|
241
|
+
gpu : int, optional, default None
|
242
|
+
Number of GPUs required for this step.
|
243
|
+
disk : int, optional, default None
|
244
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
245
|
+
memory : int, default 4096
|
246
|
+
Memory size (in MB) required for this step.
|
247
|
+
shared_memory : int, optional, default None
|
248
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
249
|
+
This parameter maps to the `--shm-size` option in Docker.
|
203
250
|
"""
|
204
251
|
...
|
205
252
|
|
206
253
|
@typing.overload
|
207
|
-
def
|
254
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
255
|
+
...
|
256
|
+
|
257
|
+
@typing.overload
|
258
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
259
|
+
...
|
260
|
+
|
261
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
208
262
|
"""
|
209
|
-
Specifies
|
210
|
-
|
263
|
+
Specifies the resources needed when executing this step.
|
264
|
+
|
265
|
+
Use `@resources` to specify the resource requirements
|
266
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
267
|
+
|
268
|
+
You can choose the compute layer on the command line by executing e.g.
|
269
|
+
```
|
270
|
+
python myflow.py run --with batch
|
271
|
+
```
|
272
|
+
or
|
273
|
+
```
|
274
|
+
python myflow.py run --with kubernetes
|
275
|
+
```
|
276
|
+
which executes the flow on the desired system using the
|
277
|
+
requirements specified in `@resources`.
|
211
278
|
|
212
279
|
|
213
280
|
Parameters
|
214
281
|
----------
|
215
|
-
|
216
|
-
|
282
|
+
cpu : int, default 1
|
283
|
+
Number of CPUs required for this step.
|
284
|
+
gpu : int, optional, default None
|
285
|
+
Number of GPUs required for this step.
|
286
|
+
disk : int, optional, default None
|
287
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
288
|
+
memory : int, default 4096
|
289
|
+
Memory size (in MB) required for this step.
|
290
|
+
shared_memory : int, optional, default None
|
291
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
292
|
+
This parameter maps to the `--shm-size` option in Docker.
|
217
293
|
"""
|
218
294
|
...
|
219
295
|
|
220
296
|
@typing.overload
|
221
|
-
def
|
297
|
+
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]]]:
|
298
|
+
"""
|
299
|
+
Specifies the PyPI packages for the step.
|
300
|
+
|
301
|
+
Information in this decorator will augment any
|
302
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
303
|
+
you can use `@pypi_base` to set packages required by all
|
304
|
+
steps and use `@pypi` to specify step-specific overrides.
|
305
|
+
|
306
|
+
|
307
|
+
Parameters
|
308
|
+
----------
|
309
|
+
packages : Dict[str, str], default: {}
|
310
|
+
Packages to use for this step. The key is the name of the package
|
311
|
+
and the value is the version to use.
|
312
|
+
python : str, optional, default: None
|
313
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
314
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
315
|
+
"""
|
222
316
|
...
|
223
317
|
|
224
318
|
@typing.overload
|
225
|
-
def
|
319
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
226
320
|
...
|
227
321
|
|
228
|
-
|
322
|
+
@typing.overload
|
323
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
324
|
+
...
|
325
|
+
|
326
|
+
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):
|
229
327
|
"""
|
230
|
-
Specifies
|
231
|
-
|
328
|
+
Specifies the PyPI packages for the step.
|
329
|
+
|
330
|
+
Information in this decorator will augment any
|
331
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
332
|
+
you can use `@pypi_base` to set packages required by all
|
333
|
+
steps and use `@pypi` to specify step-specific overrides.
|
232
334
|
|
233
335
|
|
234
336
|
Parameters
|
235
337
|
----------
|
236
|
-
|
237
|
-
|
338
|
+
packages : Dict[str, str], default: {}
|
339
|
+
Packages to use for this step. The key is the name of the package
|
340
|
+
and the value is the version to use.
|
341
|
+
python : str, optional, default: None
|
342
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
343
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
238
344
|
"""
|
239
345
|
...
|
240
346
|
|
@@ -315,643 +421,572 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
315
421
|
"""
|
316
422
|
...
|
317
423
|
|
318
|
-
|
319
|
-
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]]]:
|
424
|
+
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]]]:
|
320
425
|
"""
|
321
|
-
|
426
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
322
427
|
|
323
428
|
|
324
429
|
Parameters
|
325
430
|
----------
|
326
|
-
|
327
|
-
|
431
|
+
temp_dir_root : str, optional
|
432
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
433
|
+
|
434
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
435
|
+
The list of repos (models/datasets) to load.
|
436
|
+
|
437
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
438
|
+
|
439
|
+
- If repo (model/dataset) is not found in the datastore:
|
440
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
441
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
442
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
443
|
+
|
444
|
+
- If repo is found in the datastore:
|
445
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
328
446
|
"""
|
329
447
|
...
|
330
448
|
|
331
449
|
@typing.overload
|
332
|
-
def
|
333
|
-
...
|
334
|
-
|
335
|
-
@typing.overload
|
336
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
337
|
-
...
|
338
|
-
|
339
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
450
|
+
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]]]:
|
340
451
|
"""
|
341
|
-
Specifies
|
452
|
+
Specifies the number of times the task corresponding
|
453
|
+
to a step needs to be retried.
|
454
|
+
|
455
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
456
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
457
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
458
|
+
|
459
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
460
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
461
|
+
ensuring that the flow execution can continue.
|
342
462
|
|
343
463
|
|
344
464
|
Parameters
|
345
465
|
----------
|
346
|
-
|
347
|
-
|
466
|
+
times : int, default 3
|
467
|
+
Number of times to retry this task.
|
468
|
+
minutes_between_retries : int, default 2
|
469
|
+
Number of minutes between retries.
|
348
470
|
"""
|
349
471
|
...
|
350
472
|
|
351
473
|
@typing.overload
|
352
|
-
def
|
474
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
475
|
+
...
|
476
|
+
|
477
|
+
@typing.overload
|
478
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
479
|
+
...
|
480
|
+
|
481
|
+
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):
|
353
482
|
"""
|
354
|
-
Specifies the
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
483
|
+
Specifies the number of times the task corresponding
|
484
|
+
to a step needs to be retried.
|
485
|
+
|
486
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
487
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
488
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
489
|
+
|
490
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
491
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
492
|
+
ensuring that the flow execution can continue.
|
493
|
+
|
361
494
|
|
362
495
|
Parameters
|
363
496
|
----------
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
369
|
-
python : str, optional, default None
|
370
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
371
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
372
|
-
disabled : bool, default False
|
373
|
-
If set to True, disables @conda.
|
497
|
+
times : int, default 3
|
498
|
+
Number of times to retry this task.
|
499
|
+
minutes_between_retries : int, default 2
|
500
|
+
Number of minutes between retries.
|
374
501
|
"""
|
375
502
|
...
|
376
503
|
|
377
504
|
@typing.overload
|
378
|
-
def
|
505
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
506
|
+
"""
|
507
|
+
Internal decorator to support Fast bakery
|
508
|
+
Parameters
|
509
|
+
----------
|
510
|
+
"""
|
379
511
|
...
|
380
512
|
|
381
513
|
@typing.overload
|
382
|
-
def
|
514
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
383
515
|
...
|
384
516
|
|
385
|
-
def
|
517
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
386
518
|
"""
|
387
|
-
|
388
|
-
|
389
|
-
Information in this decorator will augment any
|
390
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
391
|
-
you can use `@conda_base` to set packages required by all
|
392
|
-
steps and use `@conda` to specify step-specific overrides.
|
393
|
-
|
394
|
-
|
519
|
+
Internal decorator to support Fast bakery
|
395
520
|
Parameters
|
396
521
|
----------
|
397
|
-
packages : Dict[str, str], default {}
|
398
|
-
Packages to use for this step. The key is the name of the package
|
399
|
-
and the value is the version to use.
|
400
|
-
libraries : Dict[str, str], default {}
|
401
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
402
|
-
python : str, optional, default None
|
403
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
404
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
405
|
-
disabled : bool, default False
|
406
|
-
If set to True, disables @conda.
|
407
522
|
"""
|
408
523
|
...
|
409
524
|
|
410
525
|
@typing.overload
|
411
|
-
def
|
526
|
+
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> 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]]]:
|
412
527
|
"""
|
413
|
-
Specifies
|
414
|
-
to a step needs to be retried.
|
528
|
+
Specifies a timeout for your step.
|
415
529
|
|
416
|
-
This decorator is useful
|
417
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
418
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
530
|
+
This decorator is useful if this step may hang indefinitely.
|
419
531
|
|
420
|
-
This can be used in conjunction with the `@
|
421
|
-
|
422
|
-
|
532
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
533
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
534
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
535
|
+
|
536
|
+
Note that all the values specified in parameters are added together so if you specify
|
537
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
423
538
|
|
424
539
|
|
425
540
|
Parameters
|
426
541
|
----------
|
427
|
-
|
428
|
-
Number of
|
429
|
-
|
430
|
-
Number of minutes
|
542
|
+
seconds : int, default 0
|
543
|
+
Number of seconds to wait prior to timing out.
|
544
|
+
minutes : int, default 0
|
545
|
+
Number of minutes to wait prior to timing out.
|
546
|
+
hours : int, default 0
|
547
|
+
Number of hours to wait prior to timing out.
|
431
548
|
"""
|
432
549
|
...
|
433
550
|
|
434
551
|
@typing.overload
|
435
|
-
def
|
552
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
436
553
|
...
|
437
554
|
|
438
555
|
@typing.overload
|
439
|
-
def
|
556
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
440
557
|
...
|
441
558
|
|
442
|
-
def
|
559
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
443
560
|
"""
|
444
|
-
Specifies
|
445
|
-
to a step needs to be retried.
|
446
|
-
|
447
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
448
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
449
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
561
|
+
Specifies a timeout for your step.
|
450
562
|
|
451
|
-
This
|
452
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
453
|
-
ensuring that the flow execution can continue.
|
563
|
+
This decorator is useful if this step may hang indefinitely.
|
454
564
|
|
565
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
566
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
567
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
455
568
|
|
456
|
-
|
457
|
-
|
458
|
-
times : int, default 3
|
459
|
-
Number of times to retry this task.
|
460
|
-
minutes_between_retries : int, default 2
|
461
|
-
Number of minutes between retries.
|
462
|
-
"""
|
463
|
-
...
|
464
|
-
|
465
|
-
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]]]:
|
466
|
-
"""
|
467
|
-
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
569
|
+
Note that all the values specified in parameters are added together so if you specify
|
570
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
468
571
|
|
469
572
|
|
470
573
|
Parameters
|
471
574
|
----------
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
479
|
-
|
480
|
-
- If repo (model/dataset) is not found in the datastore:
|
481
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
482
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
483
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
484
|
-
|
485
|
-
- If repo is found in the datastore:
|
486
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
575
|
+
seconds : int, default 0
|
576
|
+
Number of seconds to wait prior to timing out.
|
577
|
+
minutes : int, default 0
|
578
|
+
Number of minutes to wait prior to timing out.
|
579
|
+
hours : int, default 0
|
580
|
+
Number of hours to wait prior to timing out.
|
487
581
|
"""
|
488
582
|
...
|
489
583
|
|
490
584
|
@typing.overload
|
491
|
-
def
|
585
|
+
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]]]:
|
492
586
|
"""
|
493
|
-
|
587
|
+
Specifies the Conda environment for the step.
|
494
588
|
|
495
|
-
|
589
|
+
Information in this decorator will augment any
|
590
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
591
|
+
you can use `@conda_base` to set packages required by all
|
592
|
+
steps and use `@conda` to specify step-specific overrides.
|
496
593
|
|
497
594
|
|
498
595
|
Parameters
|
499
596
|
----------
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
597
|
+
packages : Dict[str, str], default {}
|
598
|
+
Packages to use for this step. The key is the name of the package
|
599
|
+
and the value is the version to use.
|
600
|
+
libraries : Dict[str, str], default {}
|
601
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
602
|
+
python : str, optional, default None
|
603
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
604
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
605
|
+
disabled : bool, default False
|
606
|
+
If set to True, disables @conda.
|
508
607
|
"""
|
509
608
|
...
|
510
609
|
|
511
610
|
@typing.overload
|
512
|
-
def
|
611
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
513
612
|
...
|
514
613
|
|
515
614
|
@typing.overload
|
516
|
-
def
|
615
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
517
616
|
...
|
518
617
|
|
519
|
-
def
|
618
|
+
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):
|
520
619
|
"""
|
521
|
-
|
620
|
+
Specifies the Conda environment for the step.
|
522
621
|
|
523
|
-
|
622
|
+
Information in this decorator will augment any
|
623
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
624
|
+
you can use `@conda_base` to set packages required by all
|
625
|
+
steps and use `@conda` to specify step-specific overrides.
|
524
626
|
|
525
627
|
|
526
628
|
Parameters
|
527
629
|
----------
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
630
|
+
packages : Dict[str, str], default {}
|
631
|
+
Packages to use for this step. The key is the name of the package
|
632
|
+
and the value is the version to use.
|
633
|
+
libraries : Dict[str, str], default {}
|
634
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
635
|
+
python : str, optional, default None
|
636
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
637
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
638
|
+
disabled : bool, default False
|
639
|
+
If set to True, disables @conda.
|
536
640
|
"""
|
537
641
|
...
|
538
642
|
|
539
|
-
def
|
643
|
+
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]]]:
|
540
644
|
"""
|
541
|
-
|
645
|
+
Specifies that this step should execute on DGX cloud.
|
646
|
+
|
647
|
+
|
648
|
+
Parameters
|
649
|
+
----------
|
650
|
+
gpu : int
|
651
|
+
Number of GPUs to use.
|
652
|
+
gpu_type : str
|
653
|
+
Type of Nvidia GPU to use.
|
654
|
+
queue_timeout : int
|
655
|
+
Time to keep the job in NVCF's queue.
|
656
|
+
"""
|
657
|
+
...
|
658
|
+
|
659
|
+
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]]]:
|
660
|
+
"""
|
661
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
542
662
|
|
543
663
|
User code call
|
544
664
|
-----------
|
545
|
-
@
|
665
|
+
@nim(
|
546
666
|
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
547
|
-
backend='
|
667
|
+
backend='managed'
|
548
668
|
)
|
549
669
|
|
550
670
|
Valid backend options
|
551
671
|
---------------------
|
552
|
-
- '
|
553
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
554
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
672
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
555
673
|
|
556
674
|
Valid model options
|
557
675
|
----------------
|
558
|
-
- 'llama3
|
559
|
-
- 'llama3
|
560
|
-
- any model here https://
|
676
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
677
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
678
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
561
679
|
|
562
680
|
|
563
681
|
Parameters
|
564
682
|
----------
|
565
|
-
models: list[
|
566
|
-
List of
|
683
|
+
models: list[NIM]
|
684
|
+
List of NIM containers running models in sidecars.
|
567
685
|
backend: str
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
@typing.overload
|
573
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
574
|
-
"""
|
575
|
-
Parameters
|
576
|
-
----------
|
577
|
-
"""
|
578
|
-
...
|
579
|
-
|
580
|
-
@typing.overload
|
581
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
582
|
-
...
|
583
|
-
|
584
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
585
|
-
"""
|
586
|
-
Parameters
|
587
|
-
----------
|
686
|
+
Compute provider to run the NIM container.
|
687
|
+
queue_timeout : int
|
688
|
+
Time to keep the job in NVCF's queue.
|
588
689
|
"""
|
589
690
|
...
|
590
691
|
|
591
692
|
@typing.overload
|
592
|
-
def
|
693
|
+
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]]]:
|
593
694
|
"""
|
594
|
-
Specifies
|
595
|
-
|
596
|
-
Use `@resources` to specify the resource requirements
|
597
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
598
|
-
|
599
|
-
You can choose the compute layer on the command line by executing e.g.
|
600
|
-
```
|
601
|
-
python myflow.py run --with batch
|
602
|
-
```
|
603
|
-
or
|
604
|
-
```
|
605
|
-
python myflow.py run --with kubernetes
|
606
|
-
```
|
607
|
-
which executes the flow on the desired system using the
|
608
|
-
requirements specified in `@resources`.
|
695
|
+
Specifies environment variables to be set prior to the execution of a step.
|
609
696
|
|
610
697
|
|
611
698
|
Parameters
|
612
699
|
----------
|
613
|
-
|
614
|
-
|
615
|
-
gpu : int, optional, default None
|
616
|
-
Number of GPUs required for this step.
|
617
|
-
disk : int, optional, default None
|
618
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
619
|
-
memory : int, default 4096
|
620
|
-
Memory size (in MB) required for this step.
|
621
|
-
shared_memory : int, optional, default None
|
622
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
623
|
-
This parameter maps to the `--shm-size` option in Docker.
|
700
|
+
vars : Dict[str, str], default {}
|
701
|
+
Dictionary of environment variables to set.
|
624
702
|
"""
|
625
703
|
...
|
626
704
|
|
627
705
|
@typing.overload
|
628
|
-
def
|
706
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
629
707
|
...
|
630
708
|
|
631
709
|
@typing.overload
|
632
|
-
def
|
710
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
633
711
|
...
|
634
712
|
|
635
|
-
def
|
713
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
636
714
|
"""
|
637
|
-
Specifies
|
638
|
-
|
639
|
-
Use `@resources` to specify the resource requirements
|
640
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
641
|
-
|
642
|
-
You can choose the compute layer on the command line by executing e.g.
|
643
|
-
```
|
644
|
-
python myflow.py run --with batch
|
645
|
-
```
|
646
|
-
or
|
647
|
-
```
|
648
|
-
python myflow.py run --with kubernetes
|
649
|
-
```
|
650
|
-
which executes the flow on the desired system using the
|
651
|
-
requirements specified in `@resources`.
|
715
|
+
Specifies environment variables to be set prior to the execution of a step.
|
652
716
|
|
653
717
|
|
654
718
|
Parameters
|
655
719
|
----------
|
656
|
-
|
657
|
-
|
658
|
-
gpu : int, optional, default None
|
659
|
-
Number of GPUs required for this step.
|
660
|
-
disk : int, optional, default None
|
661
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
662
|
-
memory : int, default 4096
|
663
|
-
Memory size (in MB) required for this step.
|
664
|
-
shared_memory : int, optional, default None
|
665
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
666
|
-
This parameter maps to the `--shm-size` option in Docker.
|
720
|
+
vars : Dict[str, str], default {}
|
721
|
+
Dictionary of environment variables to set.
|
667
722
|
"""
|
668
723
|
...
|
669
724
|
|
670
725
|
@typing.overload
|
671
|
-
def
|
726
|
+
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]]]:
|
672
727
|
"""
|
673
|
-
|
728
|
+
Enables checkpointing for a step.
|
674
729
|
|
675
|
-
The decorator will create an optional artifact, specified by `var`, which
|
676
|
-
contains the exception raised. You can use it to detect the presence
|
677
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
678
|
-
are missing.
|
679
730
|
|
680
731
|
|
681
732
|
Parameters
|
682
733
|
----------
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
734
|
+
load_policy : str, default: "fresh"
|
735
|
+
The policy for loading the checkpoint. The following policies are supported:
|
736
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
737
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
738
|
+
will be loaded at the start of the task.
|
739
|
+
- "none": Do not load any checkpoint
|
740
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
741
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
742
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
743
|
+
created within the task will be loaded when the task is retries execution on failure.
|
744
|
+
|
745
|
+
temp_dir_root : str, default: None
|
746
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
689
747
|
"""
|
690
748
|
...
|
691
749
|
|
692
750
|
@typing.overload
|
693
|
-
def
|
751
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
694
752
|
...
|
695
753
|
|
696
754
|
@typing.overload
|
697
|
-
def
|
755
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
698
756
|
...
|
699
757
|
|
700
|
-
def
|
758
|
+
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):
|
701
759
|
"""
|
702
|
-
|
760
|
+
Enables checkpointing for a step.
|
703
761
|
|
704
|
-
The decorator will create an optional artifact, specified by `var`, which
|
705
|
-
contains the exception raised. You can use it to detect the presence
|
706
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
707
|
-
are missing.
|
708
762
|
|
709
763
|
|
710
764
|
Parameters
|
711
765
|
----------
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
766
|
+
load_policy : str, default: "fresh"
|
767
|
+
The policy for loading the checkpoint. The following policies are supported:
|
768
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
769
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
770
|
+
will be loaded at the start of the task.
|
771
|
+
- "none": Do not load any checkpoint
|
772
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
773
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
774
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
775
|
+
created within the task will be loaded when the task is retries execution on failure.
|
776
|
+
|
777
|
+
temp_dir_root : str, default: None
|
778
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
718
779
|
"""
|
719
780
|
...
|
720
781
|
|
721
|
-
def
|
782
|
+
def ollama(*, models: "list[Ollama]", backend: 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]]]:
|
722
783
|
"""
|
723
|
-
This decorator is used to run
|
784
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
724
785
|
|
725
786
|
User code call
|
726
787
|
-----------
|
727
|
-
@
|
788
|
+
@ollama(
|
728
789
|
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
729
|
-
backend='
|
790
|
+
backend='local'
|
730
791
|
)
|
731
792
|
|
732
793
|
Valid backend options
|
733
794
|
---------------------
|
734
|
-
- '
|
795
|
+
- 'local': Run as a separate process on the local task machine.
|
796
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
797
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
735
798
|
|
736
799
|
Valid model options
|
737
800
|
----------------
|
738
|
-
- '
|
739
|
-
- '
|
740
|
-
- any model here
|
801
|
+
- 'llama3.2'
|
802
|
+
- 'llama3.3'
|
803
|
+
- any model here https://ollama.com/search
|
741
804
|
|
742
805
|
|
743
806
|
Parameters
|
744
807
|
----------
|
745
|
-
models: list[
|
746
|
-
List of
|
808
|
+
models: list[Ollama]
|
809
|
+
List of Ollama containers running models in sidecars.
|
747
810
|
backend: str
|
748
|
-
|
749
|
-
queue_timeout : int
|
750
|
-
Time to keep the job in NVCF's queue.
|
811
|
+
Determines where and how to run the Ollama process.
|
751
812
|
"""
|
752
813
|
...
|
753
814
|
|
754
815
|
@typing.overload
|
755
|
-
def
|
816
|
+
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]]]:
|
756
817
|
"""
|
757
|
-
Specifies
|
758
|
-
|
759
|
-
Information in this decorator will augment any
|
760
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
761
|
-
you can use `@pypi_base` to set packages required by all
|
762
|
-
steps and use `@pypi` to specify step-specific overrides.
|
818
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
819
|
+
the execution of a step.
|
763
820
|
|
764
821
|
|
765
822
|
Parameters
|
766
823
|
----------
|
767
|
-
|
768
|
-
|
769
|
-
and the value is the version to use.
|
770
|
-
python : str, optional, default: None
|
771
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
772
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
824
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
825
|
+
List of secret specs, defining how the secrets are to be retrieved
|
773
826
|
"""
|
774
827
|
...
|
775
828
|
|
776
829
|
@typing.overload
|
777
|
-
def
|
830
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
778
831
|
...
|
779
832
|
|
780
833
|
@typing.overload
|
781
|
-
def
|
834
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
782
835
|
...
|
783
836
|
|
784
|
-
def
|
837
|
+
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]]] = []):
|
785
838
|
"""
|
786
|
-
Specifies
|
787
|
-
|
788
|
-
Information in this decorator will augment any
|
789
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
790
|
-
you can use `@pypi_base` to set packages required by all
|
791
|
-
steps and use `@pypi` to specify step-specific overrides.
|
839
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
840
|
+
the execution of a step.
|
792
841
|
|
793
842
|
|
794
843
|
Parameters
|
795
844
|
----------
|
796
|
-
|
797
|
-
|
798
|
-
and the value is the version to use.
|
799
|
-
python : str, optional, default: None
|
800
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
801
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
802
|
-
"""
|
803
|
-
...
|
804
|
-
|
805
|
-
@typing.overload
|
806
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
807
|
-
"""
|
808
|
-
Internal decorator to support Fast bakery
|
809
|
-
Parameters
|
810
|
-
----------
|
845
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
846
|
+
List of secret specs, defining how the secrets are to be retrieved
|
811
847
|
"""
|
812
848
|
...
|
813
849
|
|
814
850
|
@typing.overload
|
815
|
-
def
|
816
|
-
...
|
817
|
-
|
818
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
819
|
-
"""
|
820
|
-
Internal decorator to support Fast bakery
|
821
|
-
Parameters
|
822
|
-
----------
|
823
|
-
"""
|
824
|
-
...
|
825
|
-
|
826
|
-
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]]]:
|
851
|
+
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]]]:
|
827
852
|
"""
|
828
|
-
|
853
|
+
Enables loading / saving of models within a step.
|
854
|
+
|
829
855
|
|
830
856
|
|
831
857
|
Parameters
|
832
858
|
----------
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
"""
|
840
|
-
...
|
841
|
-
|
842
|
-
@typing.overload
|
843
|
-
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> 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]]]:
|
844
|
-
"""
|
845
|
-
Specifies a timeout for your step.
|
846
|
-
|
847
|
-
This decorator is useful if this step may hang indefinitely.
|
848
|
-
|
849
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
850
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
851
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
852
|
-
|
853
|
-
Note that all the values specified in parameters are added together so if you specify
|
854
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
859
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
860
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
861
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
862
|
+
- `current.checkpoint`
|
863
|
+
- `current.model`
|
864
|
+
- `current.huggingface_hub`
|
855
865
|
|
866
|
+
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
|
867
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
868
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
856
869
|
|
857
|
-
|
858
|
-
|
859
|
-
seconds : int, default 0
|
860
|
-
Number of seconds to wait prior to timing out.
|
861
|
-
minutes : int, default 0
|
862
|
-
Number of minutes to wait prior to timing out.
|
863
|
-
hours : int, default 0
|
864
|
-
Number of hours to wait prior to timing out.
|
870
|
+
temp_dir_root : str, default: None
|
871
|
+
The root directory under which `current.model.loaded` will store loaded models
|
865
872
|
"""
|
866
873
|
...
|
867
874
|
|
868
875
|
@typing.overload
|
869
|
-
def
|
876
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
870
877
|
...
|
871
878
|
|
872
879
|
@typing.overload
|
873
|
-
def
|
880
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
874
881
|
...
|
875
882
|
|
876
|
-
def
|
883
|
+
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):
|
877
884
|
"""
|
878
|
-
|
879
|
-
|
880
|
-
This decorator is useful if this step may hang indefinitely.
|
881
|
-
|
882
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
883
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
884
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
885
|
+
Enables loading / saving of models within a step.
|
885
886
|
|
886
|
-
Note that all the values specified in parameters are added together so if you specify
|
887
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
888
887
|
|
889
888
|
|
890
889
|
Parameters
|
891
890
|
----------
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
891
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
892
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
893
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
894
|
+
- `current.checkpoint`
|
895
|
+
- `current.model`
|
896
|
+
- `current.huggingface_hub`
|
897
|
+
|
898
|
+
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
|
899
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
900
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
901
|
+
|
902
|
+
temp_dir_root : str, default: None
|
903
|
+
The root directory under which `current.model.loaded` will store loaded models
|
898
904
|
"""
|
899
905
|
...
|
900
906
|
|
901
907
|
@typing.overload
|
902
|
-
def
|
908
|
+
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> 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]]]:
|
903
909
|
"""
|
904
|
-
|
910
|
+
Specifies that the step will success under all circumstances.
|
905
911
|
|
912
|
+
The decorator will create an optional artifact, specified by `var`, which
|
913
|
+
contains the exception raised. You can use it to detect the presence
|
914
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
915
|
+
are missing.
|
906
916
|
|
907
917
|
|
908
918
|
Parameters
|
909
919
|
----------
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
917
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
918
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
919
|
-
created within the task will be loaded when the task is retries execution on failure.
|
920
|
-
|
921
|
-
temp_dir_root : str, default: None
|
922
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
920
|
+
var : str, optional, default None
|
921
|
+
Name of the artifact in which to store the caught exception.
|
922
|
+
If not specified, the exception is not stored.
|
923
|
+
print_exception : bool, default True
|
924
|
+
Determines whether or not the exception is printed to
|
925
|
+
stdout when caught.
|
923
926
|
"""
|
924
927
|
...
|
925
928
|
|
926
929
|
@typing.overload
|
927
|
-
def
|
930
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
928
931
|
...
|
929
932
|
|
930
933
|
@typing.overload
|
931
|
-
def
|
934
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
932
935
|
...
|
933
936
|
|
934
|
-
def
|
937
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
935
938
|
"""
|
936
|
-
|
939
|
+
Specifies that the step will success under all circumstances.
|
937
940
|
|
941
|
+
The decorator will create an optional artifact, specified by `var`, which
|
942
|
+
contains the exception raised. You can use it to detect the presence
|
943
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
944
|
+
are missing.
|
938
945
|
|
939
946
|
|
940
947
|
Parameters
|
941
948
|
----------
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
949
|
+
var : str, optional, default None
|
950
|
+
Name of the artifact in which to store the caught exception.
|
951
|
+
If not specified, the exception is not stored.
|
952
|
+
print_exception : bool, default True
|
953
|
+
Determines whether or not the exception is printed to
|
954
|
+
stdout when caught.
|
955
|
+
"""
|
956
|
+
...
|
957
|
+
|
958
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
959
|
+
"""
|
960
|
+
Specifies what flows belong to the same project.
|
952
961
|
|
953
|
-
|
954
|
-
|
962
|
+
A project-specific namespace is created for all flows that
|
963
|
+
use the same `@project(name)`.
|
964
|
+
|
965
|
+
|
966
|
+
Parameters
|
967
|
+
----------
|
968
|
+
name : str
|
969
|
+
Project name. Make sure that the name is unique amongst all
|
970
|
+
projects that use the same production scheduler. The name may
|
971
|
+
contain only lowercase alphanumeric characters and underscores.
|
972
|
+
|
973
|
+
branch : Optional[str], default None
|
974
|
+
The branch to use. If not specified, the branch is set to
|
975
|
+
`user.<username>` unless `production` is set to `True`. This can
|
976
|
+
also be set on the command line using `--branch` as a top-level option.
|
977
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
978
|
+
|
979
|
+
production : bool, default False
|
980
|
+
Whether or not the branch is the production branch. This can also be set on the
|
981
|
+
command line using `--production` as a top-level option. It is an error to specify
|
982
|
+
`production` in the decorator and on the command line.
|
983
|
+
The project branch name will be:
|
984
|
+
- if `branch` is specified:
|
985
|
+
- if `production` is True: `prod.<branch>`
|
986
|
+
- if `production` is False: `test.<branch>`
|
987
|
+
- if `branch` is not specified:
|
988
|
+
- if `production` is True: `prod`
|
989
|
+
- if `production` is False: `user.<username>`
|
955
990
|
"""
|
956
991
|
...
|
957
992
|
|
@@ -1007,53 +1042,138 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1007
1042
|
...
|
1008
1043
|
|
1009
1044
|
@typing.overload
|
1010
|
-
def
|
1045
|
+
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1011
1046
|
"""
|
1012
|
-
Specifies the
|
1047
|
+
Specifies the event(s) that this flow depends on.
|
1013
1048
|
|
1014
|
-
|
1015
|
-
|
1049
|
+
```
|
1050
|
+
@trigger(event='foo')
|
1051
|
+
```
|
1052
|
+
or
|
1053
|
+
```
|
1054
|
+
@trigger(events=['foo', 'bar'])
|
1055
|
+
```
|
1056
|
+
|
1057
|
+
Additionally, you can specify the parameter mappings
|
1058
|
+
to map event payload to Metaflow parameters for the flow.
|
1059
|
+
```
|
1060
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1061
|
+
```
|
1062
|
+
or
|
1063
|
+
```
|
1064
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1065
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1066
|
+
```
|
1067
|
+
|
1068
|
+
'parameters' can also be a list of strings and tuples like so:
|
1069
|
+
```
|
1070
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1071
|
+
```
|
1072
|
+
This is equivalent to:
|
1073
|
+
```
|
1074
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1075
|
+
```
|
1016
1076
|
|
1017
1077
|
|
1018
1078
|
Parameters
|
1019
1079
|
----------
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1027
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1028
|
-
disabled : bool, default False
|
1029
|
-
If set to True, disables Conda.
|
1080
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1081
|
+
Event dependency for this flow.
|
1082
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1083
|
+
Events dependency for this flow.
|
1084
|
+
options : Dict[str, Any], default {}
|
1085
|
+
Backend-specific configuration for tuning eventing behavior.
|
1030
1086
|
"""
|
1031
1087
|
...
|
1032
1088
|
|
1033
1089
|
@typing.overload
|
1034
|
-
def
|
1090
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1035
1091
|
...
|
1036
1092
|
|
1037
|
-
def
|
1093
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1038
1094
|
"""
|
1039
|
-
Specifies the
|
1095
|
+
Specifies the event(s) that this flow depends on.
|
1040
1096
|
|
1041
|
-
|
1042
|
-
|
1097
|
+
```
|
1098
|
+
@trigger(event='foo')
|
1099
|
+
```
|
1100
|
+
or
|
1101
|
+
```
|
1102
|
+
@trigger(events=['foo', 'bar'])
|
1103
|
+
```
|
1104
|
+
|
1105
|
+
Additionally, you can specify the parameter mappings
|
1106
|
+
to map event payload to Metaflow parameters for the flow.
|
1107
|
+
```
|
1108
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1109
|
+
```
|
1110
|
+
or
|
1111
|
+
```
|
1112
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1113
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1114
|
+
```
|
1115
|
+
|
1116
|
+
'parameters' can also be a list of strings and tuples like so:
|
1117
|
+
```
|
1118
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1119
|
+
```
|
1120
|
+
This is equivalent to:
|
1121
|
+
```
|
1122
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1123
|
+
```
|
1043
1124
|
|
1044
1125
|
|
1045
1126
|
Parameters
|
1046
1127
|
----------
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1128
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1129
|
+
Event dependency for this flow.
|
1130
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1131
|
+
Events dependency for this flow.
|
1132
|
+
options : Dict[str, Any], default {}
|
1133
|
+
Backend-specific configuration for tuning eventing behavior.
|
1134
|
+
"""
|
1135
|
+
...
|
1136
|
+
|
1137
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1138
|
+
"""
|
1139
|
+
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.
|
1140
|
+
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.
|
1141
|
+
|
1142
|
+
|
1143
|
+
Parameters
|
1144
|
+
----------
|
1145
|
+
timeout : int
|
1146
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1147
|
+
poke_interval : int
|
1148
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1149
|
+
mode : str
|
1150
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1151
|
+
exponential_backoff : bool
|
1152
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1153
|
+
pool : str
|
1154
|
+
the slot pool this task should run in,
|
1155
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1156
|
+
soft_fail : bool
|
1157
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1158
|
+
name : str
|
1159
|
+
Name of the sensor on Airflow
|
1160
|
+
description : str
|
1161
|
+
Description of sensor in the Airflow UI
|
1162
|
+
external_dag_id : str
|
1163
|
+
The dag_id that contains the task you want to wait for.
|
1164
|
+
external_task_ids : List[str]
|
1165
|
+
The list of task_ids that you want to wait for.
|
1166
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1167
|
+
allowed_states : List[str]
|
1168
|
+
Iterable of allowed states, (Default: ['success'])
|
1169
|
+
failed_states : List[str]
|
1170
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1171
|
+
execution_delta : datetime.timedelta
|
1172
|
+
time difference with the previous execution to look at,
|
1173
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1174
|
+
check_existence: bool
|
1175
|
+
Set to True to check if the external task exists or check if
|
1176
|
+
the DAG to wait for exists. (Default: True)
|
1057
1177
|
"""
|
1058
1178
|
...
|
1059
1179
|
|
@@ -1159,171 +1279,53 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1159
1279
|
...
|
1160
1280
|
|
1161
1281
|
@typing.overload
|
1162
|
-
def
|
1163
|
-
"""
|
1164
|
-
Specifies the event(s) that this flow depends on.
|
1165
|
-
|
1166
|
-
```
|
1167
|
-
@trigger(event='foo')
|
1168
|
-
```
|
1169
|
-
or
|
1170
|
-
```
|
1171
|
-
@trigger(events=['foo', 'bar'])
|
1172
|
-
```
|
1173
|
-
|
1174
|
-
Additionally, you can specify the parameter mappings
|
1175
|
-
to map event payload to Metaflow parameters for the flow.
|
1176
|
-
```
|
1177
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1178
|
-
```
|
1179
|
-
or
|
1180
|
-
```
|
1181
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1182
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1183
|
-
```
|
1184
|
-
|
1185
|
-
'parameters' can also be a list of strings and tuples like so:
|
1186
|
-
```
|
1187
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1188
|
-
```
|
1189
|
-
This is equivalent to:
|
1190
|
-
```
|
1191
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1192
|
-
```
|
1193
|
-
|
1194
|
-
|
1195
|
-
Parameters
|
1196
|
-
----------
|
1197
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1198
|
-
Event dependency for this flow.
|
1199
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1200
|
-
Events dependency for this flow.
|
1201
|
-
options : Dict[str, Any], default {}
|
1202
|
-
Backend-specific configuration for tuning eventing behavior.
|
1203
|
-
"""
|
1204
|
-
...
|
1205
|
-
|
1206
|
-
@typing.overload
|
1207
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1208
|
-
...
|
1209
|
-
|
1210
|
-
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1282
|
+
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]]:
|
1211
1283
|
"""
|
1212
|
-
Specifies the
|
1213
|
-
|
1214
|
-
```
|
1215
|
-
@trigger(event='foo')
|
1216
|
-
```
|
1217
|
-
or
|
1218
|
-
```
|
1219
|
-
@trigger(events=['foo', 'bar'])
|
1220
|
-
```
|
1221
|
-
|
1222
|
-
Additionally, you can specify the parameter mappings
|
1223
|
-
to map event payload to Metaflow parameters for the flow.
|
1224
|
-
```
|
1225
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1226
|
-
```
|
1227
|
-
or
|
1228
|
-
```
|
1229
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1230
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1231
|
-
```
|
1232
|
-
|
1233
|
-
'parameters' can also be a list of strings and tuples like so:
|
1234
|
-
```
|
1235
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1236
|
-
```
|
1237
|
-
This is equivalent to:
|
1238
|
-
```
|
1239
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1240
|
-
```
|
1241
|
-
|
1284
|
+
Specifies the Conda environment for all steps of the flow.
|
1242
1285
|
|
1243
|
-
|
1244
|
-
|
1245
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1246
|
-
Event dependency for this flow.
|
1247
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1248
|
-
Events dependency for this flow.
|
1249
|
-
options : Dict[str, Any], default {}
|
1250
|
-
Backend-specific configuration for tuning eventing behavior.
|
1251
|
-
"""
|
1252
|
-
...
|
1253
|
-
|
1254
|
-
@typing.overload
|
1255
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1256
|
-
"""
|
1257
|
-
Specifies the PyPI packages for all steps of the flow.
|
1286
|
+
Use `@conda_base` to set common libraries required by all
|
1287
|
+
steps and use `@conda` to specify step-specific additions.
|
1258
1288
|
|
1259
|
-
Use `@pypi_base` to set common packages required by all
|
1260
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1261
1289
|
|
1262
1290
|
Parameters
|
1263
1291
|
----------
|
1264
|
-
packages : Dict[str, str], default
|
1292
|
+
packages : Dict[str, str], default {}
|
1265
1293
|
Packages to use for this flow. The key is the name of the package
|
1266
1294
|
and the value is the version to use.
|
1267
|
-
|
1295
|
+
libraries : Dict[str, str], default {}
|
1296
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1297
|
+
python : str, optional, default None
|
1268
1298
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1269
1299
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1300
|
+
disabled : bool, default False
|
1301
|
+
If set to True, disables Conda.
|
1270
1302
|
"""
|
1271
1303
|
...
|
1272
1304
|
|
1273
1305
|
@typing.overload
|
1274
|
-
def
|
1306
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1275
1307
|
...
|
1276
1308
|
|
1277
|
-
def
|
1309
|
+
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):
|
1278
1310
|
"""
|
1279
|
-
Specifies the
|
1311
|
+
Specifies the Conda environment for all steps of the flow.
|
1312
|
+
|
1313
|
+
Use `@conda_base` to set common libraries required by all
|
1314
|
+
steps and use `@conda` to specify step-specific additions.
|
1280
1315
|
|
1281
|
-
Use `@pypi_base` to set common packages required by all
|
1282
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1283
1316
|
|
1284
1317
|
Parameters
|
1285
1318
|
----------
|
1286
|
-
packages : Dict[str, str], default
|
1319
|
+
packages : Dict[str, str], default {}
|
1287
1320
|
Packages to use for this flow. The key is the name of the package
|
1288
1321
|
and the value is the version to use.
|
1289
|
-
|
1322
|
+
libraries : Dict[str, str], default {}
|
1323
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1324
|
+
python : str, optional, default None
|
1290
1325
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1291
1326
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1296
|
-
"""
|
1297
|
-
Specifies what flows belong to the same project.
|
1298
|
-
|
1299
|
-
A project-specific namespace is created for all flows that
|
1300
|
-
use the same `@project(name)`.
|
1301
|
-
|
1302
|
-
|
1303
|
-
Parameters
|
1304
|
-
----------
|
1305
|
-
name : str
|
1306
|
-
Project name. Make sure that the name is unique amongst all
|
1307
|
-
projects that use the same production scheduler. The name may
|
1308
|
-
contain only lowercase alphanumeric characters and underscores.
|
1309
|
-
|
1310
|
-
branch : Optional[str], default None
|
1311
|
-
The branch to use. If not specified, the branch is set to
|
1312
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1313
|
-
also be set on the command line using `--branch` as a top-level option.
|
1314
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1315
|
-
|
1316
|
-
production : bool, default False
|
1317
|
-
Whether or not the branch is the production branch. This can also be set on the
|
1318
|
-
command line using `--production` as a top-level option. It is an error to specify
|
1319
|
-
`production` in the decorator and on the command line.
|
1320
|
-
The project branch name will be:
|
1321
|
-
- if `branch` is specified:
|
1322
|
-
- if `production` is True: `prod.<branch>`
|
1323
|
-
- if `production` is False: `test.<branch>`
|
1324
|
-
- if `branch` is not specified:
|
1325
|
-
- if `production` is True: `prod`
|
1326
|
-
- if `production` is False: `user.<username>`
|
1327
|
+
disabled : bool, default False
|
1328
|
+
If set to True, disables Conda.
|
1327
1329
|
"""
|
1328
1330
|
...
|
1329
1331
|
|
@@ -1370,46 +1372,44 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1370
1372
|
"""
|
1371
1373
|
...
|
1372
1374
|
|
1373
|
-
|
1375
|
+
@typing.overload
|
1376
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1374
1377
|
"""
|
1375
|
-
|
1376
|
-
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.
|
1378
|
+
Specifies the PyPI packages for all steps of the flow.
|
1377
1379
|
|
1380
|
+
Use `@pypi_base` to set common packages required by all
|
1381
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1378
1382
|
|
1379
1383
|
Parameters
|
1380
1384
|
----------
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1410
|
-
check_existence: bool
|
1411
|
-
Set to True to check if the external task exists or check if
|
1412
|
-
the DAG to wait for exists. (Default: True)
|
1385
|
+
packages : Dict[str, str], default: {}
|
1386
|
+
Packages to use for this flow. The key is the name of the package
|
1387
|
+
and the value is the version to use.
|
1388
|
+
python : str, optional, default: None
|
1389
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1390
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1391
|
+
"""
|
1392
|
+
...
|
1393
|
+
|
1394
|
+
@typing.overload
|
1395
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1396
|
+
...
|
1397
|
+
|
1398
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1399
|
+
"""
|
1400
|
+
Specifies the PyPI packages for all steps of the flow.
|
1401
|
+
|
1402
|
+
Use `@pypi_base` to set common packages required by all
|
1403
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1404
|
+
|
1405
|
+
Parameters
|
1406
|
+
----------
|
1407
|
+
packages : Dict[str, str], default: {}
|
1408
|
+
Packages to use for this flow. The key is the name of the package
|
1409
|
+
and the value is the version to use.
|
1410
|
+
python : str, optional, default: None
|
1411
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1412
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1413
1413
|
"""
|
1414
1414
|
...
|
1415
1415
|
|