metaflow-stubs 2.12.10__py2.py3-none-any.whl → 2.12.11__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 +579 -579
- metaflow-stubs/cards.pyi +4 -4
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +7 -7
- 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 +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/metadata/metadata.pyi +3 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +4 -2
- metaflow-stubs/metaflow_current.pyi +17 -17
- 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.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_decorator.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 +33 -10
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +12 -12
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +7 -7
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- 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_cli.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/dynamo_db_client.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_cli.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.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 +5 -5
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.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 +3 -3
- 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 +3 -3
- 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_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -4
- 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/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 +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 +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/procpoll.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 +4 -4
- 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
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.12.10.dist-info → metaflow_stubs-2.12.11.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.11.dist-info/RECORD +150 -0
- metaflow_stubs-2.12.10.dist-info/RECORD +0 -150
- {metaflow_stubs-2.12.10.dist-info → metaflow_stubs-2.12.11.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.12.10.dist-info → metaflow_stubs-2.12.11.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.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.11 #
|
4
|
+
# Generated on 2024-08-09T01:05:47.258349 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
+
import io
|
11
12
|
import metaflow.metaflow_current
|
13
|
+
import typing
|
14
|
+
import metaflow.flowspec
|
15
|
+
import metaflow.runner.metaflow_runner
|
16
|
+
import metaflow.datastore.inputs
|
12
17
|
import metaflow._vendor.click.types
|
13
|
-
import metaflow.client.core
|
14
18
|
import metaflow.events
|
15
19
|
import metaflow.parameters
|
16
|
-
import datetime
|
17
|
-
import typing
|
18
20
|
import metaflow.plugins.datatools.s3.s3
|
19
|
-
import
|
20
|
-
import
|
21
|
-
import metaflow.flowspec
|
22
|
-
import metaflow.runner.metaflow_runner
|
21
|
+
import datetime
|
22
|
+
import metaflow.client.core
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -727,57 +727,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
727
727
|
"""
|
728
728
|
...
|
729
729
|
|
730
|
-
@typing.overload
|
731
|
-
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]]]:
|
732
|
-
"""
|
733
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
734
|
-
|
735
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
736
|
-
|
737
|
-
Parameters
|
738
|
-
----------
|
739
|
-
type : str, default 'default'
|
740
|
-
Card type.
|
741
|
-
id : str, optional, default None
|
742
|
-
If multiple cards are present, use this id to identify this card.
|
743
|
-
options : Dict[str, Any], default {}
|
744
|
-
Options passed to the card. The contents depend on the card type.
|
745
|
-
timeout : int, default 45
|
746
|
-
Interrupt reporting if it takes more than this many seconds.
|
747
|
-
|
748
|
-
|
749
|
-
"""
|
750
|
-
...
|
751
|
-
|
752
|
-
@typing.overload
|
753
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
754
|
-
...
|
755
|
-
|
756
|
-
@typing.overload
|
757
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
758
|
-
...
|
759
|
-
|
760
|
-
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):
|
761
|
-
"""
|
762
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
763
|
-
|
764
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
765
|
-
|
766
|
-
Parameters
|
767
|
-
----------
|
768
|
-
type : str, default 'default'
|
769
|
-
Card type.
|
770
|
-
id : str, optional, default None
|
771
|
-
If multiple cards are present, use this id to identify this card.
|
772
|
-
options : Dict[str, Any], default {}
|
773
|
-
Options passed to the card. The contents depend on the card type.
|
774
|
-
timeout : int, default 45
|
775
|
-
Interrupt reporting if it takes more than this many seconds.
|
776
|
-
|
777
|
-
|
778
|
-
"""
|
779
|
-
...
|
780
|
-
|
781
730
|
@typing.overload
|
782
731
|
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]]]:
|
783
732
|
"""
|
@@ -810,376 +759,119 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
|
|
810
759
|
...
|
811
760
|
|
812
761
|
@typing.overload
|
813
|
-
def
|
814
|
-
"""
|
815
|
-
Specifies that the step will success under all circumstances.
|
816
|
-
|
817
|
-
The decorator will create an optional artifact, specified by `var`, which
|
818
|
-
contains the exception raised. You can use it to detect the presence
|
819
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
820
|
-
are missing.
|
821
|
-
|
822
|
-
Parameters
|
823
|
-
----------
|
824
|
-
var : str, optional, default None
|
825
|
-
Name of the artifact in which to store the caught exception.
|
826
|
-
If not specified, the exception is not stored.
|
827
|
-
print_exception : bool, default True
|
828
|
-
Determines whether or not the exception is printed to
|
829
|
-
stdout when caught.
|
830
|
-
"""
|
831
|
-
...
|
832
|
-
|
833
|
-
@typing.overload
|
834
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
835
|
-
...
|
836
|
-
|
837
|
-
@typing.overload
|
838
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
839
|
-
...
|
840
|
-
|
841
|
-
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):
|
842
|
-
"""
|
843
|
-
Specifies that the step will success under all circumstances.
|
844
|
-
|
845
|
-
The decorator will create an optional artifact, specified by `var`, which
|
846
|
-
contains the exception raised. You can use it to detect the presence
|
847
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
848
|
-
are missing.
|
849
|
-
|
850
|
-
Parameters
|
851
|
-
----------
|
852
|
-
var : str, optional, default None
|
853
|
-
Name of the artifact in which to store the caught exception.
|
854
|
-
If not specified, the exception is not stored.
|
855
|
-
print_exception : bool, default True
|
856
|
-
Determines whether or not the exception is printed to
|
857
|
-
stdout when caught.
|
858
|
-
"""
|
859
|
-
...
|
860
|
-
|
861
|
-
@typing.overload
|
862
|
-
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]]]:
|
762
|
+
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]]]:
|
863
763
|
"""
|
864
|
-
Specifies the
|
764
|
+
Specifies the Conda environment for the step.
|
865
765
|
|
866
766
|
Information in this decorator will augment any
|
867
|
-
attributes set in the `@
|
868
|
-
you can use `@
|
869
|
-
steps and use `@
|
767
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
768
|
+
you can use `@conda_base` to set packages required by all
|
769
|
+
steps and use `@conda` to specify step-specific overrides.
|
870
770
|
|
871
771
|
Parameters
|
872
772
|
----------
|
873
|
-
packages : Dict[str, str], default
|
773
|
+
packages : Dict[str, str], default {}
|
874
774
|
Packages to use for this step. The key is the name of the package
|
875
775
|
and the value is the version to use.
|
876
|
-
|
776
|
+
libraries : Dict[str, str], default {}
|
777
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
778
|
+
python : str, optional, default None
|
877
779
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
878
780
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
781
|
+
disabled : bool, default False
|
782
|
+
If set to True, disables @conda.
|
879
783
|
"""
|
880
784
|
...
|
881
785
|
|
882
786
|
@typing.overload
|
883
|
-
def
|
787
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
884
788
|
...
|
885
789
|
|
886
790
|
@typing.overload
|
887
|
-
def
|
791
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
888
792
|
...
|
889
793
|
|
890
|
-
def
|
794
|
+
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):
|
891
795
|
"""
|
892
|
-
Specifies the
|
796
|
+
Specifies the Conda environment for the step.
|
893
797
|
|
894
798
|
Information in this decorator will augment any
|
895
|
-
attributes set in the `@
|
896
|
-
you can use `@
|
897
|
-
steps and use `@
|
799
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
800
|
+
you can use `@conda_base` to set packages required by all
|
801
|
+
steps and use `@conda` to specify step-specific overrides.
|
898
802
|
|
899
803
|
Parameters
|
900
804
|
----------
|
901
|
-
packages : Dict[str, str], default
|
805
|
+
packages : Dict[str, str], default {}
|
902
806
|
Packages to use for this step. The key is the name of the package
|
903
807
|
and the value is the version to use.
|
904
|
-
|
808
|
+
libraries : Dict[str, str], default {}
|
809
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
810
|
+
python : str, optional, default None
|
905
811
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
906
812
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
813
|
+
disabled : bool, default False
|
814
|
+
If set to True, disables @conda.
|
907
815
|
"""
|
908
816
|
...
|
909
817
|
|
910
818
|
@typing.overload
|
911
|
-
def
|
819
|
+
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]]]:
|
912
820
|
"""
|
913
|
-
Specifies the
|
821
|
+
Specifies the number of times the task corresponding
|
822
|
+
to a step needs to be retried.
|
914
823
|
|
915
|
-
|
916
|
-
|
824
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
825
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
826
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
917
827
|
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
```
|
922
|
-
or
|
923
|
-
```
|
924
|
-
python myflow.py run --with kubernetes
|
925
|
-
```
|
926
|
-
which executes the flow on the desired system using the
|
927
|
-
requirements specified in `@resources`.
|
828
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
829
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
830
|
+
ensuring that the flow execution can continue.
|
928
831
|
|
929
832
|
Parameters
|
930
833
|
----------
|
931
|
-
|
932
|
-
Number of
|
933
|
-
|
934
|
-
Number of
|
935
|
-
disk : int, optional, default None
|
936
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
937
|
-
memory : int, default 4096
|
938
|
-
Memory size (in MB) required for this step.
|
939
|
-
shared_memory : int, optional, default None
|
940
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
941
|
-
This parameter maps to the `--shm-size` option in Docker.
|
834
|
+
times : int, default 3
|
835
|
+
Number of times to retry this task.
|
836
|
+
minutes_between_retries : int, default 2
|
837
|
+
Number of minutes between retries.
|
942
838
|
"""
|
943
839
|
...
|
944
840
|
|
945
841
|
@typing.overload
|
946
|
-
def
|
842
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
947
843
|
...
|
948
844
|
|
949
845
|
@typing.overload
|
950
|
-
def
|
846
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
951
847
|
...
|
952
848
|
|
953
|
-
def
|
849
|
+
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):
|
954
850
|
"""
|
955
|
-
Specifies the
|
851
|
+
Specifies the number of times the task corresponding
|
852
|
+
to a step needs to be retried.
|
956
853
|
|
957
|
-
|
958
|
-
|
854
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
855
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
856
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
959
857
|
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
```
|
964
|
-
or
|
965
|
-
```
|
966
|
-
python myflow.py run --with kubernetes
|
967
|
-
```
|
968
|
-
which executes the flow on the desired system using the
|
969
|
-
requirements specified in `@resources`.
|
858
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
859
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
860
|
+
ensuring that the flow execution can continue.
|
970
861
|
|
971
862
|
Parameters
|
972
863
|
----------
|
973
|
-
|
974
|
-
Number of
|
975
|
-
|
976
|
-
Number of
|
977
|
-
disk : int, optional, default None
|
978
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
979
|
-
memory : int, default 4096
|
980
|
-
Memory size (in MB) required for this step.
|
981
|
-
shared_memory : int, optional, default None
|
982
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
983
|
-
This parameter maps to the `--shm-size` option in Docker.
|
984
|
-
"""
|
985
|
-
...
|
986
|
-
|
987
|
-
@typing.overload
|
988
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
989
|
-
"""
|
990
|
-
Decorator prototype for all step decorators. This function gets specialized
|
991
|
-
and imported for all decorators types by _import_plugin_decorators().
|
864
|
+
times : int, default 3
|
865
|
+
Number of times to retry this task.
|
866
|
+
minutes_between_retries : int, default 2
|
867
|
+
Number of minutes between retries.
|
992
868
|
"""
|
993
869
|
...
|
994
870
|
|
995
871
|
@typing.overload
|
996
|
-
def
|
997
|
-
...
|
998
|
-
|
999
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1000
|
-
"""
|
1001
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1002
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1003
|
-
"""
|
1004
|
-
...
|
1005
|
-
|
1006
|
-
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) -> 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]]]:
|
872
|
+
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[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]]]:
|
1007
873
|
"""
|
1008
|
-
Specifies that this step should execute on
|
1009
|
-
|
1010
|
-
Parameters
|
1011
|
-
----------
|
1012
|
-
cpu : int, default 1
|
1013
|
-
Number of CPUs required for this step. If `@resources` is
|
1014
|
-
also present, the maximum value from all decorators is used.
|
1015
|
-
memory : int, default 4096
|
1016
|
-
Memory size (in MB) required for this step. If
|
1017
|
-
`@resources` is also present, the maximum value from all decorators is
|
1018
|
-
used.
|
1019
|
-
disk : int, default 10240
|
1020
|
-
Disk size (in MB) required for this step. If
|
1021
|
-
`@resources` is also present, the maximum value from all decorators is
|
1022
|
-
used.
|
1023
|
-
image : str, optional, default None
|
1024
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1025
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1026
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1027
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1028
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1029
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1030
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1031
|
-
secrets : List[str], optional, default None
|
1032
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1033
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1034
|
-
in Metaflow configuration.
|
1035
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1036
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1037
|
-
gpu : int, optional, default None
|
1038
|
-
Number of GPUs required for this step. A value of zero implies that
|
1039
|
-
the scheduled node should not have GPUs.
|
1040
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1041
|
-
The vendor of the GPUs to be used for this step.
|
1042
|
-
tolerations : List[str], default []
|
1043
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1044
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1045
|
-
use_tmpfs : bool, default False
|
1046
|
-
This enables an explicit tmpfs mount for this step.
|
1047
|
-
tmpfs_tempdir : bool, default True
|
1048
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1049
|
-
tmpfs_size : int, optional, default: None
|
1050
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1051
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1052
|
-
memory allocated for this step.
|
1053
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1054
|
-
Path to tmpfs mount for this step.
|
1055
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1056
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1057
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1058
|
-
shared_memory: int, optional
|
1059
|
-
Shared memory size (in MiB) required for this step
|
1060
|
-
port: int, optional
|
1061
|
-
Port number to specify in the Kubernetes job object
|
1062
|
-
"""
|
1063
|
-
...
|
1064
|
-
|
1065
|
-
@typing.overload
|
1066
|
-
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]]]:
|
1067
|
-
"""
|
1068
|
-
Specifies the Conda environment for the step.
|
1069
|
-
|
1070
|
-
Information in this decorator will augment any
|
1071
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1072
|
-
you can use `@conda_base` to set packages required by all
|
1073
|
-
steps and use `@conda` to specify step-specific overrides.
|
1074
|
-
|
1075
|
-
Parameters
|
1076
|
-
----------
|
1077
|
-
packages : Dict[str, str], default {}
|
1078
|
-
Packages to use for this step. The key is the name of the package
|
1079
|
-
and the value is the version to use.
|
1080
|
-
libraries : Dict[str, str], default {}
|
1081
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1082
|
-
python : str, optional, default None
|
1083
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1084
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1085
|
-
disabled : bool, default False
|
1086
|
-
If set to True, disables @conda.
|
1087
|
-
"""
|
1088
|
-
...
|
1089
|
-
|
1090
|
-
@typing.overload
|
1091
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1092
|
-
...
|
1093
|
-
|
1094
|
-
@typing.overload
|
1095
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1096
|
-
...
|
1097
|
-
|
1098
|
-
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):
|
1099
|
-
"""
|
1100
|
-
Specifies the Conda environment for the step.
|
1101
|
-
|
1102
|
-
Information in this decorator will augment any
|
1103
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1104
|
-
you can use `@conda_base` to set packages required by all
|
1105
|
-
steps and use `@conda` to specify step-specific overrides.
|
1106
|
-
|
1107
|
-
Parameters
|
1108
|
-
----------
|
1109
|
-
packages : Dict[str, str], default {}
|
1110
|
-
Packages to use for this step. The key is the name of the package
|
1111
|
-
and the value is the version to use.
|
1112
|
-
libraries : Dict[str, str], default {}
|
1113
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1114
|
-
python : str, optional, default None
|
1115
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1116
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1117
|
-
disabled : bool, default False
|
1118
|
-
If set to True, disables @conda.
|
1119
|
-
"""
|
1120
|
-
...
|
1121
|
-
|
1122
|
-
@typing.overload
|
1123
|
-
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]]]:
|
1124
|
-
"""
|
1125
|
-
Specifies a timeout for your step.
|
1126
|
-
|
1127
|
-
This decorator is useful if this step may hang indefinitely.
|
1128
|
-
|
1129
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1130
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1131
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1132
|
-
|
1133
|
-
Note that all the values specified in parameters are added together so if you specify
|
1134
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1135
|
-
|
1136
|
-
Parameters
|
1137
|
-
----------
|
1138
|
-
seconds : int, default 0
|
1139
|
-
Number of seconds to wait prior to timing out.
|
1140
|
-
minutes : int, default 0
|
1141
|
-
Number of minutes to wait prior to timing out.
|
1142
|
-
hours : int, default 0
|
1143
|
-
Number of hours to wait prior to timing out.
|
1144
|
-
"""
|
1145
|
-
...
|
1146
|
-
|
1147
|
-
@typing.overload
|
1148
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1149
|
-
...
|
1150
|
-
|
1151
|
-
@typing.overload
|
1152
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1153
|
-
...
|
1154
|
-
|
1155
|
-
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):
|
1156
|
-
"""
|
1157
|
-
Specifies a timeout for your step.
|
1158
|
-
|
1159
|
-
This decorator is useful if this step may hang indefinitely.
|
1160
|
-
|
1161
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1162
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1163
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1164
|
-
|
1165
|
-
Note that all the values specified in parameters are added together so if you specify
|
1166
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1167
|
-
|
1168
|
-
Parameters
|
1169
|
-
----------
|
1170
|
-
seconds : int, default 0
|
1171
|
-
Number of seconds to wait prior to timing out.
|
1172
|
-
minutes : int, default 0
|
1173
|
-
Number of minutes to wait prior to timing out.
|
1174
|
-
hours : int, default 0
|
1175
|
-
Number of hours to wait prior to timing out.
|
1176
|
-
"""
|
1177
|
-
...
|
1178
|
-
|
1179
|
-
@typing.overload
|
1180
|
-
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[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]]]:
|
1181
|
-
"""
|
1182
|
-
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
874
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1183
875
|
|
1184
876
|
Parameters
|
1185
877
|
----------
|
@@ -1324,338 +1016,396 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1324
1016
|
...
|
1325
1017
|
|
1326
1018
|
@typing.overload
|
1327
|
-
def
|
1019
|
+
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]]]:
|
1328
1020
|
"""
|
1329
|
-
Specifies
|
1330
|
-
|
1021
|
+
Specifies a timeout for your step.
|
1022
|
+
|
1023
|
+
This decorator is useful if this step may hang indefinitely.
|
1024
|
+
|
1025
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1026
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1027
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1028
|
+
|
1029
|
+
Note that all the values specified in parameters are added together so if you specify
|
1030
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1331
1031
|
|
1332
1032
|
Parameters
|
1333
1033
|
----------
|
1334
|
-
|
1335
|
-
|
1034
|
+
seconds : int, default 0
|
1035
|
+
Number of seconds to wait prior to timing out.
|
1036
|
+
minutes : int, default 0
|
1037
|
+
Number of minutes to wait prior to timing out.
|
1038
|
+
hours : int, default 0
|
1039
|
+
Number of hours to wait prior to timing out.
|
1336
1040
|
"""
|
1337
1041
|
...
|
1338
1042
|
|
1339
1043
|
@typing.overload
|
1340
|
-
def
|
1044
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1341
1045
|
...
|
1342
1046
|
|
1343
1047
|
@typing.overload
|
1344
|
-
def
|
1048
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1345
1049
|
...
|
1346
1050
|
|
1347
|
-
def
|
1051
|
+
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):
|
1348
1052
|
"""
|
1349
|
-
Specifies
|
1350
|
-
the execution of a step.
|
1053
|
+
Specifies a timeout for your step.
|
1351
1054
|
|
1352
|
-
|
1353
|
-
----------
|
1354
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
1355
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1356
|
-
"""
|
1357
|
-
...
|
1358
|
-
|
1359
|
-
@typing.overload
|
1360
|
-
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]]]:
|
1361
|
-
"""
|
1362
|
-
Specifies the number of times the task corresponding
|
1363
|
-
to a step needs to be retried.
|
1055
|
+
This decorator is useful if this step may hang indefinitely.
|
1364
1056
|
|
1365
|
-
This
|
1366
|
-
|
1367
|
-
|
1057
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1058
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1059
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1368
1060
|
|
1369
|
-
|
1370
|
-
decorator will
|
1371
|
-
ensuring that the flow execution can continue.
|
1061
|
+
Note that all the values specified in parameters are added together so if you specify
|
1062
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1372
1063
|
|
1373
1064
|
Parameters
|
1374
1065
|
----------
|
1375
|
-
|
1376
|
-
Number of
|
1377
|
-
|
1378
|
-
Number of minutes
|
1066
|
+
seconds : int, default 0
|
1067
|
+
Number of seconds to wait prior to timing out.
|
1068
|
+
minutes : int, default 0
|
1069
|
+
Number of minutes to wait prior to timing out.
|
1070
|
+
hours : int, default 0
|
1071
|
+
Number of hours to wait prior to timing out.
|
1379
1072
|
"""
|
1380
1073
|
...
|
1381
1074
|
|
1382
1075
|
@typing.overload
|
1383
|
-
def
|
1384
|
-
...
|
1385
|
-
|
1386
|
-
@typing.overload
|
1387
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1388
|
-
...
|
1389
|
-
|
1390
|
-
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):
|
1076
|
+
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]]]:
|
1391
1077
|
"""
|
1392
|
-
Specifies the
|
1393
|
-
to a step needs to be retried.
|
1078
|
+
Specifies the resources needed when executing this step.
|
1394
1079
|
|
1395
|
-
|
1396
|
-
|
1397
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1080
|
+
Use `@resources` to specify the resource requirements
|
1081
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1398
1082
|
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1083
|
+
You can choose the compute layer on the command line by executing e.g.
|
1084
|
+
```
|
1085
|
+
python myflow.py run --with batch
|
1086
|
+
```
|
1087
|
+
or
|
1088
|
+
```
|
1089
|
+
python myflow.py run --with kubernetes
|
1090
|
+
```
|
1091
|
+
which executes the flow on the desired system using the
|
1092
|
+
requirements specified in `@resources`.
|
1402
1093
|
|
1403
1094
|
Parameters
|
1404
1095
|
----------
|
1405
|
-
|
1406
|
-
Number of
|
1407
|
-
|
1408
|
-
Number of
|
1096
|
+
cpu : int, default 1
|
1097
|
+
Number of CPUs required for this step.
|
1098
|
+
gpu : int, default 0
|
1099
|
+
Number of GPUs required for this step.
|
1100
|
+
disk : int, optional, default None
|
1101
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1102
|
+
memory : int, default 4096
|
1103
|
+
Memory size (in MB) required for this step.
|
1104
|
+
shared_memory : int, optional, default None
|
1105
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1106
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1409
1107
|
"""
|
1410
1108
|
...
|
1411
1109
|
|
1412
1110
|
@typing.overload
|
1413
|
-
def
|
1111
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1112
|
+
...
|
1113
|
+
|
1114
|
+
@typing.overload
|
1115
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1116
|
+
...
|
1117
|
+
|
1118
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
1414
1119
|
"""
|
1415
|
-
Specifies the
|
1416
|
-
|
1120
|
+
Specifies the resources needed when executing this step.
|
1121
|
+
|
1122
|
+
Use `@resources` to specify the resource requirements
|
1123
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1124
|
+
|
1125
|
+
You can choose the compute layer on the command line by executing e.g.
|
1126
|
+
```
|
1127
|
+
python myflow.py run --with batch
|
1128
|
+
```
|
1129
|
+
or
|
1130
|
+
```
|
1131
|
+
python myflow.py run --with kubernetes
|
1132
|
+
```
|
1133
|
+
which executes the flow on the desired system using the
|
1134
|
+
requirements specified in `@resources`.
|
1417
1135
|
|
1418
1136
|
Parameters
|
1419
1137
|
----------
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1138
|
+
cpu : int, default 1
|
1139
|
+
Number of CPUs required for this step.
|
1140
|
+
gpu : int, default 0
|
1141
|
+
Number of GPUs required for this step.
|
1142
|
+
disk : int, optional, default None
|
1143
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1144
|
+
memory : int, default 4096
|
1145
|
+
Memory size (in MB) required for this step.
|
1146
|
+
shared_memory : int, optional, default None
|
1147
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1148
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1432
1149
|
"""
|
1433
1150
|
...
|
1434
1151
|
|
1435
1152
|
@typing.overload
|
1436
|
-
def
|
1437
|
-
...
|
1438
|
-
|
1439
|
-
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):
|
1153
|
+
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]]]:
|
1440
1154
|
"""
|
1441
|
-
Specifies
|
1442
|
-
|
1155
|
+
Specifies that the step will success under all circumstances.
|
1156
|
+
|
1157
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1158
|
+
contains the exception raised. You can use it to detect the presence
|
1159
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1160
|
+
are missing.
|
1443
1161
|
|
1444
1162
|
Parameters
|
1445
1163
|
----------
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
cron : str, optional, default None
|
1453
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1454
|
-
specified by this expression.
|
1455
|
-
timezone : str, optional, default None
|
1456
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1457
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1164
|
+
var : str, optional, default None
|
1165
|
+
Name of the artifact in which to store the caught exception.
|
1166
|
+
If not specified, the exception is not stored.
|
1167
|
+
print_exception : bool, default True
|
1168
|
+
Determines whether or not the exception is printed to
|
1169
|
+
stdout when caught.
|
1458
1170
|
"""
|
1459
1171
|
...
|
1460
1172
|
|
1461
|
-
|
1173
|
+
@typing.overload
|
1174
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1175
|
+
...
|
1176
|
+
|
1177
|
+
@typing.overload
|
1178
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1179
|
+
...
|
1180
|
+
|
1181
|
+
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):
|
1462
1182
|
"""
|
1463
|
-
Specifies
|
1183
|
+
Specifies that the step will success under all circumstances.
|
1464
1184
|
|
1465
|
-
|
1466
|
-
use the
|
1185
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1186
|
+
contains the exception raised. You can use it to detect the presence
|
1187
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1188
|
+
are missing.
|
1467
1189
|
|
1468
1190
|
Parameters
|
1469
1191
|
----------
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1192
|
+
var : str, optional, default None
|
1193
|
+
Name of the artifact in which to store the caught exception.
|
1194
|
+
If not specified, the exception is not stored.
|
1195
|
+
print_exception : bool, default True
|
1196
|
+
Determines whether or not the exception is printed to
|
1197
|
+
stdout when caught.
|
1476
1198
|
"""
|
1477
1199
|
...
|
1478
1200
|
|
1479
1201
|
@typing.overload
|
1480
|
-
def
|
1202
|
+
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]]]:
|
1481
1203
|
"""
|
1482
|
-
|
1483
|
-
|
1484
|
-
```
|
1485
|
-
@trigger(event='foo')
|
1486
|
-
```
|
1487
|
-
or
|
1488
|
-
```
|
1489
|
-
@trigger(events=['foo', 'bar'])
|
1490
|
-
```
|
1491
|
-
|
1492
|
-
Additionally, you can specify the parameter mappings
|
1493
|
-
to map event payload to Metaflow parameters for the flow.
|
1494
|
-
```
|
1495
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1496
|
-
```
|
1497
|
-
or
|
1498
|
-
```
|
1499
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1500
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1501
|
-
```
|
1204
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1502
1205
|
|
1503
|
-
|
1504
|
-
```
|
1505
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1506
|
-
```
|
1507
|
-
This is equivalent to:
|
1508
|
-
```
|
1509
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1510
|
-
```
|
1206
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1511
1207
|
|
1512
1208
|
Parameters
|
1513
1209
|
----------
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1210
|
+
type : str, default 'default'
|
1211
|
+
Card type.
|
1212
|
+
id : str, optional, default None
|
1213
|
+
If multiple cards are present, use this id to identify this card.
|
1518
1214
|
options : Dict[str, Any], default {}
|
1519
|
-
|
1215
|
+
Options passed to the card. The contents depend on the card type.
|
1216
|
+
timeout : int, default 45
|
1217
|
+
Interrupt reporting if it takes more than this many seconds.
|
1520
1218
|
|
1521
1219
|
|
1522
1220
|
"""
|
1523
1221
|
...
|
1524
1222
|
|
1525
1223
|
@typing.overload
|
1526
|
-
def
|
1224
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1527
1225
|
...
|
1528
1226
|
|
1529
|
-
|
1227
|
+
@typing.overload
|
1228
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1229
|
+
...
|
1230
|
+
|
1231
|
+
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):
|
1530
1232
|
"""
|
1531
|
-
|
1532
|
-
|
1533
|
-
```
|
1534
|
-
@trigger(event='foo')
|
1535
|
-
```
|
1536
|
-
or
|
1537
|
-
```
|
1538
|
-
@trigger(events=['foo', 'bar'])
|
1539
|
-
```
|
1540
|
-
|
1541
|
-
Additionally, you can specify the parameter mappings
|
1542
|
-
to map event payload to Metaflow parameters for the flow.
|
1543
|
-
```
|
1544
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1545
|
-
```
|
1546
|
-
or
|
1547
|
-
```
|
1548
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1549
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1550
|
-
```
|
1233
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1551
1234
|
|
1552
|
-
|
1553
|
-
```
|
1554
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1555
|
-
```
|
1556
|
-
This is equivalent to:
|
1557
|
-
```
|
1558
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1559
|
-
```
|
1235
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1560
1236
|
|
1561
1237
|
Parameters
|
1562
1238
|
----------
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1239
|
+
type : str, default 'default'
|
1240
|
+
Card type.
|
1241
|
+
id : str, optional, default None
|
1242
|
+
If multiple cards are present, use this id to identify this card.
|
1567
1243
|
options : Dict[str, Any], default {}
|
1568
|
-
|
1244
|
+
Options passed to the card. The contents depend on the card type.
|
1245
|
+
timeout : int, default 45
|
1246
|
+
Interrupt reporting if it takes more than this many seconds.
|
1569
1247
|
|
1570
1248
|
|
1571
1249
|
"""
|
1572
1250
|
...
|
1573
1251
|
|
1252
|
+
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) -> 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]]]:
|
1253
|
+
"""
|
1254
|
+
Specifies that this step should execute on Kubernetes.
|
1255
|
+
|
1256
|
+
Parameters
|
1257
|
+
----------
|
1258
|
+
cpu : int, default 1
|
1259
|
+
Number of CPUs required for this step. If `@resources` is
|
1260
|
+
also present, the maximum value from all decorators is used.
|
1261
|
+
memory : int, default 4096
|
1262
|
+
Memory size (in MB) required for this step. If
|
1263
|
+
`@resources` is also present, the maximum value from all decorators is
|
1264
|
+
used.
|
1265
|
+
disk : int, default 10240
|
1266
|
+
Disk size (in MB) required for this step. If
|
1267
|
+
`@resources` is also present, the maximum value from all decorators is
|
1268
|
+
used.
|
1269
|
+
image : str, optional, default None
|
1270
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
1271
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1272
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1273
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1274
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1275
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1276
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
1277
|
+
secrets : List[str], optional, default None
|
1278
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1279
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1280
|
+
in Metaflow configuration.
|
1281
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1282
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
1283
|
+
gpu : int, optional, default None
|
1284
|
+
Number of GPUs required for this step. A value of zero implies that
|
1285
|
+
the scheduled node should not have GPUs.
|
1286
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1287
|
+
The vendor of the GPUs to be used for this step.
|
1288
|
+
tolerations : List[str], default []
|
1289
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1290
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1291
|
+
use_tmpfs : bool, default False
|
1292
|
+
This enables an explicit tmpfs mount for this step.
|
1293
|
+
tmpfs_tempdir : bool, default True
|
1294
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1295
|
+
tmpfs_size : int, optional, default: None
|
1296
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1297
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1298
|
+
memory allocated for this step.
|
1299
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
1300
|
+
Path to tmpfs mount for this step.
|
1301
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
1302
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1303
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1304
|
+
shared_memory: int, optional
|
1305
|
+
Shared memory size (in MiB) required for this step
|
1306
|
+
port: int, optional
|
1307
|
+
Port number to specify in the Kubernetes job object
|
1308
|
+
"""
|
1309
|
+
...
|
1310
|
+
|
1574
1311
|
@typing.overload
|
1575
|
-
def
|
1312
|
+
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]]]:
|
1576
1313
|
"""
|
1577
|
-
Specifies
|
1314
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1315
|
+
the execution of a step.
|
1578
1316
|
|
1579
|
-
Use `@pypi_base` to set common packages required by all
|
1580
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1581
1317
|
Parameters
|
1582
1318
|
----------
|
1583
|
-
|
1584
|
-
|
1585
|
-
and the value is the version to use.
|
1586
|
-
python : str, optional, default: None
|
1587
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1588
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1319
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1320
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1589
1321
|
"""
|
1590
1322
|
...
|
1591
1323
|
|
1592
1324
|
@typing.overload
|
1593
|
-
def
|
1325
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1594
1326
|
...
|
1595
1327
|
|
1596
|
-
|
1328
|
+
@typing.overload
|
1329
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1330
|
+
...
|
1331
|
+
|
1332
|
+
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]]] = []):
|
1597
1333
|
"""
|
1598
|
-
Specifies
|
1334
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1335
|
+
the execution of a step.
|
1599
1336
|
|
1600
|
-
Use `@pypi_base` to set common packages required by all
|
1601
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1602
1337
|
Parameters
|
1603
1338
|
----------
|
1604
|
-
|
1605
|
-
|
1606
|
-
and the value is the version to use.
|
1607
|
-
python : str, optional, default: None
|
1608
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1609
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1339
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1340
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1610
1341
|
"""
|
1611
1342
|
...
|
1612
1343
|
|
1613
1344
|
@typing.overload
|
1614
|
-
def
|
1345
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1615
1346
|
"""
|
1616
|
-
|
1347
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1348
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1349
|
+
"""
|
1350
|
+
...
|
1351
|
+
|
1352
|
+
@typing.overload
|
1353
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1354
|
+
...
|
1355
|
+
|
1356
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1357
|
+
"""
|
1358
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1359
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1360
|
+
"""
|
1361
|
+
...
|
1362
|
+
|
1363
|
+
@typing.overload
|
1364
|
+
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]]]:
|
1365
|
+
"""
|
1366
|
+
Specifies the PyPI packages for the step.
|
1617
1367
|
|
1618
|
-
|
1619
|
-
|
1368
|
+
Information in this decorator will augment any
|
1369
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1370
|
+
you can use `@pypi_base` to set packages required by all
|
1371
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1620
1372
|
|
1621
1373
|
Parameters
|
1622
1374
|
----------
|
1623
|
-
packages : Dict[str, str], default {}
|
1624
|
-
Packages to use for this
|
1375
|
+
packages : Dict[str, str], default: {}
|
1376
|
+
Packages to use for this step. The key is the name of the package
|
1625
1377
|
and the value is the version to use.
|
1626
|
-
|
1627
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1628
|
-
python : str, optional, default None
|
1378
|
+
python : str, optional, default: None
|
1629
1379
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1630
1380
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1631
|
-
disabled : bool, default False
|
1632
|
-
If set to True, disables Conda.
|
1633
1381
|
"""
|
1634
1382
|
...
|
1635
1383
|
|
1636
1384
|
@typing.overload
|
1637
|
-
def
|
1385
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1638
1386
|
...
|
1639
1387
|
|
1640
|
-
|
1388
|
+
@typing.overload
|
1389
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1390
|
+
...
|
1391
|
+
|
1392
|
+
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):
|
1641
1393
|
"""
|
1642
|
-
Specifies the
|
1394
|
+
Specifies the PyPI packages for the step.
|
1643
1395
|
|
1644
|
-
|
1645
|
-
|
1396
|
+
Information in this decorator will augment any
|
1397
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1398
|
+
you can use `@pypi_base` to set packages required by all
|
1399
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1646
1400
|
|
1647
1401
|
Parameters
|
1648
1402
|
----------
|
1649
|
-
packages : Dict[str, str], default {}
|
1650
|
-
Packages to use for this
|
1403
|
+
packages : Dict[str, str], default: {}
|
1404
|
+
Packages to use for this step. The key is the name of the package
|
1651
1405
|
and the value is the version to use.
|
1652
|
-
|
1653
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1654
|
-
python : str, optional, default None
|
1406
|
+
python : str, optional, default: None
|
1655
1407
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1656
1408
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1657
|
-
disabled : bool, default False
|
1658
|
-
If set to True, disables Conda.
|
1659
1409
|
"""
|
1660
1410
|
...
|
1661
1411
|
|
@@ -1743,6 +1493,104 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1743
1493
|
"""
|
1744
1494
|
...
|
1745
1495
|
|
1496
|
+
@typing.overload
|
1497
|
+
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]]:
|
1498
|
+
"""
|
1499
|
+
Specifies the times when the flow should be run when running on a
|
1500
|
+
production scheduler.
|
1501
|
+
|
1502
|
+
Parameters
|
1503
|
+
----------
|
1504
|
+
hourly : bool, default False
|
1505
|
+
Run the workflow hourly.
|
1506
|
+
daily : bool, default True
|
1507
|
+
Run the workflow daily.
|
1508
|
+
weekly : bool, default False
|
1509
|
+
Run the workflow weekly.
|
1510
|
+
cron : str, optional, default None
|
1511
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1512
|
+
specified by this expression.
|
1513
|
+
timezone : str, optional, default None
|
1514
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1515
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1516
|
+
"""
|
1517
|
+
...
|
1518
|
+
|
1519
|
+
@typing.overload
|
1520
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1521
|
+
...
|
1522
|
+
|
1523
|
+
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):
|
1524
|
+
"""
|
1525
|
+
Specifies the times when the flow should be run when running on a
|
1526
|
+
production scheduler.
|
1527
|
+
|
1528
|
+
Parameters
|
1529
|
+
----------
|
1530
|
+
hourly : bool, default False
|
1531
|
+
Run the workflow hourly.
|
1532
|
+
daily : bool, default True
|
1533
|
+
Run the workflow daily.
|
1534
|
+
weekly : bool, default False
|
1535
|
+
Run the workflow weekly.
|
1536
|
+
cron : str, optional, default None
|
1537
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1538
|
+
specified by this expression.
|
1539
|
+
timezone : str, optional, default None
|
1540
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1541
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1542
|
+
"""
|
1543
|
+
...
|
1544
|
+
|
1545
|
+
@typing.overload
|
1546
|
+
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]]:
|
1547
|
+
"""
|
1548
|
+
Specifies the Conda environment for all steps of the flow.
|
1549
|
+
|
1550
|
+
Use `@conda_base` to set common libraries required by all
|
1551
|
+
steps and use `@conda` to specify step-specific additions.
|
1552
|
+
|
1553
|
+
Parameters
|
1554
|
+
----------
|
1555
|
+
packages : Dict[str, str], default {}
|
1556
|
+
Packages to use for this flow. The key is the name of the package
|
1557
|
+
and the value is the version to use.
|
1558
|
+
libraries : Dict[str, str], default {}
|
1559
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1560
|
+
python : str, optional, default None
|
1561
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1562
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1563
|
+
disabled : bool, default False
|
1564
|
+
If set to True, disables Conda.
|
1565
|
+
"""
|
1566
|
+
...
|
1567
|
+
|
1568
|
+
@typing.overload
|
1569
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1570
|
+
...
|
1571
|
+
|
1572
|
+
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):
|
1573
|
+
"""
|
1574
|
+
Specifies the Conda environment for all steps of the flow.
|
1575
|
+
|
1576
|
+
Use `@conda_base` to set common libraries required by all
|
1577
|
+
steps and use `@conda` to specify step-specific additions.
|
1578
|
+
|
1579
|
+
Parameters
|
1580
|
+
----------
|
1581
|
+
packages : Dict[str, str], default {}
|
1582
|
+
Packages to use for this flow. The key is the name of the package
|
1583
|
+
and the value is the version to use.
|
1584
|
+
libraries : Dict[str, str], default {}
|
1585
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1586
|
+
python : str, optional, default None
|
1587
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1588
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1589
|
+
disabled : bool, default False
|
1590
|
+
If set to True, disables Conda.
|
1591
|
+
"""
|
1592
|
+
...
|
1593
|
+
|
1746
1594
|
@typing.overload
|
1747
1595
|
def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[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]]:
|
1748
1596
|
"""
|
@@ -1846,6 +1694,158 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1846
1694
|
"""
|
1847
1695
|
...
|
1848
1696
|
|
1697
|
+
@typing.overload
|
1698
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1699
|
+
"""
|
1700
|
+
Specifies the PyPI packages for all steps of the flow.
|
1701
|
+
|
1702
|
+
Use `@pypi_base` to set common packages required by all
|
1703
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1704
|
+
Parameters
|
1705
|
+
----------
|
1706
|
+
packages : Dict[str, str], default: {}
|
1707
|
+
Packages to use for this flow. The key is the name of the package
|
1708
|
+
and the value is the version to use.
|
1709
|
+
python : str, optional, default: None
|
1710
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1711
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1712
|
+
"""
|
1713
|
+
...
|
1714
|
+
|
1715
|
+
@typing.overload
|
1716
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1717
|
+
...
|
1718
|
+
|
1719
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1720
|
+
"""
|
1721
|
+
Specifies the PyPI packages for all steps of the flow.
|
1722
|
+
|
1723
|
+
Use `@pypi_base` to set common packages required by all
|
1724
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1725
|
+
Parameters
|
1726
|
+
----------
|
1727
|
+
packages : Dict[str, str], default: {}
|
1728
|
+
Packages to use for this flow. The key is the name of the package
|
1729
|
+
and the value is the version to use.
|
1730
|
+
python : str, optional, default: None
|
1731
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1732
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1733
|
+
"""
|
1734
|
+
...
|
1735
|
+
|
1736
|
+
@typing.overload
|
1737
|
+
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]]:
|
1738
|
+
"""
|
1739
|
+
Specifies the event(s) that this flow depends on.
|
1740
|
+
|
1741
|
+
```
|
1742
|
+
@trigger(event='foo')
|
1743
|
+
```
|
1744
|
+
or
|
1745
|
+
```
|
1746
|
+
@trigger(events=['foo', 'bar'])
|
1747
|
+
```
|
1748
|
+
|
1749
|
+
Additionally, you can specify the parameter mappings
|
1750
|
+
to map event payload to Metaflow parameters for the flow.
|
1751
|
+
```
|
1752
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1753
|
+
```
|
1754
|
+
or
|
1755
|
+
```
|
1756
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1757
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1758
|
+
```
|
1759
|
+
|
1760
|
+
'parameters' can also be a list of strings and tuples like so:
|
1761
|
+
```
|
1762
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1763
|
+
```
|
1764
|
+
This is equivalent to:
|
1765
|
+
```
|
1766
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1767
|
+
```
|
1768
|
+
|
1769
|
+
Parameters
|
1770
|
+
----------
|
1771
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1772
|
+
Event dependency for this flow.
|
1773
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1774
|
+
Events dependency for this flow.
|
1775
|
+
options : Dict[str, Any], default {}
|
1776
|
+
Backend-specific configuration for tuning eventing behavior.
|
1777
|
+
|
1778
|
+
|
1779
|
+
"""
|
1780
|
+
...
|
1781
|
+
|
1782
|
+
@typing.overload
|
1783
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1784
|
+
...
|
1785
|
+
|
1786
|
+
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] = {}):
|
1787
|
+
"""
|
1788
|
+
Specifies the event(s) that this flow depends on.
|
1789
|
+
|
1790
|
+
```
|
1791
|
+
@trigger(event='foo')
|
1792
|
+
```
|
1793
|
+
or
|
1794
|
+
```
|
1795
|
+
@trigger(events=['foo', 'bar'])
|
1796
|
+
```
|
1797
|
+
|
1798
|
+
Additionally, you can specify the parameter mappings
|
1799
|
+
to map event payload to Metaflow parameters for the flow.
|
1800
|
+
```
|
1801
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1802
|
+
```
|
1803
|
+
or
|
1804
|
+
```
|
1805
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1806
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1807
|
+
```
|
1808
|
+
|
1809
|
+
'parameters' can also be a list of strings and tuples like so:
|
1810
|
+
```
|
1811
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1812
|
+
```
|
1813
|
+
This is equivalent to:
|
1814
|
+
```
|
1815
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1816
|
+
```
|
1817
|
+
|
1818
|
+
Parameters
|
1819
|
+
----------
|
1820
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1821
|
+
Event dependency for this flow.
|
1822
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1823
|
+
Events dependency for this flow.
|
1824
|
+
options : Dict[str, Any], default {}
|
1825
|
+
Backend-specific configuration for tuning eventing behavior.
|
1826
|
+
|
1827
|
+
|
1828
|
+
"""
|
1829
|
+
...
|
1830
|
+
|
1831
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1832
|
+
"""
|
1833
|
+
Specifies what flows belong to the same project.
|
1834
|
+
|
1835
|
+
A project-specific namespace is created for all flows that
|
1836
|
+
use the same `@project(name)`.
|
1837
|
+
|
1838
|
+
Parameters
|
1839
|
+
----------
|
1840
|
+
name : str
|
1841
|
+
Project name. Make sure that the name is unique amongst all
|
1842
|
+
projects that use the same production scheduler. The name may
|
1843
|
+
contain only lowercase alphanumeric characters and underscores.
|
1844
|
+
|
1845
|
+
|
1846
|
+
"""
|
1847
|
+
...
|
1848
|
+
|
1849
1849
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1850
1850
|
"""
|
1851
1851
|
Switch namespace to the one provided.
|