ob-metaflow-stubs 6.0.3.102rc4__py2.py3-none-any.whl → 6.0.3.102rc5__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 +542 -542
- metaflow-stubs/cards.pyi +4 -4
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/clone_util.pyi +1 -1
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +52 -52
- metaflow-stubs/mflog/mflog.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +1 -1
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/logs_cli.pyi +2 -2
- metaflow-stubs/plugins/package_cli.pyi +1 -1
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/tag_cli.pyi +4 -4
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
- metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
- metaflow-stubs/procpoll.pyi +1 -1
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +1 -1
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- {ob_metaflow_stubs-6.0.3.102rc4.dist-info → ob_metaflow_stubs-6.0.3.102rc5.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.102rc5.dist-info/RECORD +140 -0
- ob_metaflow_stubs-6.0.3.102rc4.dist-info/RECORD +0 -140
- {ob_metaflow_stubs-6.0.3.102rc4.dist-info → ob_metaflow_stubs-6.0.3.102rc5.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.102rc4.dist-info → ob_metaflow_stubs-6.0.3.102rc5.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.12.22.1+obcheckpoint(0.0.10);ob(v1) #
|
4
|
-
# Generated on 2024-09-20T19:
|
4
|
+
# Generated on 2024-09-20T19:15:33.481402 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import metaflow.
|
11
|
+
import metaflow.metaflow_current
|
12
12
|
import metaflow.parameters
|
13
|
-
import metaflow.
|
13
|
+
import metaflow._vendor.click.types
|
14
|
+
import metaflow.runner.metaflow_runner
|
15
|
+
import metaflow.client.core
|
16
|
+
import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
14
17
|
import metaflow.datastore.inputs
|
15
18
|
import metaflow.events
|
16
|
-
import metaflow.client.core
|
17
|
-
import metaflow._vendor.click.types
|
18
|
-
import typing
|
19
|
-
import metaflow.metaflow_current
|
20
19
|
import datetime
|
21
|
-
import
|
20
|
+
import metaflow.flowspec
|
21
|
+
import typing
|
22
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
23
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
24
24
|
|
@@ -435,51 +435,207 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
435
435
|
...
|
436
436
|
|
437
437
|
@typing.overload
|
438
|
-
def
|
438
|
+
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]]]:
|
439
439
|
"""
|
440
|
-
Specifies
|
440
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
441
|
+
the execution of a step.
|
442
|
+
|
443
|
+
Parameters
|
444
|
+
----------
|
445
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
446
|
+
List of secret specs, defining how the secrets are to be retrieved
|
447
|
+
"""
|
448
|
+
...
|
449
|
+
|
450
|
+
@typing.overload
|
451
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
452
|
+
...
|
453
|
+
|
454
|
+
@typing.overload
|
455
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
456
|
+
...
|
457
|
+
|
458
|
+
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]]] = []):
|
459
|
+
"""
|
460
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
461
|
+
the execution of a step.
|
462
|
+
|
463
|
+
Parameters
|
464
|
+
----------
|
465
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
466
|
+
List of secret specs, defining how the secrets are to be retrieved
|
467
|
+
"""
|
468
|
+
...
|
469
|
+
|
470
|
+
@typing.overload
|
471
|
+
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]]]:
|
472
|
+
"""
|
473
|
+
Specifies the Conda environment for the step.
|
441
474
|
|
442
475
|
Information in this decorator will augment any
|
443
|
-
attributes set in the `@
|
444
|
-
you can use `@
|
445
|
-
steps and use `@
|
476
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
477
|
+
you can use `@conda_base` to set packages required by all
|
478
|
+
steps and use `@conda` to specify step-specific overrides.
|
446
479
|
|
447
480
|
Parameters
|
448
481
|
----------
|
449
|
-
packages : Dict[str, str], default
|
482
|
+
packages : Dict[str, str], default {}
|
450
483
|
Packages to use for this step. The key is the name of the package
|
451
484
|
and the value is the version to use.
|
452
|
-
|
485
|
+
libraries : Dict[str, str], default {}
|
486
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
487
|
+
python : str, optional, default None
|
453
488
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
454
489
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
490
|
+
disabled : bool, default False
|
491
|
+
If set to True, disables @conda.
|
455
492
|
"""
|
456
493
|
...
|
457
494
|
|
458
495
|
@typing.overload
|
459
|
-
def
|
496
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
460
497
|
...
|
461
498
|
|
462
499
|
@typing.overload
|
463
|
-
def
|
500
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
464
501
|
...
|
465
502
|
|
466
|
-
def
|
503
|
+
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):
|
467
504
|
"""
|
468
|
-
Specifies the
|
505
|
+
Specifies the Conda environment for the step.
|
469
506
|
|
470
507
|
Information in this decorator will augment any
|
471
|
-
attributes set in the `@
|
472
|
-
you can use `@
|
473
|
-
steps and use `@
|
508
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
509
|
+
you can use `@conda_base` to set packages required by all
|
510
|
+
steps and use `@conda` to specify step-specific overrides.
|
474
511
|
|
475
512
|
Parameters
|
476
513
|
----------
|
477
|
-
packages : Dict[str, str], default
|
514
|
+
packages : Dict[str, str], default {}
|
478
515
|
Packages to use for this step. The key is the name of the package
|
479
516
|
and the value is the version to use.
|
480
|
-
|
517
|
+
libraries : Dict[str, str], default {}
|
518
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
519
|
+
python : str, optional, default None
|
481
520
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
482
521
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
522
|
+
disabled : bool, default False
|
523
|
+
If set to True, disables @conda.
|
524
|
+
"""
|
525
|
+
...
|
526
|
+
|
527
|
+
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] = [], 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) -> 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]]]:
|
528
|
+
"""
|
529
|
+
Specifies that this step should execute on Kubernetes.
|
530
|
+
|
531
|
+
Parameters
|
532
|
+
----------
|
533
|
+
cpu : int, default 1
|
534
|
+
Number of CPUs required for this step. If `@resources` is
|
535
|
+
also present, the maximum value from all decorators is used.
|
536
|
+
memory : int, default 4096
|
537
|
+
Memory size (in MB) required for this step. If
|
538
|
+
`@resources` is also present, the maximum value from all decorators is
|
539
|
+
used.
|
540
|
+
disk : int, default 10240
|
541
|
+
Disk size (in MB) required for this step. If
|
542
|
+
`@resources` is also present, the maximum value from all decorators is
|
543
|
+
used.
|
544
|
+
image : str, optional, default None
|
545
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
546
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
547
|
+
not, a default Docker image mapping to the current version of Python is used.
|
548
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
549
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
550
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
551
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
552
|
+
secrets : List[str], optional, default None
|
553
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
554
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
555
|
+
in Metaflow configuration.
|
556
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
557
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
558
|
+
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
559
|
+
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
560
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
561
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
562
|
+
gpu : int, optional, default None
|
563
|
+
Number of GPUs required for this step. A value of zero implies that
|
564
|
+
the scheduled node should not have GPUs.
|
565
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
566
|
+
The vendor of the GPUs to be used for this step.
|
567
|
+
tolerations : List[str], default []
|
568
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
569
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
570
|
+
use_tmpfs : bool, default False
|
571
|
+
This enables an explicit tmpfs mount for this step.
|
572
|
+
tmpfs_tempdir : bool, default True
|
573
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
574
|
+
tmpfs_size : int, optional, default: None
|
575
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
576
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
577
|
+
memory allocated for this step.
|
578
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
579
|
+
Path to tmpfs mount for this step.
|
580
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
581
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
582
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
583
|
+
shared_memory: int, optional
|
584
|
+
Shared memory size (in MiB) required for this step
|
585
|
+
port: int, optional
|
586
|
+
Port number to specify in the Kubernetes job object
|
587
|
+
compute_pool : str, optional, default None
|
588
|
+
Compute pool to be used for for this step.
|
589
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
590
|
+
"""
|
591
|
+
...
|
592
|
+
|
593
|
+
@typing.overload
|
594
|
+
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]]]:
|
595
|
+
"""
|
596
|
+
Specifies that the step will success under all circumstances.
|
597
|
+
|
598
|
+
The decorator will create an optional artifact, specified by `var`, which
|
599
|
+
contains the exception raised. You can use it to detect the presence
|
600
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
601
|
+
are missing.
|
602
|
+
|
603
|
+
Parameters
|
604
|
+
----------
|
605
|
+
var : str, optional, default None
|
606
|
+
Name of the artifact in which to store the caught exception.
|
607
|
+
If not specified, the exception is not stored.
|
608
|
+
print_exception : bool, default True
|
609
|
+
Determines whether or not the exception is printed to
|
610
|
+
stdout when caught.
|
611
|
+
"""
|
612
|
+
...
|
613
|
+
|
614
|
+
@typing.overload
|
615
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
616
|
+
...
|
617
|
+
|
618
|
+
@typing.overload
|
619
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
620
|
+
...
|
621
|
+
|
622
|
+
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):
|
623
|
+
"""
|
624
|
+
Specifies that the step will success under all circumstances.
|
625
|
+
|
626
|
+
The decorator will create an optional artifact, specified by `var`, which
|
627
|
+
contains the exception raised. You can use it to detect the presence
|
628
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
629
|
+
are missing.
|
630
|
+
|
631
|
+
Parameters
|
632
|
+
----------
|
633
|
+
var : str, optional, default None
|
634
|
+
Name of the artifact in which to store the caught exception.
|
635
|
+
If not specified, the exception is not stored.
|
636
|
+
print_exception : bool, default True
|
637
|
+
Determines whether or not the exception is printed to
|
638
|
+
stdout when caught.
|
483
639
|
"""
|
484
640
|
...
|
485
641
|
|
@@ -545,83 +701,138 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
545
701
|
...
|
546
702
|
|
547
703
|
@typing.overload
|
548
|
-
def
|
704
|
+
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]]]:
|
549
705
|
"""
|
550
|
-
|
706
|
+
Specifies the PyPI packages for the step.
|
707
|
+
|
708
|
+
Information in this decorator will augment any
|
709
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
710
|
+
you can use `@pypi_base` to set packages required by all
|
711
|
+
steps and use `@pypi` to specify step-specific overrides.
|
712
|
+
|
713
|
+
Parameters
|
714
|
+
----------
|
715
|
+
packages : Dict[str, str], default: {}
|
716
|
+
Packages to use for this step. The key is the name of the package
|
717
|
+
and the value is the version to use.
|
718
|
+
python : str, optional, default: None
|
719
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
720
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
551
721
|
"""
|
552
722
|
...
|
553
723
|
|
554
724
|
@typing.overload
|
555
|
-
def
|
725
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
556
726
|
...
|
557
727
|
|
558
|
-
|
559
|
-
|
560
|
-
Internal decorator to support Fast bakery
|
561
|
-
"""
|
728
|
+
@typing.overload
|
729
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
562
730
|
...
|
563
731
|
|
564
|
-
|
565
|
-
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]]]:
|
732
|
+
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):
|
566
733
|
"""
|
567
|
-
Specifies
|
734
|
+
Specifies the PyPI packages for the step.
|
735
|
+
|
736
|
+
Information in this decorator will augment any
|
737
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
738
|
+
you can use `@pypi_base` to set packages required by all
|
739
|
+
steps and use `@pypi` to specify step-specific overrides.
|
568
740
|
|
569
741
|
Parameters
|
570
742
|
----------
|
571
|
-
|
572
|
-
|
743
|
+
packages : Dict[str, str], default: {}
|
744
|
+
Packages to use for this step. The key is the name of the package
|
745
|
+
and the value is the version to use.
|
746
|
+
python : str, optional, default: None
|
747
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
748
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
573
749
|
"""
|
574
750
|
...
|
575
751
|
|
576
752
|
@typing.overload
|
577
|
-
def
|
578
|
-
...
|
579
|
-
|
580
|
-
@typing.overload
|
581
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
582
|
-
...
|
583
|
-
|
584
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
753
|
+
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]]]:
|
585
754
|
"""
|
586
|
-
|
755
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
756
|
+
|
757
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
587
758
|
|
588
759
|
Parameters
|
589
760
|
----------
|
590
|
-
|
591
|
-
|
761
|
+
type : str, default 'default'
|
762
|
+
Card type.
|
763
|
+
id : str, optional, default None
|
764
|
+
If multiple cards are present, use this id to identify this card.
|
765
|
+
options : Dict[str, Any], default {}
|
766
|
+
Options passed to the card. The contents depend on the card type.
|
767
|
+
timeout : int, default 45
|
768
|
+
Interrupt reporting if it takes more than this many seconds.
|
769
|
+
|
770
|
+
|
592
771
|
"""
|
593
772
|
...
|
594
773
|
|
595
774
|
@typing.overload
|
596
|
-
def
|
775
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
776
|
+
...
|
777
|
+
|
778
|
+
@typing.overload
|
779
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
780
|
+
...
|
781
|
+
|
782
|
+
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):
|
597
783
|
"""
|
598
|
-
|
599
|
-
|
784
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
785
|
+
|
786
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
600
787
|
|
601
788
|
Parameters
|
602
789
|
----------
|
603
|
-
|
604
|
-
|
790
|
+
type : str, default 'default'
|
791
|
+
Card type.
|
792
|
+
id : str, optional, default None
|
793
|
+
If multiple cards are present, use this id to identify this card.
|
794
|
+
options : Dict[str, Any], default {}
|
795
|
+
Options passed to the card. The contents depend on the card type.
|
796
|
+
timeout : int, default 45
|
797
|
+
Interrupt reporting if it takes more than this many seconds.
|
798
|
+
|
799
|
+
|
605
800
|
"""
|
606
801
|
...
|
607
802
|
|
608
803
|
@typing.overload
|
609
|
-
def
|
804
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
805
|
+
"""
|
806
|
+
Internal decorator to support Fast bakery
|
807
|
+
"""
|
610
808
|
...
|
611
809
|
|
612
810
|
@typing.overload
|
613
|
-
def
|
811
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
614
812
|
...
|
615
813
|
|
616
|
-
def
|
814
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
617
815
|
"""
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
816
|
+
Internal decorator to support Fast bakery
|
817
|
+
"""
|
818
|
+
...
|
819
|
+
|
820
|
+
@typing.overload
|
821
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
822
|
+
"""
|
823
|
+
Decorator prototype for all step decorators. This function gets specialized
|
824
|
+
and imported for all decorators types by _import_plugin_decorators().
|
825
|
+
"""
|
826
|
+
...
|
827
|
+
|
828
|
+
@typing.overload
|
829
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
830
|
+
...
|
831
|
+
|
832
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
833
|
+
"""
|
834
|
+
Decorator prototype for all step decorators. This function gets specialized
|
835
|
+
and imported for all decorators types by _import_plugin_decorators().
|
625
836
|
"""
|
626
837
|
...
|
627
838
|
|
@@ -687,244 +898,167 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
687
898
|
...
|
688
899
|
|
689
900
|
@typing.overload
|
690
|
-
def
|
901
|
+
def resources(*, cpu: int = 1, gpu: int = 0, 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]]]:
|
691
902
|
"""
|
692
|
-
Specifies
|
903
|
+
Specifies the resources needed when executing this step.
|
693
904
|
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
905
|
+
Use `@resources` to specify the resource requirements
|
906
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
907
|
+
|
908
|
+
You can choose the compute layer on the command line by executing e.g.
|
909
|
+
```
|
910
|
+
python myflow.py run --with batch
|
911
|
+
```
|
912
|
+
or
|
913
|
+
```
|
914
|
+
python myflow.py run --with kubernetes
|
915
|
+
```
|
916
|
+
which executes the flow on the desired system using the
|
917
|
+
requirements specified in `@resources`.
|
698
918
|
|
699
919
|
Parameters
|
700
920
|
----------
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
921
|
+
cpu : int, default 1
|
922
|
+
Number of CPUs required for this step.
|
923
|
+
gpu : int, default 0
|
924
|
+
Number of GPUs required for this step.
|
925
|
+
disk : int, optional, default None
|
926
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
927
|
+
memory : int, default 4096
|
928
|
+
Memory size (in MB) required for this step.
|
929
|
+
shared_memory : int, optional, default None
|
930
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
931
|
+
This parameter maps to the `--shm-size` option in Docker.
|
707
932
|
"""
|
708
933
|
...
|
709
934
|
|
710
935
|
@typing.overload
|
711
|
-
def
|
936
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
712
937
|
...
|
713
938
|
|
714
939
|
@typing.overload
|
715
|
-
def
|
940
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
716
941
|
...
|
717
942
|
|
718
|
-
def
|
943
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
719
944
|
"""
|
720
|
-
Specifies
|
945
|
+
Specifies the resources needed when executing this step.
|
721
946
|
|
722
|
-
|
723
|
-
|
724
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
725
|
-
are missing.
|
947
|
+
Use `@resources` to specify the resource requirements
|
948
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
726
949
|
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
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] = [], 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) -> 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]]]:
|
739
|
-
"""
|
740
|
-
Specifies that this step should execute on Kubernetes.
|
950
|
+
You can choose the compute layer on the command line by executing e.g.
|
951
|
+
```
|
952
|
+
python myflow.py run --with batch
|
953
|
+
```
|
954
|
+
or
|
955
|
+
```
|
956
|
+
python myflow.py run --with kubernetes
|
957
|
+
```
|
958
|
+
which executes the flow on the desired system using the
|
959
|
+
requirements specified in `@resources`.
|
741
960
|
|
742
961
|
Parameters
|
743
962
|
----------
|
744
963
|
cpu : int, default 1
|
745
|
-
Number of CPUs required for this step.
|
746
|
-
|
964
|
+
Number of CPUs required for this step.
|
965
|
+
gpu : int, default 0
|
966
|
+
Number of GPUs required for this step.
|
967
|
+
disk : int, optional, default None
|
968
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
747
969
|
memory : int, default 4096
|
748
|
-
Memory size (in MB) required for this step.
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
Disk size (in MB) required for this step. If
|
753
|
-
`@resources` is also present, the maximum value from all decorators is
|
754
|
-
used.
|
755
|
-
image : str, optional, default None
|
756
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
757
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
758
|
-
not, a default Docker image mapping to the current version of Python is used.
|
759
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
760
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
761
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
762
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
763
|
-
secrets : List[str], optional, default None
|
764
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
765
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
766
|
-
in Metaflow configuration.
|
767
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
768
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
769
|
-
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
770
|
-
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
771
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
772
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
773
|
-
gpu : int, optional, default None
|
774
|
-
Number of GPUs required for this step. A value of zero implies that
|
775
|
-
the scheduled node should not have GPUs.
|
776
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
777
|
-
The vendor of the GPUs to be used for this step.
|
778
|
-
tolerations : List[str], default []
|
779
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
780
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
781
|
-
use_tmpfs : bool, default False
|
782
|
-
This enables an explicit tmpfs mount for this step.
|
783
|
-
tmpfs_tempdir : bool, default True
|
784
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
785
|
-
tmpfs_size : int, optional, default: None
|
786
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
787
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
788
|
-
memory allocated for this step.
|
789
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
790
|
-
Path to tmpfs mount for this step.
|
791
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
792
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
793
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
794
|
-
shared_memory: int, optional
|
795
|
-
Shared memory size (in MiB) required for this step
|
796
|
-
port: int, optional
|
797
|
-
Port number to specify in the Kubernetes job object
|
798
|
-
compute_pool : str, optional, default None
|
799
|
-
Compute pool to be used for for this step.
|
800
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
801
|
-
"""
|
802
|
-
...
|
803
|
-
|
804
|
-
@typing.overload
|
805
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
806
|
-
"""
|
807
|
-
Decorator prototype for all step decorators. This function gets specialized
|
808
|
-
and imported for all decorators types by _import_plugin_decorators().
|
809
|
-
"""
|
810
|
-
...
|
811
|
-
|
812
|
-
@typing.overload
|
813
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
814
|
-
...
|
815
|
-
|
816
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
817
|
-
"""
|
818
|
-
Decorator prototype for all step decorators. This function gets specialized
|
819
|
-
and imported for all decorators types by _import_plugin_decorators().
|
970
|
+
Memory size (in MB) required for this step.
|
971
|
+
shared_memory : int, optional, default None
|
972
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
973
|
+
This parameter maps to the `--shm-size` option in Docker.
|
820
974
|
"""
|
821
975
|
...
|
822
976
|
|
823
977
|
@typing.overload
|
824
|
-
def
|
978
|
+
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]]]:
|
825
979
|
"""
|
826
|
-
Specifies
|
827
|
-
|
828
|
-
Information in this decorator will augment any
|
829
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
830
|
-
you can use `@conda_base` to set packages required by all
|
831
|
-
steps and use `@conda` to specify step-specific overrides.
|
980
|
+
Specifies environment variables to be set prior to the execution of a step.
|
832
981
|
|
833
982
|
Parameters
|
834
983
|
----------
|
835
|
-
|
836
|
-
|
837
|
-
and the value is the version to use.
|
838
|
-
libraries : Dict[str, str], default {}
|
839
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
840
|
-
python : str, optional, default None
|
841
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
842
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
843
|
-
disabled : bool, default False
|
844
|
-
If set to True, disables @conda.
|
984
|
+
vars : Dict[str, str], default {}
|
985
|
+
Dictionary of environment variables to set.
|
845
986
|
"""
|
846
987
|
...
|
847
988
|
|
848
989
|
@typing.overload
|
849
|
-
def
|
990
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
850
991
|
...
|
851
992
|
|
852
993
|
@typing.overload
|
853
|
-
def
|
994
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
854
995
|
...
|
855
996
|
|
856
|
-
def
|
997
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
857
998
|
"""
|
858
|
-
Specifies
|
859
|
-
|
860
|
-
Information in this decorator will augment any
|
861
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
862
|
-
you can use `@conda_base` to set packages required by all
|
863
|
-
steps and use `@conda` to specify step-specific overrides.
|
999
|
+
Specifies environment variables to be set prior to the execution of a step.
|
864
1000
|
|
865
1001
|
Parameters
|
866
1002
|
----------
|
867
|
-
|
868
|
-
|
869
|
-
and the value is the version to use.
|
870
|
-
libraries : Dict[str, str], default {}
|
871
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
872
|
-
python : str, optional, default None
|
873
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
874
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
875
|
-
disabled : bool, default False
|
876
|
-
If set to True, disables @conda.
|
1003
|
+
vars : Dict[str, str], default {}
|
1004
|
+
Dictionary of environment variables to set.
|
877
1005
|
"""
|
878
1006
|
...
|
879
1007
|
|
880
1008
|
@typing.overload
|
881
|
-
def
|
1009
|
+
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]]]:
|
882
1010
|
"""
|
883
|
-
|
1011
|
+
Specifies a timeout for your step.
|
884
1012
|
|
885
|
-
|
1013
|
+
This decorator is useful if this step may hang indefinitely.
|
886
1014
|
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
Card type.
|
891
|
-
id : str, optional, default None
|
892
|
-
If multiple cards are present, use this id to identify this card.
|
893
|
-
options : Dict[str, Any], default {}
|
894
|
-
Options passed to the card. The contents depend on the card type.
|
895
|
-
timeout : int, default 45
|
896
|
-
Interrupt reporting if it takes more than this many seconds.
|
1015
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1016
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1017
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
897
1018
|
|
1019
|
+
Note that all the values specified in parameters are added together so if you specify
|
1020
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
898
1021
|
|
1022
|
+
Parameters
|
1023
|
+
----------
|
1024
|
+
seconds : int, default 0
|
1025
|
+
Number of seconds to wait prior to timing out.
|
1026
|
+
minutes : int, default 0
|
1027
|
+
Number of minutes to wait prior to timing out.
|
1028
|
+
hours : int, default 0
|
1029
|
+
Number of hours to wait prior to timing out.
|
899
1030
|
"""
|
900
1031
|
...
|
901
1032
|
|
902
1033
|
@typing.overload
|
903
|
-
def
|
1034
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
904
1035
|
...
|
905
1036
|
|
906
1037
|
@typing.overload
|
907
|
-
def
|
1038
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
908
1039
|
...
|
909
1040
|
|
910
|
-
def
|
1041
|
+
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):
|
911
1042
|
"""
|
912
|
-
|
1043
|
+
Specifies a timeout for your step.
|
913
1044
|
|
914
|
-
|
1045
|
+
This decorator is useful if this step may hang indefinitely.
|
915
1046
|
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
Card type.
|
920
|
-
id : str, optional, default None
|
921
|
-
If multiple cards are present, use this id to identify this card.
|
922
|
-
options : Dict[str, Any], default {}
|
923
|
-
Options passed to the card. The contents depend on the card type.
|
924
|
-
timeout : int, default 45
|
925
|
-
Interrupt reporting if it takes more than this many seconds.
|
1047
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1048
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1049
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
926
1050
|
|
1051
|
+
Note that all the values specified in parameters are added together so if you specify
|
1052
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
927
1053
|
|
1054
|
+
Parameters
|
1055
|
+
----------
|
1056
|
+
seconds : int, default 0
|
1057
|
+
Number of seconds to wait prior to timing out.
|
1058
|
+
minutes : int, default 0
|
1059
|
+
Number of minutes to wait prior to timing out.
|
1060
|
+
hours : int, default 0
|
1061
|
+
Number of hours to wait prior to timing out.
|
928
1062
|
"""
|
929
1063
|
...
|
930
1064
|
|
@@ -982,136 +1116,167 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
982
1116
|
...
|
983
1117
|
|
984
1118
|
@typing.overload
|
985
|
-
def
|
1119
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
986
1120
|
"""
|
987
|
-
Specifies the
|
988
|
-
|
989
|
-
Use `@resources` to specify the resource requirements
|
990
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
991
|
-
|
992
|
-
You can choose the compute layer on the command line by executing e.g.
|
993
|
-
```
|
994
|
-
python myflow.py run --with batch
|
995
|
-
```
|
996
|
-
or
|
997
|
-
```
|
998
|
-
python myflow.py run --with kubernetes
|
999
|
-
```
|
1000
|
-
which executes the flow on the desired system using the
|
1001
|
-
requirements specified in `@resources`.
|
1121
|
+
Specifies the PyPI packages for all steps of the flow.
|
1002
1122
|
|
1123
|
+
Use `@pypi_base` to set common packages required by all
|
1124
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1003
1125
|
Parameters
|
1004
1126
|
----------
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
memory : int, default 4096
|
1012
|
-
Memory size (in MB) required for this step.
|
1013
|
-
shared_memory : int, optional, default None
|
1014
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1015
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1127
|
+
packages : Dict[str, str], default: {}
|
1128
|
+
Packages to use for this flow. The key is the name of the package
|
1129
|
+
and the value is the version to use.
|
1130
|
+
python : str, optional, default: None
|
1131
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1132
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1016
1133
|
"""
|
1017
1134
|
...
|
1018
1135
|
|
1019
1136
|
@typing.overload
|
1020
|
-
def
|
1137
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1021
1138
|
...
|
1022
1139
|
|
1023
|
-
|
1024
|
-
|
1140
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1141
|
+
"""
|
1142
|
+
Specifies the PyPI packages for all steps of the flow.
|
1143
|
+
|
1144
|
+
Use `@pypi_base` to set common packages required by all
|
1145
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1146
|
+
Parameters
|
1147
|
+
----------
|
1148
|
+
packages : Dict[str, str], default: {}
|
1149
|
+
Packages to use for this flow. The key is the name of the package
|
1150
|
+
and the value is the version to use.
|
1151
|
+
python : str, optional, default: None
|
1152
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1153
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1154
|
+
"""
|
1025
1155
|
...
|
1026
1156
|
|
1027
|
-
def
|
1157
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1028
1158
|
"""
|
1029
|
-
|
1159
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1030
1160
|
|
1031
|
-
|
1032
|
-
|
1161
|
+
User code call
|
1162
|
+
-----------
|
1163
|
+
@nim(
|
1164
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1165
|
+
backend='managed'
|
1166
|
+
)
|
1033
1167
|
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1168
|
+
Valid backend options
|
1169
|
+
---------------------
|
1170
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1171
|
+
- 🚧 'dataplane': Run in your account.
|
1172
|
+
|
1173
|
+
Valid model options
|
1174
|
+
----------------
|
1175
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1176
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1177
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1044
1178
|
|
1045
1179
|
Parameters
|
1046
1180
|
----------
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
disk : int, optional, default None
|
1052
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1053
|
-
memory : int, default 4096
|
1054
|
-
Memory size (in MB) required for this step.
|
1055
|
-
shared_memory : int, optional, default None
|
1056
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1057
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1181
|
+
models: list[NIM]
|
1182
|
+
List of NIM containers running models in sidecars.
|
1183
|
+
backend: str
|
1184
|
+
Compute provider to run the NIM container.
|
1058
1185
|
"""
|
1059
1186
|
...
|
1060
1187
|
|
1061
1188
|
@typing.overload
|
1062
|
-
def
|
1189
|
+
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]]:
|
1063
1190
|
"""
|
1064
|
-
Specifies
|
1191
|
+
Specifies the event(s) that this flow depends on.
|
1065
1192
|
|
1066
|
-
|
1193
|
+
```
|
1194
|
+
@trigger(event='foo')
|
1195
|
+
```
|
1196
|
+
or
|
1197
|
+
```
|
1198
|
+
@trigger(events=['foo', 'bar'])
|
1199
|
+
```
|
1067
1200
|
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1201
|
+
Additionally, you can specify the parameter mappings
|
1202
|
+
to map event payload to Metaflow parameters for the flow.
|
1203
|
+
```
|
1204
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1205
|
+
```
|
1206
|
+
or
|
1207
|
+
```
|
1208
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1209
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1210
|
+
```
|
1071
1211
|
|
1072
|
-
|
1073
|
-
|
1212
|
+
'parameters' can also be a list of strings and tuples like so:
|
1213
|
+
```
|
1214
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1215
|
+
```
|
1216
|
+
This is equivalent to:
|
1217
|
+
```
|
1218
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1219
|
+
```
|
1074
1220
|
|
1075
1221
|
Parameters
|
1076
1222
|
----------
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1223
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1224
|
+
Event dependency for this flow.
|
1225
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1226
|
+
Events dependency for this flow.
|
1227
|
+
options : Dict[str, Any], default {}
|
1228
|
+
Backend-specific configuration for tuning eventing behavior.
|
1229
|
+
|
1230
|
+
|
1083
1231
|
"""
|
1084
1232
|
...
|
1085
1233
|
|
1086
1234
|
@typing.overload
|
1087
|
-
def
|
1088
|
-
...
|
1089
|
-
|
1090
|
-
@typing.overload
|
1091
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1235
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1092
1236
|
...
|
1093
1237
|
|
1094
|
-
def
|
1238
|
+
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] = {}):
|
1095
1239
|
"""
|
1096
|
-
Specifies
|
1240
|
+
Specifies the event(s) that this flow depends on.
|
1097
1241
|
|
1098
|
-
|
1242
|
+
```
|
1243
|
+
@trigger(event='foo')
|
1244
|
+
```
|
1245
|
+
or
|
1246
|
+
```
|
1247
|
+
@trigger(events=['foo', 'bar'])
|
1248
|
+
```
|
1099
1249
|
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1250
|
+
Additionally, you can specify the parameter mappings
|
1251
|
+
to map event payload to Metaflow parameters for the flow.
|
1252
|
+
```
|
1253
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1254
|
+
```
|
1255
|
+
or
|
1256
|
+
```
|
1257
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1258
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1259
|
+
```
|
1103
1260
|
|
1104
|
-
|
1105
|
-
|
1261
|
+
'parameters' can also be a list of strings and tuples like so:
|
1262
|
+
```
|
1263
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1264
|
+
```
|
1265
|
+
This is equivalent to:
|
1266
|
+
```
|
1267
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1268
|
+
```
|
1106
1269
|
|
1107
1270
|
Parameters
|
1108
1271
|
----------
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1272
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1273
|
+
Event dependency for this flow.
|
1274
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1275
|
+
Events dependency for this flow.
|
1276
|
+
options : Dict[str, Any], default {}
|
1277
|
+
Backend-specific configuration for tuning eventing behavior.
|
1278
|
+
|
1279
|
+
|
1115
1280
|
"""
|
1116
1281
|
...
|
1117
1282
|
|
@@ -1207,12 +1372,30 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1207
1372
|
|
1208
1373
|
Parameters
|
1209
1374
|
----------
|
1210
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
1211
|
-
Upstream flow dependency for this flow.
|
1212
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
1213
|
-
Upstream flow dependencies for this flow.
|
1214
|
-
options : Dict[str, Any], default {}
|
1215
|
-
Backend-specific configuration for tuning eventing behavior.
|
1375
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1376
|
+
Upstream flow dependency for this flow.
|
1377
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1378
|
+
Upstream flow dependencies for this flow.
|
1379
|
+
options : Dict[str, Any], default {}
|
1380
|
+
Backend-specific configuration for tuning eventing behavior.
|
1381
|
+
|
1382
|
+
|
1383
|
+
"""
|
1384
|
+
...
|
1385
|
+
|
1386
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1387
|
+
"""
|
1388
|
+
Specifies what flows belong to the same project.
|
1389
|
+
|
1390
|
+
A project-specific namespace is created for all flows that
|
1391
|
+
use the same `@project(name)`.
|
1392
|
+
|
1393
|
+
Parameters
|
1394
|
+
----------
|
1395
|
+
name : str
|
1396
|
+
Project name. Make sure that the name is unique amongst all
|
1397
|
+
projects that use the same production scheduler. The name may
|
1398
|
+
contain only lowercase alphanumeric characters and underscores.
|
1216
1399
|
|
1217
1400
|
|
1218
1401
|
"""
|
@@ -1260,55 +1443,6 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1260
1443
|
"""
|
1261
1444
|
...
|
1262
1445
|
|
1263
|
-
@typing.overload
|
1264
|
-
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1265
|
-
"""
|
1266
|
-
Specifies the times when the flow should be run when running on a
|
1267
|
-
production scheduler.
|
1268
|
-
|
1269
|
-
Parameters
|
1270
|
-
----------
|
1271
|
-
hourly : bool, default False
|
1272
|
-
Run the workflow hourly.
|
1273
|
-
daily : bool, default True
|
1274
|
-
Run the workflow daily.
|
1275
|
-
weekly : bool, default False
|
1276
|
-
Run the workflow weekly.
|
1277
|
-
cron : str, optional, default None
|
1278
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1279
|
-
specified by this expression.
|
1280
|
-
timezone : str, optional, default None
|
1281
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1282
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1283
|
-
"""
|
1284
|
-
...
|
1285
|
-
|
1286
|
-
@typing.overload
|
1287
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1288
|
-
...
|
1289
|
-
|
1290
|
-
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1291
|
-
"""
|
1292
|
-
Specifies the times when the flow should be run when running on a
|
1293
|
-
production scheduler.
|
1294
|
-
|
1295
|
-
Parameters
|
1296
|
-
----------
|
1297
|
-
hourly : bool, default False
|
1298
|
-
Run the workflow hourly.
|
1299
|
-
daily : bool, default True
|
1300
|
-
Run the workflow daily.
|
1301
|
-
weekly : bool, default False
|
1302
|
-
Run the workflow weekly.
|
1303
|
-
cron : str, optional, default None
|
1304
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1305
|
-
specified by this expression.
|
1306
|
-
timezone : str, optional, default None
|
1307
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1308
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1309
|
-
"""
|
1310
|
-
...
|
1311
|
-
|
1312
1446
|
@typing.overload
|
1313
1447
|
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]]:
|
1314
1448
|
"""
|
@@ -1358,94 +1492,6 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1358
1492
|
"""
|
1359
1493
|
...
|
1360
1494
|
|
1361
|
-
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1362
|
-
"""
|
1363
|
-
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1364
|
-
|
1365
|
-
User code call
|
1366
|
-
-----------
|
1367
|
-
@nim(
|
1368
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1369
|
-
backend='managed'
|
1370
|
-
)
|
1371
|
-
|
1372
|
-
Valid backend options
|
1373
|
-
---------------------
|
1374
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
1375
|
-
- 🚧 'dataplane': Run in your account.
|
1376
|
-
|
1377
|
-
Valid model options
|
1378
|
-
----------------
|
1379
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
1380
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
1381
|
-
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1382
|
-
|
1383
|
-
Parameters
|
1384
|
-
----------
|
1385
|
-
models: list[NIM]
|
1386
|
-
List of NIM containers running models in sidecars.
|
1387
|
-
backend: str
|
1388
|
-
Compute provider to run the NIM container.
|
1389
|
-
"""
|
1390
|
-
...
|
1391
|
-
|
1392
|
-
@typing.overload
|
1393
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1394
|
-
"""
|
1395
|
-
Specifies the PyPI packages for all steps of the flow.
|
1396
|
-
|
1397
|
-
Use `@pypi_base` to set common packages required by all
|
1398
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1399
|
-
Parameters
|
1400
|
-
----------
|
1401
|
-
packages : Dict[str, str], default: {}
|
1402
|
-
Packages to use for this flow. The key is the name of the package
|
1403
|
-
and the value is the version to use.
|
1404
|
-
python : str, optional, default: None
|
1405
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1406
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1407
|
-
"""
|
1408
|
-
...
|
1409
|
-
|
1410
|
-
@typing.overload
|
1411
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1412
|
-
...
|
1413
|
-
|
1414
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1415
|
-
"""
|
1416
|
-
Specifies the PyPI packages for all steps of the flow.
|
1417
|
-
|
1418
|
-
Use `@pypi_base` to set common packages required by all
|
1419
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1420
|
-
Parameters
|
1421
|
-
----------
|
1422
|
-
packages : Dict[str, str], default: {}
|
1423
|
-
Packages to use for this flow. The key is the name of the package
|
1424
|
-
and the value is the version to use.
|
1425
|
-
python : str, optional, default: None
|
1426
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1427
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1428
|
-
"""
|
1429
|
-
...
|
1430
|
-
|
1431
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1432
|
-
"""
|
1433
|
-
Specifies what flows belong to the same project.
|
1434
|
-
|
1435
|
-
A project-specific namespace is created for all flows that
|
1436
|
-
use the same `@project(name)`.
|
1437
|
-
|
1438
|
-
Parameters
|
1439
|
-
----------
|
1440
|
-
name : str
|
1441
|
-
Project name. Make sure that the name is unique amongst all
|
1442
|
-
projects that use the same production scheduler. The name may
|
1443
|
-
contain only lowercase alphanumeric characters and underscores.
|
1444
|
-
|
1445
|
-
|
1446
|
-
"""
|
1447
|
-
...
|
1448
|
-
|
1449
1495
|
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]]:
|
1450
1496
|
"""
|
1451
1497
|
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.
|
@@ -1489,97 +1535,51 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1489
1535
|
...
|
1490
1536
|
|
1491
1537
|
@typing.overload
|
1492
|
-
def
|
1538
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1493
1539
|
"""
|
1494
|
-
Specifies the
|
1495
|
-
|
1496
|
-
```
|
1497
|
-
@trigger(event='foo')
|
1498
|
-
```
|
1499
|
-
or
|
1500
|
-
```
|
1501
|
-
@trigger(events=['foo', 'bar'])
|
1502
|
-
```
|
1503
|
-
|
1504
|
-
Additionally, you can specify the parameter mappings
|
1505
|
-
to map event payload to Metaflow parameters for the flow.
|
1506
|
-
```
|
1507
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1508
|
-
```
|
1509
|
-
or
|
1510
|
-
```
|
1511
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1512
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1513
|
-
```
|
1514
|
-
|
1515
|
-
'parameters' can also be a list of strings and tuples like so:
|
1516
|
-
```
|
1517
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1518
|
-
```
|
1519
|
-
This is equivalent to:
|
1520
|
-
```
|
1521
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1522
|
-
```
|
1540
|
+
Specifies the times when the flow should be run when running on a
|
1541
|
+
production scheduler.
|
1523
1542
|
|
1524
1543
|
Parameters
|
1525
1544
|
----------
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1545
|
+
hourly : bool, default False
|
1546
|
+
Run the workflow hourly.
|
1547
|
+
daily : bool, default True
|
1548
|
+
Run the workflow daily.
|
1549
|
+
weekly : bool, default False
|
1550
|
+
Run the workflow weekly.
|
1551
|
+
cron : str, optional, default None
|
1552
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1553
|
+
specified by this expression.
|
1554
|
+
timezone : str, optional, default None
|
1555
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1556
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1534
1557
|
"""
|
1535
1558
|
...
|
1536
1559
|
|
1537
1560
|
@typing.overload
|
1538
|
-
def
|
1561
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1539
1562
|
...
|
1540
1563
|
|
1541
|
-
def
|
1564
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1542
1565
|
"""
|
1543
|
-
Specifies the
|
1544
|
-
|
1545
|
-
```
|
1546
|
-
@trigger(event='foo')
|
1547
|
-
```
|
1548
|
-
or
|
1549
|
-
```
|
1550
|
-
@trigger(events=['foo', 'bar'])
|
1551
|
-
```
|
1552
|
-
|
1553
|
-
Additionally, you can specify the parameter mappings
|
1554
|
-
to map event payload to Metaflow parameters for the flow.
|
1555
|
-
```
|
1556
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1557
|
-
```
|
1558
|
-
or
|
1559
|
-
```
|
1560
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1561
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1562
|
-
```
|
1563
|
-
|
1564
|
-
'parameters' can also be a list of strings and tuples like so:
|
1565
|
-
```
|
1566
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1567
|
-
```
|
1568
|
-
This is equivalent to:
|
1569
|
-
```
|
1570
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1571
|
-
```
|
1566
|
+
Specifies the times when the flow should be run when running on a
|
1567
|
+
production scheduler.
|
1572
1568
|
|
1573
1569
|
Parameters
|
1574
1570
|
----------
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1571
|
+
hourly : bool, default False
|
1572
|
+
Run the workflow hourly.
|
1573
|
+
daily : bool, default True
|
1574
|
+
Run the workflow daily.
|
1575
|
+
weekly : bool, default False
|
1576
|
+
Run the workflow weekly.
|
1577
|
+
cron : str, optional, default None
|
1578
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1579
|
+
specified by this expression.
|
1580
|
+
timezone : str, optional, default None
|
1581
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1582
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1583
1583
|
"""
|
1584
1584
|
...
|
1585
1585
|
|