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