ob-metaflow-stubs 6.0.3.114__py2.py3-none-any.whl → 6.0.3.116__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 +570 -570
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +4 -4
- metaflow-stubs/client/core.pyi +10 -8
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.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 +4 -4
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata/metadata.pyi +6 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +108 -108
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
- metaflow-stubs/plugins/argo/argo_workflows_deployer.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 +4 -4
- 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/production_token.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 +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- 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 +3 -3
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +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_cli.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/logs_cli.pyi +3 -3
- metaflow-stubs/plugins/package_cli.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 +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +4 -4
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/procpoll.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 +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +5 -33
- 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 +2 -2
- metaflow-stubs/system/__init__.pyi +3 -3
- 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
- {ob_metaflow_stubs-6.0.3.114.dist-info → ob_metaflow_stubs-6.0.3.116.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.116.dist-info/RECORD +140 -0
- ob_metaflow_stubs-6.0.3.114.dist-info/RECORD +0 -140
- {ob_metaflow_stubs-6.0.3.114.dist-info → ob_metaflow_stubs-6.0.3.116.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.114.dist-info → ob_metaflow_stubs-6.0.3.116.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
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.27.1+obcheckpoint(0.1.1);ob(v1) #
|
4
|
+
# Generated on 2024-11-04T20:32:12.972782 #
|
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.flowspec
|
12
|
-
import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
13
11
|
import metaflow.datastore.inputs
|
14
|
-
import
|
15
|
-
import metaflow.
|
16
|
-
import metaflow.runner.metaflow_runner
|
17
|
-
import metaflow.client.core
|
12
|
+
import typing
|
13
|
+
import metaflow.flowspec
|
18
14
|
import metaflow.metaflow_current
|
15
|
+
import metaflow.runner.metaflow_runner
|
19
16
|
import datetime
|
17
|
+
import metaflow.client.core
|
18
|
+
import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
19
|
+
import metaflow.events
|
20
|
+
import metaflow.parameters
|
20
21
|
import metaflow._vendor.click.types
|
21
|
-
import typing
|
22
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
23
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
24
24
|
|
@@ -513,165 +513,106 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
513
513
|
...
|
514
514
|
|
515
515
|
@typing.overload
|
516
|
-
def
|
516
|
+
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]]]:
|
517
517
|
"""
|
518
|
-
|
518
|
+
Specifies the number of times the task corresponding
|
519
|
+
to a step needs to be retried.
|
520
|
+
|
521
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
522
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
523
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
519
524
|
|
525
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
526
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
527
|
+
ensuring that the flow execution can continue.
|
520
528
|
|
521
529
|
Parameters
|
522
530
|
----------
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
will be loaded at the start of the task.
|
528
|
-
- "none": Do not load any checkpoint
|
529
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
530
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
531
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
532
|
-
created within the task will be loaded when the task is retries execution on failure.
|
533
|
-
|
534
|
-
temp_dir_root : str, default: None
|
535
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
536
|
-
|
537
|
-
|
538
|
-
|
531
|
+
times : int, default 3
|
532
|
+
Number of times to retry this task.
|
533
|
+
minutes_between_retries : int, default 2
|
534
|
+
Number of minutes between retries.
|
539
535
|
"""
|
540
536
|
...
|
541
537
|
|
542
538
|
@typing.overload
|
543
|
-
def
|
539
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
544
540
|
...
|
545
541
|
|
546
542
|
@typing.overload
|
547
|
-
def
|
543
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
548
544
|
...
|
549
545
|
|
550
|
-
def
|
546
|
+
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):
|
551
547
|
"""
|
552
|
-
|
548
|
+
Specifies the number of times the task corresponding
|
549
|
+
to a step needs to be retried.
|
550
|
+
|
551
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
552
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
553
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
553
554
|
|
555
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
556
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
557
|
+
ensuring that the flow execution can continue.
|
554
558
|
|
555
559
|
Parameters
|
556
560
|
----------
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
will be loaded at the start of the task.
|
562
|
-
- "none": Do not load any checkpoint
|
563
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
564
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
565
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
566
|
-
created within the task will be loaded when the task is retries execution on failure.
|
567
|
-
|
568
|
-
temp_dir_root : str, default: None
|
569
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
570
|
-
|
571
|
-
|
572
|
-
|
561
|
+
times : int, default 3
|
562
|
+
Number of times to retry this task.
|
563
|
+
minutes_between_retries : int, default 2
|
564
|
+
Number of minutes between retries.
|
573
565
|
"""
|
574
566
|
...
|
575
567
|
|
576
568
|
@typing.overload
|
577
|
-
def
|
569
|
+
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]]]:
|
578
570
|
"""
|
579
|
-
|
580
|
-
|
571
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
572
|
+
|
573
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
581
574
|
|
582
575
|
Parameters
|
583
576
|
----------
|
584
|
-
|
585
|
-
|
577
|
+
type : str, default 'default'
|
578
|
+
Card type.
|
579
|
+
id : str, optional, default None
|
580
|
+
If multiple cards are present, use this id to identify this card.
|
581
|
+
options : Dict[str, Any], default {}
|
582
|
+
Options passed to the card. The contents depend on the card type.
|
583
|
+
timeout : int, default 45
|
584
|
+
Interrupt reporting if it takes more than this many seconds.
|
585
|
+
|
586
|
+
|
586
587
|
"""
|
587
588
|
...
|
588
589
|
|
589
590
|
@typing.overload
|
590
|
-
def
|
591
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
591
592
|
...
|
592
593
|
|
593
594
|
@typing.overload
|
594
|
-
def
|
595
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
595
596
|
...
|
596
597
|
|
597
|
-
def
|
598
|
+
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):
|
598
599
|
"""
|
599
|
-
|
600
|
-
the execution of a step.
|
600
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
601
601
|
|
602
|
-
|
603
|
-
----------
|
604
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
605
|
-
List of secret specs, defining how the secrets are to be retrieved
|
606
|
-
"""
|
607
|
-
...
|
608
|
-
|
609
|
-
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, hostname_resolution_timeout: int = 600) -> 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]]]:
|
610
|
-
"""
|
611
|
-
Specifies that this step should execute on Kubernetes.
|
602
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
612
603
|
|
613
604
|
Parameters
|
614
605
|
----------
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
used.
|
626
|
-
image : str, optional, default None
|
627
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
628
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
629
|
-
not, a default Docker image mapping to the current version of Python is used.
|
630
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
631
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
632
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
633
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
634
|
-
secrets : List[str], optional, default None
|
635
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
636
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
637
|
-
in Metaflow configuration.
|
638
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
639
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
640
|
-
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
641
|
-
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
642
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
643
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
644
|
-
gpu : int, optional, default None
|
645
|
-
Number of GPUs required for this step. A value of zero implies that
|
646
|
-
the scheduled node should not have GPUs.
|
647
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
648
|
-
The vendor of the GPUs to be used for this step.
|
649
|
-
tolerations : List[str], default []
|
650
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
651
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
652
|
-
use_tmpfs : bool, default False
|
653
|
-
This enables an explicit tmpfs mount for this step.
|
654
|
-
tmpfs_tempdir : bool, default True
|
655
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
656
|
-
tmpfs_size : int, optional, default: None
|
657
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
658
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
659
|
-
memory allocated for this step.
|
660
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
661
|
-
Path to tmpfs mount for this step.
|
662
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
663
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
664
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
665
|
-
shared_memory: int, optional
|
666
|
-
Shared memory size (in MiB) required for this step
|
667
|
-
port: int, optional
|
668
|
-
Port number to specify in the Kubernetes job object
|
669
|
-
compute_pool : str, optional, default None
|
670
|
-
Compute pool to be used for for this step.
|
671
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
672
|
-
hostname_resolution_timeout: int, default 10 * 60
|
673
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
674
|
-
Only applicable when @parallel is used.
|
606
|
+
type : str, default 'default'
|
607
|
+
Card type.
|
608
|
+
id : str, optional, default None
|
609
|
+
If multiple cards are present, use this id to identify this card.
|
610
|
+
options : Dict[str, Any], default {}
|
611
|
+
Options passed to the card. The contents depend on the card type.
|
612
|
+
timeout : int, default 45
|
613
|
+
Interrupt reporting if it takes more than this many seconds.
|
614
|
+
|
615
|
+
|
675
616
|
"""
|
676
617
|
...
|
677
618
|
|
@@ -733,64 +674,7 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
733
674
|
...
|
734
675
|
|
735
676
|
@typing.overload
|
736
|
-
def
|
737
|
-
"""
|
738
|
-
Specifies a timeout for your step.
|
739
|
-
|
740
|
-
This decorator is useful if this step may hang indefinitely.
|
741
|
-
|
742
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
743
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
744
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
745
|
-
|
746
|
-
Note that all the values specified in parameters are added together so if you specify
|
747
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
748
|
-
|
749
|
-
Parameters
|
750
|
-
----------
|
751
|
-
seconds : int, default 0
|
752
|
-
Number of seconds to wait prior to timing out.
|
753
|
-
minutes : int, default 0
|
754
|
-
Number of minutes to wait prior to timing out.
|
755
|
-
hours : int, default 0
|
756
|
-
Number of hours to wait prior to timing out.
|
757
|
-
"""
|
758
|
-
...
|
759
|
-
|
760
|
-
@typing.overload
|
761
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
762
|
-
...
|
763
|
-
|
764
|
-
@typing.overload
|
765
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
766
|
-
...
|
767
|
-
|
768
|
-
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):
|
769
|
-
"""
|
770
|
-
Specifies a timeout for your step.
|
771
|
-
|
772
|
-
This decorator is useful if this step may hang indefinitely.
|
773
|
-
|
774
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
775
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
776
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
777
|
-
|
778
|
-
Note that all the values specified in parameters are added together so if you specify
|
779
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
780
|
-
|
781
|
-
Parameters
|
782
|
-
----------
|
783
|
-
seconds : int, default 0
|
784
|
-
Number of seconds to wait prior to timing out.
|
785
|
-
minutes : int, default 0
|
786
|
-
Number of minutes to wait prior to timing out.
|
787
|
-
hours : int, default 0
|
788
|
-
Number of hours to wait prior to timing out.
|
789
|
-
"""
|
790
|
-
...
|
791
|
-
|
792
|
-
@typing.overload
|
793
|
-
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]]]:
|
677
|
+
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]]]:
|
794
678
|
"""
|
795
679
|
Specifies the resources needed when executing this step.
|
796
680
|
|
@@ -812,7 +696,7 @@ def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None,
|
|
812
696
|
----------
|
813
697
|
cpu : int, default 1
|
814
698
|
Number of CPUs required for this step.
|
815
|
-
gpu : int, default
|
699
|
+
gpu : int, optional, default None
|
816
700
|
Number of GPUs required for this step.
|
817
701
|
disk : int, optional, default None
|
818
702
|
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
@@ -832,7 +716,7 @@ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.C
|
|
832
716
|
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
833
717
|
...
|
834
718
|
|
835
|
-
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int =
|
719
|
+
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):
|
836
720
|
"""
|
837
721
|
Specifies the resources needed when executing this step.
|
838
722
|
|
@@ -854,7 +738,7 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
854
738
|
----------
|
855
739
|
cpu : int, default 1
|
856
740
|
Number of CPUs required for this step.
|
857
|
-
gpu : int, default
|
741
|
+
gpu : int, optional, default None
|
858
742
|
Number of GPUs required for this step.
|
859
743
|
disk : int, optional, default None
|
860
744
|
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
@@ -884,152 +768,257 @@ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepF
|
|
884
768
|
...
|
885
769
|
|
886
770
|
@typing.overload
|
887
|
-
def
|
771
|
+
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]]]:
|
888
772
|
"""
|
889
|
-
Specifies
|
773
|
+
Specifies a timeout for your step.
|
890
774
|
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
775
|
+
This decorator is useful if this step may hang indefinitely.
|
776
|
+
|
777
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
778
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
779
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
780
|
+
|
781
|
+
Note that all the values specified in parameters are added together so if you specify
|
782
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
895
783
|
|
896
784
|
Parameters
|
897
785
|
----------
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
786
|
+
seconds : int, default 0
|
787
|
+
Number of seconds to wait prior to timing out.
|
788
|
+
minutes : int, default 0
|
789
|
+
Number of minutes to wait prior to timing out.
|
790
|
+
hours : int, default 0
|
791
|
+
Number of hours to wait prior to timing out.
|
904
792
|
"""
|
905
793
|
...
|
906
794
|
|
907
795
|
@typing.overload
|
908
|
-
def
|
796
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
909
797
|
...
|
910
798
|
|
911
799
|
@typing.overload
|
912
|
-
def
|
800
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
913
801
|
...
|
914
802
|
|
915
|
-
def
|
803
|
+
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):
|
916
804
|
"""
|
917
|
-
Specifies
|
805
|
+
Specifies a timeout for your step.
|
918
806
|
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
807
|
+
This decorator is useful if this step may hang indefinitely.
|
808
|
+
|
809
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
810
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
811
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
812
|
+
|
813
|
+
Note that all the values specified in parameters are added together so if you specify
|
814
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
923
815
|
|
924
816
|
Parameters
|
925
817
|
----------
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
818
|
+
seconds : int, default 0
|
819
|
+
Number of seconds to wait prior to timing out.
|
820
|
+
minutes : int, default 0
|
821
|
+
Number of minutes to wait prior to timing out.
|
822
|
+
hours : int, default 0
|
823
|
+
Number of hours to wait prior to timing out.
|
932
824
|
"""
|
933
825
|
...
|
934
826
|
|
935
827
|
@typing.overload
|
936
|
-
def
|
828
|
+
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]]]:
|
937
829
|
"""
|
938
|
-
|
830
|
+
Enables loading / saving of models within a step.
|
939
831
|
|
940
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
941
832
|
|
942
833
|
Parameters
|
943
834
|
----------
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
835
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
836
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
837
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
838
|
+
- `current.checkpoint`
|
839
|
+
- `current.model`
|
840
|
+
- `current.huggingface_hub`
|
841
|
+
|
842
|
+
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
|
843
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
844
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
845
|
+
|
846
|
+
temp_dir_root : str, default: None
|
847
|
+
The root directory under which `current.model.loaded` will store loaded models
|
848
|
+
|
952
849
|
|
953
850
|
|
954
851
|
"""
|
955
852
|
...
|
956
853
|
|
957
854
|
@typing.overload
|
958
|
-
def
|
855
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
959
856
|
...
|
960
857
|
|
961
858
|
@typing.overload
|
962
|
-
def
|
859
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
963
860
|
...
|
964
861
|
|
965
|
-
def
|
862
|
+
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):
|
966
863
|
"""
|
967
|
-
|
864
|
+
Enables loading / saving of models within a step.
|
968
865
|
|
969
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
970
866
|
|
971
867
|
Parameters
|
972
868
|
----------
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
869
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
870
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
871
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
872
|
+
- `current.checkpoint`
|
873
|
+
- `current.model`
|
874
|
+
- `current.huggingface_hub`
|
875
|
+
|
876
|
+
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
|
877
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
878
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
879
|
+
|
880
|
+
temp_dir_root : str, default: None
|
881
|
+
The root directory under which `current.model.loaded` will store loaded models
|
882
|
+
|
981
883
|
|
982
884
|
|
983
885
|
"""
|
984
886
|
...
|
985
887
|
|
986
888
|
@typing.overload
|
987
|
-
def
|
889
|
+
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]]]:
|
988
890
|
"""
|
989
|
-
|
990
|
-
|
891
|
+
Specifies that the step will success under all circumstances.
|
892
|
+
|
893
|
+
The decorator will create an optional artifact, specified by `var`, which
|
894
|
+
contains the exception raised. You can use it to detect the presence
|
895
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
896
|
+
are missing.
|
897
|
+
|
898
|
+
Parameters
|
899
|
+
----------
|
900
|
+
var : str, optional, default None
|
901
|
+
Name of the artifact in which to store the caught exception.
|
902
|
+
If not specified, the exception is not stored.
|
903
|
+
print_exception : bool, default True
|
904
|
+
Determines whether or not the exception is printed to
|
905
|
+
stdout when caught.
|
991
906
|
"""
|
992
907
|
...
|
993
908
|
|
994
909
|
@typing.overload
|
995
|
-
def
|
910
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
996
911
|
...
|
997
912
|
|
998
|
-
|
999
|
-
|
1000
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1001
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1002
|
-
"""
|
913
|
+
@typing.overload
|
914
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1003
915
|
...
|
1004
916
|
|
1005
|
-
|
1006
|
-
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]]]:
|
917
|
+
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):
|
1007
918
|
"""
|
1008
|
-
Specifies
|
919
|
+
Specifies that the step will success under all circumstances.
|
920
|
+
|
921
|
+
The decorator will create an optional artifact, specified by `var`, which
|
922
|
+
contains the exception raised. You can use it to detect the presence
|
923
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
924
|
+
are missing.
|
1009
925
|
|
1010
926
|
Parameters
|
1011
927
|
----------
|
1012
|
-
|
1013
|
-
|
928
|
+
var : str, optional, default None
|
929
|
+
Name of the artifact in which to store the caught exception.
|
930
|
+
If not specified, the exception is not stored.
|
931
|
+
print_exception : bool, default True
|
932
|
+
Determines whether or not the exception is printed to
|
933
|
+
stdout when caught.
|
1014
934
|
"""
|
1015
935
|
...
|
1016
936
|
|
1017
937
|
@typing.overload
|
1018
|
-
def
|
938
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
939
|
+
"""
|
940
|
+
Decorator prototype for all step decorators. This function gets specialized
|
941
|
+
and imported for all decorators types by _import_plugin_decorators().
|
942
|
+
"""
|
1019
943
|
...
|
1020
944
|
|
1021
945
|
@typing.overload
|
1022
|
-
def
|
946
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1023
947
|
...
|
1024
948
|
|
1025
|
-
def
|
949
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1026
950
|
"""
|
1027
|
-
|
951
|
+
Decorator prototype for all step decorators. This function gets specialized
|
952
|
+
and imported for all decorators types by _import_plugin_decorators().
|
953
|
+
"""
|
954
|
+
...
|
955
|
+
|
956
|
+
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, hostname_resolution_timeout: int = 600) -> 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]]]:
|
957
|
+
"""
|
958
|
+
Specifies that this step should execute on Kubernetes.
|
1028
959
|
|
1029
960
|
Parameters
|
1030
961
|
----------
|
1031
|
-
|
1032
|
-
|
962
|
+
cpu : int, default 1
|
963
|
+
Number of CPUs required for this step. If `@resources` is
|
964
|
+
also present, the maximum value from all decorators is used.
|
965
|
+
memory : int, default 4096
|
966
|
+
Memory size (in MB) required for this step. If
|
967
|
+
`@resources` is also present, the maximum value from all decorators is
|
968
|
+
used.
|
969
|
+
disk : int, default 10240
|
970
|
+
Disk size (in MB) required for this step. If
|
971
|
+
`@resources` is also present, the maximum value from all decorators is
|
972
|
+
used.
|
973
|
+
image : str, optional, default None
|
974
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
975
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
976
|
+
not, a default Docker image mapping to the current version of Python is used.
|
977
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
978
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
979
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
980
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
981
|
+
secrets : List[str], optional, default None
|
982
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
983
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
984
|
+
in Metaflow configuration.
|
985
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
986
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
987
|
+
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
988
|
+
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
989
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
990
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
991
|
+
gpu : int, optional, default None
|
992
|
+
Number of GPUs required for this step. A value of zero implies that
|
993
|
+
the scheduled node should not have GPUs.
|
994
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
995
|
+
The vendor of the GPUs to be used for this step.
|
996
|
+
tolerations : List[str], default []
|
997
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
998
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
999
|
+
use_tmpfs : bool, default False
|
1000
|
+
This enables an explicit tmpfs mount for this step.
|
1001
|
+
tmpfs_tempdir : bool, default True
|
1002
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1003
|
+
tmpfs_size : int, optional, default: None
|
1004
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1005
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1006
|
+
memory allocated for this step.
|
1007
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
1008
|
+
Path to tmpfs mount for this step.
|
1009
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
1010
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1011
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1012
|
+
shared_memory: int, optional
|
1013
|
+
Shared memory size (in MiB) required for this step
|
1014
|
+
port: int, optional
|
1015
|
+
Port number to specify in the Kubernetes job object
|
1016
|
+
compute_pool : str, optional, default None
|
1017
|
+
Compute pool to be used for for this step.
|
1018
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
1019
|
+
hostname_resolution_timeout: int, default 10 * 60
|
1020
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
1021
|
+
Only applicable when @parallel is used.
|
1033
1022
|
"""
|
1034
1023
|
...
|
1035
1024
|
|
@@ -1096,162 +1085,169 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None) -> typing.Cal
|
|
1096
1085
|
...
|
1097
1086
|
|
1098
1087
|
@typing.overload
|
1099
|
-
def
|
1088
|
+
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]]]:
|
1100
1089
|
"""
|
1101
|
-
|
1102
|
-
to a step needs to be retried.
|
1103
|
-
|
1104
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1105
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1106
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1090
|
+
Enables checkpointing for a step.
|
1107
1091
|
|
1108
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1109
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1110
|
-
ensuring that the flow execution can continue.
|
1111
1092
|
|
1112
1093
|
Parameters
|
1113
1094
|
----------
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1095
|
+
load_policy : str, default: "fresh"
|
1096
|
+
The policy for loading the checkpoint. The following policies are supported:
|
1097
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
1098
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
1099
|
+
will be loaded at the start of the task.
|
1100
|
+
- "none": Do not load any checkpoint
|
1101
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
1102
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
1103
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
1104
|
+
created within the task will be loaded when the task is retries execution on failure.
|
1105
|
+
|
1106
|
+
temp_dir_root : str, default: None
|
1107
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
1108
|
+
|
1109
|
+
|
1110
|
+
|
1111
|
+
"""
|
1119
1112
|
...
|
1120
1113
|
|
1121
1114
|
@typing.overload
|
1122
|
-
def
|
1115
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1123
1116
|
...
|
1124
1117
|
|
1125
1118
|
@typing.overload
|
1126
|
-
def
|
1119
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1127
1120
|
...
|
1128
1121
|
|
1129
|
-
def
|
1122
|
+
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):
|
1130
1123
|
"""
|
1131
|
-
|
1132
|
-
to a step needs to be retried.
|
1133
|
-
|
1134
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1135
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1136
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1124
|
+
Enables checkpointing for a step.
|
1137
1125
|
|
1138
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1139
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1140
|
-
ensuring that the flow execution can continue.
|
1141
1126
|
|
1142
1127
|
Parameters
|
1143
1128
|
----------
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1129
|
+
load_policy : str, default: "fresh"
|
1130
|
+
The policy for loading the checkpoint. The following policies are supported:
|
1131
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
1132
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
1133
|
+
will be loaded at the start of the task.
|
1134
|
+
- "none": Do not load any checkpoint
|
1135
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
1136
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
1137
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
1138
|
+
created within the task will be loaded when the task is retries execution on failure.
|
1139
|
+
|
1140
|
+
temp_dir_root : str, default: None
|
1141
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
1142
|
+
|
1143
|
+
|
1144
|
+
|
1148
1145
|
"""
|
1149
1146
|
...
|
1150
1147
|
|
1151
1148
|
@typing.overload
|
1152
|
-
def
|
1149
|
+
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]]]:
|
1153
1150
|
"""
|
1154
|
-
|
1155
|
-
|
1151
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1152
|
+
the execution of a step.
|
1156
1153
|
|
1157
1154
|
Parameters
|
1158
1155
|
----------
|
1159
|
-
|
1160
|
-
|
1161
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
1162
|
-
- `current.checkpoint`
|
1163
|
-
- `current.model`
|
1164
|
-
- `current.huggingface_hub`
|
1165
|
-
|
1166
|
-
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
|
1167
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
1168
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
1169
|
-
|
1170
|
-
temp_dir_root : str, default: None
|
1171
|
-
The root directory under which `current.model.loaded` will store loaded models
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1156
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1157
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1175
1158
|
"""
|
1176
1159
|
...
|
1177
1160
|
|
1178
1161
|
@typing.overload
|
1179
|
-
def
|
1162
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1180
1163
|
...
|
1181
1164
|
|
1182
1165
|
@typing.overload
|
1183
|
-
def
|
1166
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1184
1167
|
...
|
1185
1168
|
|
1186
|
-
def
|
1169
|
+
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]]] = []):
|
1187
1170
|
"""
|
1188
|
-
|
1189
|
-
|
1171
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1172
|
+
the execution of a step.
|
1190
1173
|
|
1191
1174
|
Parameters
|
1192
1175
|
----------
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
1203
|
-
|
1204
|
-
temp_dir_root : str, default: None
|
1205
|
-
The root directory under which `current.model.loaded` will store loaded models
|
1206
|
-
|
1176
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1177
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1178
|
+
"""
|
1179
|
+
...
|
1180
|
+
|
1181
|
+
@typing.overload
|
1182
|
+
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]]]:
|
1183
|
+
"""
|
1184
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1207
1185
|
|
1186
|
+
Parameters
|
1187
|
+
----------
|
1188
|
+
vars : Dict[str, str], default {}
|
1189
|
+
Dictionary of environment variables to set.
|
1190
|
+
"""
|
1191
|
+
...
|
1192
|
+
|
1193
|
+
@typing.overload
|
1194
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1195
|
+
...
|
1196
|
+
|
1197
|
+
@typing.overload
|
1198
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1199
|
+
...
|
1200
|
+
|
1201
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1202
|
+
"""
|
1203
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1208
1204
|
|
1205
|
+
Parameters
|
1206
|
+
----------
|
1207
|
+
vars : Dict[str, str], default {}
|
1208
|
+
Dictionary of environment variables to set.
|
1209
1209
|
"""
|
1210
1210
|
...
|
1211
1211
|
|
1212
1212
|
@typing.overload
|
1213
|
-
def
|
1213
|
+
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]]:
|
1214
1214
|
"""
|
1215
|
-
Specifies the
|
1215
|
+
Specifies the event(s) that this flow depends on.
|
1216
1216
|
|
1217
1217
|
```
|
1218
|
-
@
|
1218
|
+
@trigger(event='foo')
|
1219
1219
|
```
|
1220
1220
|
or
|
1221
1221
|
```
|
1222
|
-
@
|
1222
|
+
@trigger(events=['foo', 'bar'])
|
1223
1223
|
```
|
1224
|
-
This decorator respects the @project decorator and triggers the flow
|
1225
|
-
when upstream runs within the same namespace complete successfully
|
1226
1224
|
|
1227
|
-
Additionally, you can specify
|
1228
|
-
|
1225
|
+
Additionally, you can specify the parameter mappings
|
1226
|
+
to map event payload to Metaflow parameters for the flow.
|
1229
1227
|
```
|
1230
|
-
@
|
1228
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1231
1229
|
```
|
1232
1230
|
or
|
1233
1231
|
```
|
1234
|
-
@
|
1232
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1233
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1235
1234
|
```
|
1236
1235
|
|
1237
|
-
|
1238
|
-
inferred from the current project or project branch):
|
1236
|
+
'parameters' can also be a list of strings and tuples like so:
|
1239
1237
|
```
|
1240
|
-
@
|
1238
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1239
|
+
```
|
1240
|
+
This is equivalent to:
|
1241
|
+
```
|
1242
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1241
1243
|
```
|
1242
|
-
|
1243
|
-
Note that `branch` is typically one of:
|
1244
|
-
- `prod`
|
1245
|
-
- `user.bob`
|
1246
|
-
- `test.my_experiment`
|
1247
|
-
- `prod.staging`
|
1248
1244
|
|
1249
1245
|
Parameters
|
1250
1246
|
----------
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1247
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1248
|
+
Event dependency for this flow.
|
1249
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1250
|
+
Events dependency for this flow.
|
1255
1251
|
options : Dict[str, Any], default {}
|
1256
1252
|
Backend-specific configuration for tuning eventing behavior.
|
1257
1253
|
|
@@ -1260,51 +1256,47 @@ def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] =
|
|
1260
1256
|
...
|
1261
1257
|
|
1262
1258
|
@typing.overload
|
1263
|
-
def
|
1259
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1264
1260
|
...
|
1265
1261
|
|
1266
|
-
def
|
1262
|
+
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] = {}):
|
1267
1263
|
"""
|
1268
|
-
Specifies the
|
1264
|
+
Specifies the event(s) that this flow depends on.
|
1269
1265
|
|
1270
1266
|
```
|
1271
|
-
@
|
1267
|
+
@trigger(event='foo')
|
1272
1268
|
```
|
1273
1269
|
or
|
1274
1270
|
```
|
1275
|
-
@
|
1271
|
+
@trigger(events=['foo', 'bar'])
|
1276
1272
|
```
|
1277
|
-
This decorator respects the @project decorator and triggers the flow
|
1278
|
-
when upstream runs within the same namespace complete successfully
|
1279
1273
|
|
1280
|
-
Additionally, you can specify
|
1281
|
-
|
1274
|
+
Additionally, you can specify the parameter mappings
|
1275
|
+
to map event payload to Metaflow parameters for the flow.
|
1282
1276
|
```
|
1283
|
-
@
|
1277
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1284
1278
|
```
|
1285
1279
|
or
|
1286
1280
|
```
|
1287
|
-
@
|
1281
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1282
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1288
1283
|
```
|
1289
1284
|
|
1290
|
-
|
1291
|
-
inferred from the current project or project branch):
|
1285
|
+
'parameters' can also be a list of strings and tuples like so:
|
1292
1286
|
```
|
1293
|
-
@
|
1287
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1288
|
+
```
|
1289
|
+
This is equivalent to:
|
1290
|
+
```
|
1291
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1294
1292
|
```
|
1295
|
-
|
1296
|
-
Note that `branch` is typically one of:
|
1297
|
-
- `prod`
|
1298
|
-
- `user.bob`
|
1299
|
-
- `test.my_experiment`
|
1300
|
-
- `prod.staging`
|
1301
1293
|
|
1302
1294
|
Parameters
|
1303
1295
|
----------
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1296
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1297
|
+
Event dependency for this flow.
|
1298
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1299
|
+
Events dependency for this flow.
|
1308
1300
|
options : Dict[str, Any], default {}
|
1309
1301
|
Backend-specific configuration for tuning eventing behavior.
|
1310
1302
|
|
@@ -1312,52 +1304,45 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1312
1304
|
"""
|
1313
1305
|
...
|
1314
1306
|
|
1315
|
-
def
|
1316
|
-
"""
|
1317
|
-
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1318
|
-
|
1319
|
-
User code call
|
1320
|
-
-----------
|
1321
|
-
@nim(
|
1322
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1323
|
-
backend='managed'
|
1324
|
-
)
|
1325
|
-
|
1326
|
-
Valid backend options
|
1327
|
-
---------------------
|
1328
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
1329
|
-
- 🚧 'dataplane': Run in your account.
|
1330
|
-
|
1331
|
-
Valid model options
|
1332
|
-
----------------
|
1333
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
1334
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
1335
|
-
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1336
|
-
|
1337
|
-
Parameters
|
1338
|
-
----------
|
1339
|
-
models: list[NIM]
|
1340
|
-
List of NIM containers running models in sidecars.
|
1341
|
-
backend: str
|
1342
|
-
Compute provider to run the NIM container.
|
1343
|
-
"""
|
1344
|
-
...
|
1345
|
-
|
1346
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1307
|
+
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1347
1308
|
"""
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1309
|
+
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1310
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1311
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1312
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1313
|
+
starts only after all sensors finish.
|
1352
1314
|
|
1353
1315
|
Parameters
|
1354
1316
|
----------
|
1317
|
+
timeout : int
|
1318
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1319
|
+
poke_interval : int
|
1320
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1321
|
+
mode : str
|
1322
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1323
|
+
exponential_backoff : bool
|
1324
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1325
|
+
pool : str
|
1326
|
+
the slot pool this task should run in,
|
1327
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1328
|
+
soft_fail : bool
|
1329
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1355
1330
|
name : str
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1331
|
+
Name of the sensor on Airflow
|
1332
|
+
description : str
|
1333
|
+
Description of sensor in the Airflow UI
|
1334
|
+
bucket_key : Union[str, List[str]]
|
1335
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1336
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1337
|
+
bucket_name : str
|
1338
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1339
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1340
|
+
wildcard_match : bool
|
1341
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1342
|
+
aws_conn_id : str
|
1343
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1344
|
+
verify : bool
|
1345
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1361
1346
|
"""
|
1362
1347
|
...
|
1363
1348
|
|
@@ -1403,52 +1388,124 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1403
1388
|
"""
|
1404
1389
|
...
|
1405
1390
|
|
1391
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1392
|
+
"""
|
1393
|
+
Specifies what flows belong to the same project.
|
1394
|
+
|
1395
|
+
A project-specific namespace is created for all flows that
|
1396
|
+
use the same `@project(name)`.
|
1397
|
+
|
1398
|
+
Parameters
|
1399
|
+
----------
|
1400
|
+
name : str
|
1401
|
+
Project name. Make sure that the name is unique amongst all
|
1402
|
+
projects that use the same production scheduler. The name may
|
1403
|
+
contain only lowercase alphanumeric characters and underscores.
|
1404
|
+
|
1405
|
+
|
1406
|
+
"""
|
1407
|
+
...
|
1408
|
+
|
1406
1409
|
@typing.overload
|
1407
|
-
def
|
1410
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1408
1411
|
"""
|
1409
|
-
Specifies the
|
1412
|
+
Specifies the flow(s) that this flow depends on.
|
1410
1413
|
|
1411
|
-
|
1412
|
-
|
1414
|
+
```
|
1415
|
+
@trigger_on_finish(flow='FooFlow')
|
1416
|
+
```
|
1417
|
+
or
|
1418
|
+
```
|
1419
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1420
|
+
```
|
1421
|
+
This decorator respects the @project decorator and triggers the flow
|
1422
|
+
when upstream runs within the same namespace complete successfully
|
1423
|
+
|
1424
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1425
|
+
by specifying the fully qualified project_flow_name.
|
1426
|
+
```
|
1427
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1428
|
+
```
|
1429
|
+
or
|
1430
|
+
```
|
1431
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1432
|
+
```
|
1433
|
+
|
1434
|
+
You can also specify just the project or project branch (other values will be
|
1435
|
+
inferred from the current project or project branch):
|
1436
|
+
```
|
1437
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1438
|
+
```
|
1439
|
+
|
1440
|
+
Note that `branch` is typically one of:
|
1441
|
+
- `prod`
|
1442
|
+
- `user.bob`
|
1443
|
+
- `test.my_experiment`
|
1444
|
+
- `prod.staging`
|
1413
1445
|
|
1414
1446
|
Parameters
|
1415
1447
|
----------
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
disabled : bool, default False
|
1425
|
-
If set to True, disables Conda.
|
1448
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1449
|
+
Upstream flow dependency for this flow.
|
1450
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1451
|
+
Upstream flow dependencies for this flow.
|
1452
|
+
options : Dict[str, Any], default {}
|
1453
|
+
Backend-specific configuration for tuning eventing behavior.
|
1454
|
+
|
1455
|
+
|
1426
1456
|
"""
|
1427
1457
|
...
|
1428
1458
|
|
1429
1459
|
@typing.overload
|
1430
|
-
def
|
1460
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1431
1461
|
...
|
1432
1462
|
|
1433
|
-
def
|
1463
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1434
1464
|
"""
|
1435
|
-
Specifies the
|
1465
|
+
Specifies the flow(s) that this flow depends on.
|
1436
1466
|
|
1437
|
-
|
1438
|
-
|
1467
|
+
```
|
1468
|
+
@trigger_on_finish(flow='FooFlow')
|
1469
|
+
```
|
1470
|
+
or
|
1471
|
+
```
|
1472
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1473
|
+
```
|
1474
|
+
This decorator respects the @project decorator and triggers the flow
|
1475
|
+
when upstream runs within the same namespace complete successfully
|
1476
|
+
|
1477
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1478
|
+
by specifying the fully qualified project_flow_name.
|
1479
|
+
```
|
1480
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1481
|
+
```
|
1482
|
+
or
|
1483
|
+
```
|
1484
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1485
|
+
```
|
1486
|
+
|
1487
|
+
You can also specify just the project or project branch (other values will be
|
1488
|
+
inferred from the current project or project branch):
|
1489
|
+
```
|
1490
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1491
|
+
```
|
1492
|
+
|
1493
|
+
Note that `branch` is typically one of:
|
1494
|
+
- `prod`
|
1495
|
+
- `user.bob`
|
1496
|
+
- `test.my_experiment`
|
1497
|
+
- `prod.staging`
|
1439
1498
|
|
1440
1499
|
Parameters
|
1441
1500
|
----------
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
disabled : bool, default False
|
1451
|
-
If set to True, disables Conda.
|
1501
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1502
|
+
Upstream flow dependency for this flow.
|
1503
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1504
|
+
Upstream flow dependencies for this flow.
|
1505
|
+
options : Dict[str, Any], default {}
|
1506
|
+
Backend-specific configuration for tuning eventing behavior.
|
1507
|
+
|
1508
|
+
|
1452
1509
|
"""
|
1453
1510
|
...
|
1454
1511
|
|
@@ -1502,178 +1559,121 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1502
1559
|
...
|
1503
1560
|
|
1504
1561
|
@typing.overload
|
1505
|
-
def
|
1562
|
+
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]]:
|
1506
1563
|
"""
|
1507
|
-
Specifies the
|
1564
|
+
Specifies the Conda environment for all steps of the flow.
|
1565
|
+
|
1566
|
+
Use `@conda_base` to set common libraries required by all
|
1567
|
+
steps and use `@conda` to specify step-specific additions.
|
1508
1568
|
|
1509
|
-
Use `@pypi_base` to set common packages required by all
|
1510
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1511
1569
|
Parameters
|
1512
1570
|
----------
|
1513
|
-
packages : Dict[str, str], default
|
1571
|
+
packages : Dict[str, str], default {}
|
1514
1572
|
Packages to use for this flow. The key is the name of the package
|
1515
1573
|
and the value is the version to use.
|
1516
|
-
|
1574
|
+
libraries : Dict[str, str], default {}
|
1575
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1576
|
+
python : str, optional, default None
|
1517
1577
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1518
1578
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1579
|
+
disabled : bool, default False
|
1580
|
+
If set to True, disables Conda.
|
1519
1581
|
"""
|
1520
1582
|
...
|
1521
1583
|
|
1522
1584
|
@typing.overload
|
1523
|
-
def
|
1585
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1524
1586
|
...
|
1525
1587
|
|
1526
|
-
def
|
1588
|
+
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):
|
1527
1589
|
"""
|
1528
|
-
Specifies the
|
1590
|
+
Specifies the Conda environment for all steps of the flow.
|
1591
|
+
|
1592
|
+
Use `@conda_base` to set common libraries required by all
|
1593
|
+
steps and use `@conda` to specify step-specific additions.
|
1529
1594
|
|
1530
|
-
Use `@pypi_base` to set common packages required by all
|
1531
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1532
1595
|
Parameters
|
1533
1596
|
----------
|
1534
|
-
packages : Dict[str, str], default
|
1597
|
+
packages : Dict[str, str], default {}
|
1535
1598
|
Packages to use for this flow. The key is the name of the package
|
1536
1599
|
and the value is the version to use.
|
1537
|
-
|
1600
|
+
libraries : Dict[str, str], default {}
|
1601
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1602
|
+
python : str, optional, default None
|
1538
1603
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1539
1604
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1605
|
+
disabled : bool, default False
|
1606
|
+
If set to True, disables Conda.
|
1540
1607
|
"""
|
1541
1608
|
...
|
1542
1609
|
|
1543
|
-
|
1610
|
+
@typing.overload
|
1611
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1544
1612
|
"""
|
1545
|
-
|
1546
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1547
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1548
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1549
|
-
starts only after all sensors finish.
|
1613
|
+
Specifies the PyPI packages for all steps of the flow.
|
1550
1614
|
|
1615
|
+
Use `@pypi_base` to set common packages required by all
|
1616
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1551
1617
|
Parameters
|
1552
1618
|
----------
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
exponential_backoff : bool
|
1560
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1561
|
-
pool : str
|
1562
|
-
the slot pool this task should run in,
|
1563
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1564
|
-
soft_fail : bool
|
1565
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1566
|
-
name : str
|
1567
|
-
Name of the sensor on Airflow
|
1568
|
-
description : str
|
1569
|
-
Description of sensor in the Airflow UI
|
1570
|
-
bucket_key : Union[str, List[str]]
|
1571
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1572
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1573
|
-
bucket_name : str
|
1574
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1575
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1576
|
-
wildcard_match : bool
|
1577
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1578
|
-
aws_conn_id : str
|
1579
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1580
|
-
verify : bool
|
1581
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1619
|
+
packages : Dict[str, str], default: {}
|
1620
|
+
Packages to use for this flow. The key is the name of the package
|
1621
|
+
and the value is the version to use.
|
1622
|
+
python : str, optional, default: None
|
1623
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1624
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1582
1625
|
"""
|
1583
1626
|
...
|
1584
1627
|
|
1585
1628
|
@typing.overload
|
1586
|
-
def
|
1629
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1630
|
+
...
|
1631
|
+
|
1632
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1587
1633
|
"""
|
1588
|
-
Specifies the
|
1589
|
-
|
1590
|
-
```
|
1591
|
-
@trigger(event='foo')
|
1592
|
-
```
|
1593
|
-
or
|
1594
|
-
```
|
1595
|
-
@trigger(events=['foo', 'bar'])
|
1596
|
-
```
|
1597
|
-
|
1598
|
-
Additionally, you can specify the parameter mappings
|
1599
|
-
to map event payload to Metaflow parameters for the flow.
|
1600
|
-
```
|
1601
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1602
|
-
```
|
1603
|
-
or
|
1604
|
-
```
|
1605
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1606
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1607
|
-
```
|
1608
|
-
|
1609
|
-
'parameters' can also be a list of strings and tuples like so:
|
1610
|
-
```
|
1611
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1612
|
-
```
|
1613
|
-
This is equivalent to:
|
1614
|
-
```
|
1615
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1616
|
-
```
|
1634
|
+
Specifies the PyPI packages for all steps of the flow.
|
1617
1635
|
|
1636
|
+
Use `@pypi_base` to set common packages required by all
|
1637
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1618
1638
|
Parameters
|
1619
1639
|
----------
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1640
|
+
packages : Dict[str, str], default: {}
|
1641
|
+
Packages to use for this flow. The key is the name of the package
|
1642
|
+
and the value is the version to use.
|
1643
|
+
python : str, optional, default: None
|
1644
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1645
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1628
1646
|
"""
|
1629
1647
|
...
|
1630
1648
|
|
1631
|
-
|
1632
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1633
|
-
...
|
1634
|
-
|
1635
|
-
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] = {}):
|
1649
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1636
1650
|
"""
|
1637
|
-
|
1651
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1638
1652
|
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
```
|
1653
|
+
User code call
|
1654
|
+
-----------
|
1655
|
+
@nim(
|
1656
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1657
|
+
backend='managed'
|
1658
|
+
)
|
1646
1659
|
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
```
|
1652
|
-
or
|
1653
|
-
```
|
1654
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1655
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1656
|
-
```
|
1660
|
+
Valid backend options
|
1661
|
+
---------------------
|
1662
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1663
|
+
- 🚧 'dataplane': Run in your account.
|
1657
1664
|
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
```
|
1664
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1665
|
-
```
|
1665
|
+
Valid model options
|
1666
|
+
----------------
|
1667
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1668
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1669
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1666
1670
|
|
1667
1671
|
Parameters
|
1668
1672
|
----------
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
options : Dict[str, Any], default {}
|
1674
|
-
Backend-specific configuration for tuning eventing behavior.
|
1675
|
-
|
1676
|
-
|
1673
|
+
models: list[NIM]
|
1674
|
+
List of NIM containers running models in sidecars.
|
1675
|
+
backend: str
|
1676
|
+
Compute provider to run the NIM container.
|
1677
1677
|
"""
|
1678
1678
|
...
|
1679
1679
|
|
@@ -1768,7 +1768,7 @@ class Metaflow(object, metaclass=type):
|
|
1768
1768
|
flows present in the current namespace will be returned. A `Flow` is present in a namespace
|
1769
1769
|
if it has at least one run in the namespace.
|
1770
1770
|
"""
|
1771
|
-
def __init__(self):
|
1771
|
+
def __init__(self, _current_metadata: typing.Optional[str] = None):
|
1772
1772
|
...
|
1773
1773
|
@property
|
1774
1774
|
def flows(self) -> typing.List[metaflow.client.core.Flow]:
|