ob-metaflow-stubs 5.6__py2.py3-none-any.whl → 5.7__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +562 -562
- metaflow-stubs/cards.pyi +6 -6
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +4 -4
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +4 -2
- metaflow-stubs/metaflow_current.pyi +35 -35
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
- 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 +7 -5
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
- 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 +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/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 +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
- 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 +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
- 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/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 +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- 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 +2 -2
- 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 -5
- 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 +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- 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-5.6.dist-info → ob_metaflow_stubs-5.7.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-5.7.dist-info/RECORD +138 -0
- ob_metaflow_stubs-5.6.dist-info/RECORD +0 -138
- {ob_metaflow_stubs-5.6.dist-info → ob_metaflow_stubs-5.7.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-5.6.dist-info → ob_metaflow_stubs-5.7.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.18.
|
4
|
-
# Generated on 2024-08-
|
3
|
+
# MF version: 2.12.18.2+ob(v1) #
|
4
|
+
# Generated on 2024-08-29T15:44:09.902207 #
|
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.datastore.inputs
|
13
|
+
import metaflow.plugins.datatools.s3.s3
|
13
14
|
import metaflow.flowspec
|
14
15
|
import io
|
15
|
-
import metaflow.client.core
|
16
|
-
import metaflow.plugins.datatools.s3.s3
|
17
16
|
import typing
|
18
|
-
import metaflow.metaflow_current
|
19
|
-
import metaflow._vendor.click.types
|
20
|
-
import metaflow.events
|
21
|
-
import datetime
|
22
17
|
import metaflow.runner.metaflow_runner
|
18
|
+
import datetime
|
19
|
+
import metaflow.client.core
|
20
|
+
import metaflow.events
|
21
|
+
import metaflow._vendor.click.types
|
22
|
+
import metaflow.parameters
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -727,25 +727,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
727
727
|
"""
|
728
728
|
...
|
729
729
|
|
730
|
-
@typing.overload
|
731
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
732
|
-
"""
|
733
|
-
Decorator prototype for all step decorators. This function gets specialized
|
734
|
-
and imported for all decorators types by _import_plugin_decorators().
|
735
|
-
"""
|
736
|
-
...
|
737
|
-
|
738
|
-
@typing.overload
|
739
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
740
|
-
...
|
741
|
-
|
742
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
743
|
-
"""
|
744
|
-
Decorator prototype for all step decorators. This function gets specialized
|
745
|
-
and imported for all decorators types by _import_plugin_decorators().
|
746
|
-
"""
|
747
|
-
...
|
748
|
-
|
749
730
|
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, 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]]]:
|
750
731
|
"""
|
751
732
|
Specifies that this step should execute on Kubernetes.
|
@@ -809,184 +790,53 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
809
790
|
...
|
810
791
|
|
811
792
|
@typing.overload
|
812
|
-
def
|
813
|
-
"""
|
814
|
-
Specifies the PyPI packages for the step.
|
815
|
-
|
816
|
-
Information in this decorator will augment any
|
817
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
818
|
-
you can use `@pypi_base` to set packages required by all
|
819
|
-
steps and use `@pypi` to specify step-specific overrides.
|
820
|
-
|
821
|
-
Parameters
|
822
|
-
----------
|
823
|
-
packages : Dict[str, str], default: {}
|
824
|
-
Packages to use for this step. The key is the name of the package
|
825
|
-
and the value is the version to use.
|
826
|
-
python : str, optional, default: None
|
827
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
828
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
829
|
-
"""
|
830
|
-
...
|
831
|
-
|
832
|
-
@typing.overload
|
833
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
834
|
-
...
|
835
|
-
|
836
|
-
@typing.overload
|
837
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
838
|
-
...
|
839
|
-
|
840
|
-
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):
|
841
|
-
"""
|
842
|
-
Specifies the PyPI packages for the step.
|
843
|
-
|
844
|
-
Information in this decorator will augment any
|
845
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
846
|
-
you can use `@pypi_base` to set packages required by all
|
847
|
-
steps and use `@pypi` to specify step-specific overrides.
|
848
|
-
|
849
|
-
Parameters
|
850
|
-
----------
|
851
|
-
packages : Dict[str, str], default: {}
|
852
|
-
Packages to use for this step. The key is the name of the package
|
853
|
-
and the value is the version to use.
|
854
|
-
python : str, optional, default: None
|
855
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
856
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
857
|
-
"""
|
858
|
-
...
|
859
|
-
|
860
|
-
@typing.overload
|
861
|
-
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]]]:
|
793
|
+
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]]]:
|
862
794
|
"""
|
863
|
-
|
795
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
864
796
|
|
865
|
-
|
866
|
-
----------
|
867
|
-
vars : Dict[str, str], default {}
|
868
|
-
Dictionary of environment variables to set.
|
869
|
-
"""
|
870
|
-
...
|
871
|
-
|
872
|
-
@typing.overload
|
873
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
874
|
-
...
|
875
|
-
|
876
|
-
@typing.overload
|
877
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
878
|
-
...
|
879
|
-
|
880
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
881
|
-
"""
|
882
|
-
Specifies environment variables to be set prior to the execution of a step.
|
797
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
883
798
|
|
884
799
|
Parameters
|
885
800
|
----------
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
Specifies the number of times the task corresponding
|
895
|
-
to a step needs to be retried.
|
896
|
-
|
897
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
898
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
899
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
801
|
+
type : str, default 'default'
|
802
|
+
Card type.
|
803
|
+
id : str, optional, default None
|
804
|
+
If multiple cards are present, use this id to identify this card.
|
805
|
+
options : Dict[str, Any], default {}
|
806
|
+
Options passed to the card. The contents depend on the card type.
|
807
|
+
timeout : int, default 45
|
808
|
+
Interrupt reporting if it takes more than this many seconds.
|
900
809
|
|
901
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
902
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
903
|
-
ensuring that the flow execution can continue.
|
904
810
|
|
905
|
-
Parameters
|
906
|
-
----------
|
907
|
-
times : int, default 3
|
908
|
-
Number of times to retry this task.
|
909
|
-
minutes_between_retries : int, default 2
|
910
|
-
Number of minutes between retries.
|
911
811
|
"""
|
912
812
|
...
|
913
813
|
|
914
814
|
@typing.overload
|
915
|
-
def
|
815
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
916
816
|
...
|
917
817
|
|
918
818
|
@typing.overload
|
919
|
-
def
|
920
|
-
...
|
921
|
-
|
922
|
-
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):
|
923
|
-
"""
|
924
|
-
Specifies the number of times the task corresponding
|
925
|
-
to a step needs to be retried.
|
926
|
-
|
927
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
928
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
929
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
930
|
-
|
931
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
932
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
933
|
-
ensuring that the flow execution can continue.
|
934
|
-
|
935
|
-
Parameters
|
936
|
-
----------
|
937
|
-
times : int, default 3
|
938
|
-
Number of times to retry this task.
|
939
|
-
minutes_between_retries : int, default 2
|
940
|
-
Number of minutes between retries.
|
941
|
-
"""
|
819
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
942
820
|
...
|
943
821
|
|
944
|
-
|
945
|
-
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]]]:
|
822
|
+
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):
|
946
823
|
"""
|
947
|
-
|
824
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
948
825
|
|
949
|
-
|
950
|
-
contains the exception raised. You can use it to detect the presence
|
951
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
952
|
-
are missing.
|
826
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
953
827
|
|
954
828
|
Parameters
|
955
829
|
----------
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
@typing.overload
|
966
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
967
|
-
...
|
968
|
-
|
969
|
-
@typing.overload
|
970
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
971
|
-
...
|
972
|
-
|
973
|
-
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):
|
974
|
-
"""
|
975
|
-
Specifies that the step will success under all circumstances.
|
830
|
+
type : str, default 'default'
|
831
|
+
Card type.
|
832
|
+
id : str, optional, default None
|
833
|
+
If multiple cards are present, use this id to identify this card.
|
834
|
+
options : Dict[str, Any], default {}
|
835
|
+
Options passed to the card. The contents depend on the card type.
|
836
|
+
timeout : int, default 45
|
837
|
+
Interrupt reporting if it takes more than this many seconds.
|
976
838
|
|
977
|
-
The decorator will create an optional artifact, specified by `var`, which
|
978
|
-
contains the exception raised. You can use it to detect the presence
|
979
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
980
|
-
are missing.
|
981
839
|
|
982
|
-
Parameters
|
983
|
-
----------
|
984
|
-
var : str, optional, default None
|
985
|
-
Name of the artifact in which to store the caught exception.
|
986
|
-
If not specified, the exception is not stored.
|
987
|
-
print_exception : bool, default True
|
988
|
-
Determines whether or not the exception is printed to
|
989
|
-
stdout when caught.
|
990
840
|
"""
|
991
841
|
...
|
992
842
|
|
@@ -1048,130 +898,46 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1048
898
|
...
|
1049
899
|
|
1050
900
|
@typing.overload
|
1051
|
-
def
|
901
|
+
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]]]:
|
1052
902
|
"""
|
1053
|
-
Specifies
|
1054
|
-
|
903
|
+
Specifies the Conda environment for the step.
|
904
|
+
|
905
|
+
Information in this decorator will augment any
|
906
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
907
|
+
you can use `@conda_base` to set packages required by all
|
908
|
+
steps and use `@conda` to specify step-specific overrides.
|
1055
909
|
|
1056
910
|
Parameters
|
1057
911
|
----------
|
1058
|
-
|
1059
|
-
|
912
|
+
packages : Dict[str, str], default {}
|
913
|
+
Packages to use for this step. The key is the name of the package
|
914
|
+
and the value is the version to use.
|
915
|
+
libraries : Dict[str, str], default {}
|
916
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
917
|
+
python : str, optional, default None
|
918
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
919
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
920
|
+
disabled : bool, default False
|
921
|
+
If set to True, disables @conda.
|
1060
922
|
"""
|
1061
923
|
...
|
1062
924
|
|
1063
925
|
@typing.overload
|
1064
|
-
def
|
926
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1065
927
|
...
|
1066
928
|
|
1067
929
|
@typing.overload
|
1068
|
-
def
|
930
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1069
931
|
...
|
1070
932
|
|
1071
|
-
def
|
933
|
+
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):
|
1072
934
|
"""
|
1073
|
-
Specifies
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1080
|
-
"""
|
1081
|
-
...
|
1082
|
-
|
1083
|
-
@typing.overload
|
1084
|
-
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]]]:
|
1085
|
-
"""
|
1086
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1087
|
-
|
1088
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1089
|
-
|
1090
|
-
Parameters
|
1091
|
-
----------
|
1092
|
-
type : str, default 'default'
|
1093
|
-
Card type.
|
1094
|
-
id : str, optional, default None
|
1095
|
-
If multiple cards are present, use this id to identify this card.
|
1096
|
-
options : Dict[str, Any], default {}
|
1097
|
-
Options passed to the card. The contents depend on the card type.
|
1098
|
-
timeout : int, default 45
|
1099
|
-
Interrupt reporting if it takes more than this many seconds.
|
1100
|
-
|
1101
|
-
|
1102
|
-
"""
|
1103
|
-
...
|
1104
|
-
|
1105
|
-
@typing.overload
|
1106
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1107
|
-
...
|
1108
|
-
|
1109
|
-
@typing.overload
|
1110
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1111
|
-
...
|
1112
|
-
|
1113
|
-
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):
|
1114
|
-
"""
|
1115
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1116
|
-
|
1117
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1118
|
-
|
1119
|
-
Parameters
|
1120
|
-
----------
|
1121
|
-
type : str, default 'default'
|
1122
|
-
Card type.
|
1123
|
-
id : str, optional, default None
|
1124
|
-
If multiple cards are present, use this id to identify this card.
|
1125
|
-
options : Dict[str, Any], default {}
|
1126
|
-
Options passed to the card. The contents depend on the card type.
|
1127
|
-
timeout : int, default 45
|
1128
|
-
Interrupt reporting if it takes more than this many seconds.
|
1129
|
-
|
1130
|
-
|
1131
|
-
"""
|
1132
|
-
...
|
1133
|
-
|
1134
|
-
@typing.overload
|
1135
|
-
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]]]:
|
1136
|
-
"""
|
1137
|
-
Specifies the Conda environment for the step.
|
1138
|
-
|
1139
|
-
Information in this decorator will augment any
|
1140
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1141
|
-
you can use `@conda_base` to set packages required by all
|
1142
|
-
steps and use `@conda` to specify step-specific overrides.
|
1143
|
-
|
1144
|
-
Parameters
|
1145
|
-
----------
|
1146
|
-
packages : Dict[str, str], default {}
|
1147
|
-
Packages to use for this step. The key is the name of the package
|
1148
|
-
and the value is the version to use.
|
1149
|
-
libraries : Dict[str, str], default {}
|
1150
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
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
|
-
disabled : bool, default False
|
1155
|
-
If set to True, disables @conda.
|
1156
|
-
"""
|
1157
|
-
...
|
1158
|
-
|
1159
|
-
@typing.overload
|
1160
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1161
|
-
...
|
1162
|
-
|
1163
|
-
@typing.overload
|
1164
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1165
|
-
...
|
1166
|
-
|
1167
|
-
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):
|
1168
|
-
"""
|
1169
|
-
Specifies the Conda environment for the step.
|
1170
|
-
|
1171
|
-
Information in this decorator will augment any
|
1172
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1173
|
-
you can use `@conda_base` to set packages required by all
|
1174
|
-
steps and use `@conda` to specify step-specific overrides.
|
935
|
+
Specifies the Conda environment for the step.
|
936
|
+
|
937
|
+
Information in this decorator will augment any
|
938
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
939
|
+
you can use `@conda_base` to set packages required by all
|
940
|
+
steps and use `@conda` to specify step-specific overrides.
|
1175
941
|
|
1176
942
|
Parameters
|
1177
943
|
----------
|
@@ -1188,23 +954,6 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1188
954
|
"""
|
1189
955
|
...
|
1190
956
|
|
1191
|
-
@typing.overload
|
1192
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1193
|
-
"""
|
1194
|
-
Internal decorator to support Fast bakery
|
1195
|
-
"""
|
1196
|
-
...
|
1197
|
-
|
1198
|
-
@typing.overload
|
1199
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1200
|
-
...
|
1201
|
-
|
1202
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1203
|
-
"""
|
1204
|
-
Internal decorator to support Fast bakery
|
1205
|
-
"""
|
1206
|
-
...
|
1207
|
-
|
1208
957
|
@typing.overload
|
1209
958
|
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]]]:
|
1210
959
|
"""
|
@@ -1283,41 +1032,523 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
1283
1032
|
...
|
1284
1033
|
|
1285
1034
|
@typing.overload
|
1286
|
-
def
|
1035
|
+
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]]]:
|
1287
1036
|
"""
|
1288
|
-
Specifies
|
1037
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1038
|
+
the execution of a step.
|
1289
1039
|
|
1290
|
-
Use `@pypi_base` to set common packages required by all
|
1291
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1292
1040
|
Parameters
|
1293
1041
|
----------
|
1294
|
-
|
1295
|
-
|
1296
|
-
and the value is the version to use.
|
1297
|
-
python : str, optional, default: None
|
1298
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1299
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1042
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1043
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1300
1044
|
"""
|
1301
1045
|
...
|
1302
1046
|
|
1303
1047
|
@typing.overload
|
1304
|
-
def
|
1048
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1305
1049
|
...
|
1306
1050
|
|
1307
|
-
|
1051
|
+
@typing.overload
|
1052
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1053
|
+
...
|
1054
|
+
|
1055
|
+
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]]] = []):
|
1308
1056
|
"""
|
1309
|
-
Specifies
|
1057
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1058
|
+
the execution of a step.
|
1310
1059
|
|
1311
|
-
Use `@pypi_base` to set common packages required by all
|
1312
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1313
1060
|
Parameters
|
1314
1061
|
----------
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1062
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1063
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1064
|
+
"""
|
1065
|
+
...
|
1066
|
+
|
1067
|
+
@typing.overload
|
1068
|
+
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]]]:
|
1069
|
+
"""
|
1070
|
+
Specifies the number of times the task corresponding
|
1071
|
+
to a step needs to be retried.
|
1072
|
+
|
1073
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1074
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1075
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1076
|
+
|
1077
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1078
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1079
|
+
ensuring that the flow execution can continue.
|
1080
|
+
|
1081
|
+
Parameters
|
1082
|
+
----------
|
1083
|
+
times : int, default 3
|
1084
|
+
Number of times to retry this task.
|
1085
|
+
minutes_between_retries : int, default 2
|
1086
|
+
Number of minutes between retries.
|
1087
|
+
"""
|
1088
|
+
...
|
1089
|
+
|
1090
|
+
@typing.overload
|
1091
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1092
|
+
...
|
1093
|
+
|
1094
|
+
@typing.overload
|
1095
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1096
|
+
...
|
1097
|
+
|
1098
|
+
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):
|
1099
|
+
"""
|
1100
|
+
Specifies the number of times the task corresponding
|
1101
|
+
to a step needs to be retried.
|
1102
|
+
|
1103
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1104
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1105
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1106
|
+
|
1107
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1108
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1109
|
+
ensuring that the flow execution can continue.
|
1110
|
+
|
1111
|
+
Parameters
|
1112
|
+
----------
|
1113
|
+
times : int, default 3
|
1114
|
+
Number of times to retry this task.
|
1115
|
+
minutes_between_retries : int, default 2
|
1116
|
+
Number of minutes between retries.
|
1117
|
+
"""
|
1118
|
+
...
|
1119
|
+
|
1120
|
+
@typing.overload
|
1121
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1122
|
+
"""
|
1123
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1124
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1125
|
+
"""
|
1126
|
+
...
|
1127
|
+
|
1128
|
+
@typing.overload
|
1129
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1130
|
+
...
|
1131
|
+
|
1132
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1133
|
+
"""
|
1134
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1135
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1136
|
+
"""
|
1137
|
+
...
|
1138
|
+
|
1139
|
+
@typing.overload
|
1140
|
+
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]]]:
|
1141
|
+
"""
|
1142
|
+
Specifies that the step will success under all circumstances.
|
1143
|
+
|
1144
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1145
|
+
contains the exception raised. You can use it to detect the presence
|
1146
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1147
|
+
are missing.
|
1148
|
+
|
1149
|
+
Parameters
|
1150
|
+
----------
|
1151
|
+
var : str, optional, default None
|
1152
|
+
Name of the artifact in which to store the caught exception.
|
1153
|
+
If not specified, the exception is not stored.
|
1154
|
+
print_exception : bool, default True
|
1155
|
+
Determines whether or not the exception is printed to
|
1156
|
+
stdout when caught.
|
1157
|
+
"""
|
1158
|
+
...
|
1159
|
+
|
1160
|
+
@typing.overload
|
1161
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1162
|
+
...
|
1163
|
+
|
1164
|
+
@typing.overload
|
1165
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1166
|
+
...
|
1167
|
+
|
1168
|
+
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):
|
1169
|
+
"""
|
1170
|
+
Specifies that the step will success under all circumstances.
|
1171
|
+
|
1172
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1173
|
+
contains the exception raised. You can use it to detect the presence
|
1174
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1175
|
+
are missing.
|
1176
|
+
|
1177
|
+
Parameters
|
1178
|
+
----------
|
1179
|
+
var : str, optional, default None
|
1180
|
+
Name of the artifact in which to store the caught exception.
|
1181
|
+
If not specified, the exception is not stored.
|
1182
|
+
print_exception : bool, default True
|
1183
|
+
Determines whether or not the exception is printed to
|
1184
|
+
stdout when caught.
|
1185
|
+
"""
|
1186
|
+
...
|
1187
|
+
|
1188
|
+
@typing.overload
|
1189
|
+
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]]]:
|
1190
|
+
"""
|
1191
|
+
Specifies the PyPI packages for the step.
|
1192
|
+
|
1193
|
+
Information in this decorator will augment any
|
1194
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1195
|
+
you can use `@pypi_base` to set packages required by all
|
1196
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1197
|
+
|
1198
|
+
Parameters
|
1199
|
+
----------
|
1200
|
+
packages : Dict[str, str], default: {}
|
1201
|
+
Packages to use for this step. The key is the name of the package
|
1202
|
+
and the value is the version to use.
|
1203
|
+
python : str, optional, default: None
|
1204
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1205
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1206
|
+
"""
|
1207
|
+
...
|
1208
|
+
|
1209
|
+
@typing.overload
|
1210
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1211
|
+
...
|
1212
|
+
|
1213
|
+
@typing.overload
|
1214
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1215
|
+
...
|
1216
|
+
|
1217
|
+
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):
|
1218
|
+
"""
|
1219
|
+
Specifies the PyPI packages for the step.
|
1220
|
+
|
1221
|
+
Information in this decorator will augment any
|
1222
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1223
|
+
you can use `@pypi_base` to set packages required by all
|
1224
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1225
|
+
|
1226
|
+
Parameters
|
1227
|
+
----------
|
1228
|
+
packages : Dict[str, str], default: {}
|
1229
|
+
Packages to use for this step. The key is the name of the package
|
1230
|
+
and the value is the version to use.
|
1231
|
+
python : str, optional, default: None
|
1232
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1233
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1234
|
+
"""
|
1235
|
+
...
|
1236
|
+
|
1237
|
+
@typing.overload
|
1238
|
+
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]]]:
|
1239
|
+
"""
|
1240
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1241
|
+
|
1242
|
+
Parameters
|
1243
|
+
----------
|
1244
|
+
vars : Dict[str, str], default {}
|
1245
|
+
Dictionary of environment variables to set.
|
1246
|
+
"""
|
1247
|
+
...
|
1248
|
+
|
1249
|
+
@typing.overload
|
1250
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1251
|
+
...
|
1252
|
+
|
1253
|
+
@typing.overload
|
1254
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1255
|
+
...
|
1256
|
+
|
1257
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1258
|
+
"""
|
1259
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1260
|
+
|
1261
|
+
Parameters
|
1262
|
+
----------
|
1263
|
+
vars : Dict[str, str], default {}
|
1264
|
+
Dictionary of environment variables to set.
|
1265
|
+
"""
|
1266
|
+
...
|
1267
|
+
|
1268
|
+
@typing.overload
|
1269
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1270
|
+
"""
|
1271
|
+
Internal decorator to support Fast bakery
|
1272
|
+
"""
|
1273
|
+
...
|
1274
|
+
|
1275
|
+
@typing.overload
|
1276
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1277
|
+
...
|
1278
|
+
|
1279
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1280
|
+
"""
|
1281
|
+
Internal decorator to support Fast bakery
|
1282
|
+
"""
|
1283
|
+
...
|
1284
|
+
|
1285
|
+
@typing.overload
|
1286
|
+
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]]:
|
1287
|
+
"""
|
1288
|
+
Specifies the Conda environment for all steps of the flow.
|
1289
|
+
|
1290
|
+
Use `@conda_base` to set common libraries required by all
|
1291
|
+
steps and use `@conda` to specify step-specific additions.
|
1292
|
+
|
1293
|
+
Parameters
|
1294
|
+
----------
|
1295
|
+
packages : Dict[str, str], default {}
|
1296
|
+
Packages to use for this flow. The key is the name of the package
|
1297
|
+
and the value is the version to use.
|
1298
|
+
libraries : Dict[str, str], default {}
|
1299
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1300
|
+
python : str, optional, default None
|
1301
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1302
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1303
|
+
disabled : bool, default False
|
1304
|
+
If set to True, disables Conda.
|
1305
|
+
"""
|
1306
|
+
...
|
1307
|
+
|
1308
|
+
@typing.overload
|
1309
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1310
|
+
...
|
1311
|
+
|
1312
|
+
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):
|
1313
|
+
"""
|
1314
|
+
Specifies the Conda environment for all steps of the flow.
|
1315
|
+
|
1316
|
+
Use `@conda_base` to set common libraries required by all
|
1317
|
+
steps and use `@conda` to specify step-specific additions.
|
1318
|
+
|
1319
|
+
Parameters
|
1320
|
+
----------
|
1321
|
+
packages : Dict[str, str], default {}
|
1322
|
+
Packages to use for this flow. The key is the name of the package
|
1323
|
+
and the value is the version to use.
|
1324
|
+
libraries : Dict[str, str], default {}
|
1325
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1326
|
+
python : str, optional, default None
|
1327
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1328
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1329
|
+
disabled : bool, default False
|
1330
|
+
If set to True, disables Conda.
|
1331
|
+
"""
|
1332
|
+
...
|
1333
|
+
|
1334
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1335
|
+
"""
|
1336
|
+
Specifies what flows belong to the same project.
|
1337
|
+
|
1338
|
+
A project-specific namespace is created for all flows that
|
1339
|
+
use the same `@project(name)`.
|
1340
|
+
|
1341
|
+
Parameters
|
1342
|
+
----------
|
1343
|
+
name : str
|
1344
|
+
Project name. Make sure that the name is unique amongst all
|
1345
|
+
projects that use the same production scheduler. The name may
|
1346
|
+
contain only lowercase alphanumeric characters and underscores.
|
1347
|
+
|
1348
|
+
|
1349
|
+
"""
|
1350
|
+
...
|
1351
|
+
|
1352
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1353
|
+
"""
|
1354
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1355
|
+
|
1356
|
+
User code call
|
1357
|
+
-----------
|
1358
|
+
@nim(
|
1359
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1360
|
+
backend='managed'
|
1361
|
+
)
|
1362
|
+
|
1363
|
+
Valid backend options
|
1364
|
+
---------------------
|
1365
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1366
|
+
- 🚧 'dataplane': Run in your account.
|
1367
|
+
|
1368
|
+
Valid model options
|
1369
|
+
----------------
|
1370
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1371
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1372
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1373
|
+
|
1374
|
+
Parameters
|
1375
|
+
----------
|
1376
|
+
models: list[NIM]
|
1377
|
+
List of NIM containers running models in sidecars.
|
1378
|
+
backend: str
|
1379
|
+
Compute provider to run the NIM container.
|
1380
|
+
"""
|
1381
|
+
...
|
1382
|
+
|
1383
|
+
@typing.overload
|
1384
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1385
|
+
"""
|
1386
|
+
Specifies the PyPI packages for all steps of the flow.
|
1387
|
+
|
1388
|
+
Use `@pypi_base` to set common packages required by all
|
1389
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1390
|
+
Parameters
|
1391
|
+
----------
|
1392
|
+
packages : Dict[str, str], default: {}
|
1393
|
+
Packages to use for this flow. The key is the name of the package
|
1394
|
+
and the value is the version to use.
|
1395
|
+
python : str, optional, default: None
|
1396
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1397
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1398
|
+
"""
|
1399
|
+
...
|
1400
|
+
|
1401
|
+
@typing.overload
|
1402
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1403
|
+
...
|
1404
|
+
|
1405
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1406
|
+
"""
|
1407
|
+
Specifies the PyPI packages for all steps of the flow.
|
1408
|
+
|
1409
|
+
Use `@pypi_base` to set common packages required by all
|
1410
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1411
|
+
Parameters
|
1412
|
+
----------
|
1413
|
+
packages : Dict[str, str], default: {}
|
1414
|
+
Packages to use for this flow. The key is the name of the package
|
1415
|
+
and the value is the version to use.
|
1416
|
+
python : str, optional, default: None
|
1417
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1418
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1419
|
+
"""
|
1420
|
+
...
|
1421
|
+
|
1422
|
+
@typing.overload
|
1423
|
+
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]]:
|
1424
|
+
"""
|
1425
|
+
Specifies the times when the flow should be run when running on a
|
1426
|
+
production scheduler.
|
1427
|
+
|
1428
|
+
Parameters
|
1429
|
+
----------
|
1430
|
+
hourly : bool, default False
|
1431
|
+
Run the workflow hourly.
|
1432
|
+
daily : bool, default True
|
1433
|
+
Run the workflow daily.
|
1434
|
+
weekly : bool, default False
|
1435
|
+
Run the workflow weekly.
|
1436
|
+
cron : str, optional, default None
|
1437
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1438
|
+
specified by this expression.
|
1439
|
+
timezone : str, optional, default None
|
1440
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1441
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1442
|
+
"""
|
1443
|
+
...
|
1444
|
+
|
1445
|
+
@typing.overload
|
1446
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1447
|
+
...
|
1448
|
+
|
1449
|
+
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):
|
1450
|
+
"""
|
1451
|
+
Specifies the times when the flow should be run when running on a
|
1452
|
+
production scheduler.
|
1453
|
+
|
1454
|
+
Parameters
|
1455
|
+
----------
|
1456
|
+
hourly : bool, default False
|
1457
|
+
Run the workflow hourly.
|
1458
|
+
daily : bool, default True
|
1459
|
+
Run the workflow daily.
|
1460
|
+
weekly : bool, default False
|
1461
|
+
Run the workflow weekly.
|
1462
|
+
cron : str, optional, default None
|
1463
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1464
|
+
specified by this expression.
|
1465
|
+
timezone : str, optional, default None
|
1466
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1467
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1468
|
+
"""
|
1469
|
+
...
|
1470
|
+
|
1471
|
+
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]]:
|
1472
|
+
"""
|
1473
|
+
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)
|
1474
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1475
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1476
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1477
|
+
starts only after all sensors finish.
|
1478
|
+
|
1479
|
+
Parameters
|
1480
|
+
----------
|
1481
|
+
timeout : int
|
1482
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1483
|
+
poke_interval : int
|
1484
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1485
|
+
mode : str
|
1486
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1487
|
+
exponential_backoff : bool
|
1488
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1489
|
+
pool : str
|
1490
|
+
the slot pool this task should run in,
|
1491
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1492
|
+
soft_fail : bool
|
1493
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1494
|
+
name : str
|
1495
|
+
Name of the sensor on Airflow
|
1496
|
+
description : str
|
1497
|
+
Description of sensor in the Airflow UI
|
1498
|
+
bucket_key : Union[str, List[str]]
|
1499
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1500
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1501
|
+
bucket_name : str
|
1502
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1503
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1504
|
+
wildcard_match : bool
|
1505
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1506
|
+
aws_conn_id : str
|
1507
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1508
|
+
verify : bool
|
1509
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1510
|
+
"""
|
1511
|
+
...
|
1512
|
+
|
1513
|
+
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]]:
|
1514
|
+
"""
|
1515
|
+
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.
|
1516
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1517
|
+
|
1518
|
+
Parameters
|
1519
|
+
----------
|
1520
|
+
timeout : int
|
1521
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1522
|
+
poke_interval : int
|
1523
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1524
|
+
mode : str
|
1525
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1526
|
+
exponential_backoff : bool
|
1527
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1528
|
+
pool : str
|
1529
|
+
the slot pool this task should run in,
|
1530
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1531
|
+
soft_fail : bool
|
1532
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1533
|
+
name : str
|
1534
|
+
Name of the sensor on Airflow
|
1535
|
+
description : str
|
1536
|
+
Description of sensor in the Airflow UI
|
1537
|
+
external_dag_id : str
|
1538
|
+
The dag_id that contains the task you want to wait for.
|
1539
|
+
external_task_ids : List[str]
|
1540
|
+
The list of task_ids that you want to wait for.
|
1541
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1542
|
+
allowed_states : List[str]
|
1543
|
+
Iterable of allowed states, (Default: ['success'])
|
1544
|
+
failed_states : List[str]
|
1545
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1546
|
+
execution_delta : datetime.timedelta
|
1547
|
+
time difference with the previous execution to look at,
|
1548
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1549
|
+
check_existence: bool
|
1550
|
+
Set to True to check if the external task exists or check if
|
1551
|
+
the DAG to wait for exists. (Default: True)
|
1321
1552
|
"""
|
1322
1553
|
...
|
1323
1554
|
|
@@ -1424,170 +1655,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1424
1655
|
"""
|
1425
1656
|
...
|
1426
1657
|
|
1427
|
-
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]]:
|
1428
|
-
"""
|
1429
|
-
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.
|
1430
|
-
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1431
|
-
|
1432
|
-
Parameters
|
1433
|
-
----------
|
1434
|
-
timeout : int
|
1435
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1436
|
-
poke_interval : int
|
1437
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1438
|
-
mode : str
|
1439
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1440
|
-
exponential_backoff : bool
|
1441
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1442
|
-
pool : str
|
1443
|
-
the slot pool this task should run in,
|
1444
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1445
|
-
soft_fail : bool
|
1446
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1447
|
-
name : str
|
1448
|
-
Name of the sensor on Airflow
|
1449
|
-
description : str
|
1450
|
-
Description of sensor in the Airflow UI
|
1451
|
-
external_dag_id : str
|
1452
|
-
The dag_id that contains the task you want to wait for.
|
1453
|
-
external_task_ids : List[str]
|
1454
|
-
The list of task_ids that you want to wait for.
|
1455
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1456
|
-
allowed_states : List[str]
|
1457
|
-
Iterable of allowed states, (Default: ['success'])
|
1458
|
-
failed_states : List[str]
|
1459
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1460
|
-
execution_delta : datetime.timedelta
|
1461
|
-
time difference with the previous execution to look at,
|
1462
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1463
|
-
check_existence: bool
|
1464
|
-
Set to True to check if the external task exists or check if
|
1465
|
-
the DAG to wait for exists. (Default: True)
|
1466
|
-
"""
|
1467
|
-
...
|
1468
|
-
|
1469
|
-
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]]:
|
1470
|
-
"""
|
1471
|
-
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)
|
1472
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1473
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1474
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1475
|
-
starts only after all sensors finish.
|
1476
|
-
|
1477
|
-
Parameters
|
1478
|
-
----------
|
1479
|
-
timeout : int
|
1480
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1481
|
-
poke_interval : int
|
1482
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1483
|
-
mode : str
|
1484
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1485
|
-
exponential_backoff : bool
|
1486
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1487
|
-
pool : str
|
1488
|
-
the slot pool this task should run in,
|
1489
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1490
|
-
soft_fail : bool
|
1491
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1492
|
-
name : str
|
1493
|
-
Name of the sensor on Airflow
|
1494
|
-
description : str
|
1495
|
-
Description of sensor in the Airflow UI
|
1496
|
-
bucket_key : Union[str, List[str]]
|
1497
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1498
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1499
|
-
bucket_name : str
|
1500
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1501
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1502
|
-
wildcard_match : bool
|
1503
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1504
|
-
aws_conn_id : str
|
1505
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1506
|
-
verify : bool
|
1507
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1508
|
-
"""
|
1509
|
-
...
|
1510
|
-
|
1511
|
-
@typing.overload
|
1512
|
-
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]]:
|
1513
|
-
"""
|
1514
|
-
Specifies the Conda environment for all steps of the flow.
|
1515
|
-
|
1516
|
-
Use `@conda_base` to set common libraries required by all
|
1517
|
-
steps and use `@conda` to specify step-specific additions.
|
1518
|
-
|
1519
|
-
Parameters
|
1520
|
-
----------
|
1521
|
-
packages : Dict[str, str], default {}
|
1522
|
-
Packages to use for this flow. The key is the name of the package
|
1523
|
-
and the value is the version to use.
|
1524
|
-
libraries : Dict[str, str], default {}
|
1525
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1526
|
-
python : str, optional, default None
|
1527
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1528
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1529
|
-
disabled : bool, default False
|
1530
|
-
If set to True, disables Conda.
|
1531
|
-
"""
|
1532
|
-
...
|
1533
|
-
|
1534
|
-
@typing.overload
|
1535
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1536
|
-
...
|
1537
|
-
|
1538
|
-
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):
|
1539
|
-
"""
|
1540
|
-
Specifies the Conda environment for all steps of the flow.
|
1541
|
-
|
1542
|
-
Use `@conda_base` to set common libraries required by all
|
1543
|
-
steps and use `@conda` to specify step-specific additions.
|
1544
|
-
|
1545
|
-
Parameters
|
1546
|
-
----------
|
1547
|
-
packages : Dict[str, str], default {}
|
1548
|
-
Packages to use for this flow. The key is the name of the package
|
1549
|
-
and the value is the version to use.
|
1550
|
-
libraries : Dict[str, str], default {}
|
1551
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1552
|
-
python : str, optional, default None
|
1553
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1554
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1555
|
-
disabled : bool, default False
|
1556
|
-
If set to True, disables Conda.
|
1557
|
-
"""
|
1558
|
-
...
|
1559
|
-
|
1560
|
-
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1561
|
-
"""
|
1562
|
-
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1563
|
-
|
1564
|
-
User code call
|
1565
|
-
-----------
|
1566
|
-
@nim(
|
1567
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1568
|
-
backend='managed'
|
1569
|
-
)
|
1570
|
-
|
1571
|
-
Valid backend options
|
1572
|
-
---------------------
|
1573
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
1574
|
-
- 🚧 'dataplane': Run in your account.
|
1575
|
-
|
1576
|
-
Valid model options
|
1577
|
-
----------------
|
1578
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
1579
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
1580
|
-
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1581
|
-
|
1582
|
-
Parameters
|
1583
|
-
----------
|
1584
|
-
models: list[NIM]
|
1585
|
-
List of NIM containers running models in sidecars.
|
1586
|
-
backend: str
|
1587
|
-
Compute provider to run the NIM container.
|
1588
|
-
"""
|
1589
|
-
...
|
1590
|
-
|
1591
1658
|
@typing.overload
|
1592
1659
|
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]]:
|
1593
1660
|
"""
|
@@ -1683,73 +1750,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1683
1750
|
"""
|
1684
1751
|
...
|
1685
1752
|
|
1686
|
-
@typing.overload
|
1687
|
-
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]]:
|
1688
|
-
"""
|
1689
|
-
Specifies the times when the flow should be run when running on a
|
1690
|
-
production scheduler.
|
1691
|
-
|
1692
|
-
Parameters
|
1693
|
-
----------
|
1694
|
-
hourly : bool, default False
|
1695
|
-
Run the workflow hourly.
|
1696
|
-
daily : bool, default True
|
1697
|
-
Run the workflow daily.
|
1698
|
-
weekly : bool, default False
|
1699
|
-
Run the workflow weekly.
|
1700
|
-
cron : str, optional, default None
|
1701
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1702
|
-
specified by this expression.
|
1703
|
-
timezone : str, optional, default None
|
1704
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1705
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1706
|
-
"""
|
1707
|
-
...
|
1708
|
-
|
1709
|
-
@typing.overload
|
1710
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1711
|
-
...
|
1712
|
-
|
1713
|
-
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):
|
1714
|
-
"""
|
1715
|
-
Specifies the times when the flow should be run when running on a
|
1716
|
-
production scheduler.
|
1717
|
-
|
1718
|
-
Parameters
|
1719
|
-
----------
|
1720
|
-
hourly : bool, default False
|
1721
|
-
Run the workflow hourly.
|
1722
|
-
daily : bool, default True
|
1723
|
-
Run the workflow daily.
|
1724
|
-
weekly : bool, default False
|
1725
|
-
Run the workflow weekly.
|
1726
|
-
cron : str, optional, default None
|
1727
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1728
|
-
specified by this expression.
|
1729
|
-
timezone : str, optional, default None
|
1730
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1731
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1732
|
-
"""
|
1733
|
-
...
|
1734
|
-
|
1735
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1736
|
-
"""
|
1737
|
-
Specifies what flows belong to the same project.
|
1738
|
-
|
1739
|
-
A project-specific namespace is created for all flows that
|
1740
|
-
use the same `@project(name)`.
|
1741
|
-
|
1742
|
-
Parameters
|
1743
|
-
----------
|
1744
|
-
name : str
|
1745
|
-
Project name. Make sure that the name is unique amongst all
|
1746
|
-
projects that use the same production scheduler. The name may
|
1747
|
-
contain only lowercase alphanumeric characters and underscores.
|
1748
|
-
|
1749
|
-
|
1750
|
-
"""
|
1751
|
-
...
|
1752
|
-
|
1753
1753
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1754
1754
|
"""
|
1755
1755
|
Switch namespace to the one provided.
|