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