ob-metaflow-stubs 4.7__py2.py3-none-any.whl → 4.8__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 +520 -471
- metaflow-stubs/cards.pyi +5 -5
- 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 +3 -3
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +31 -8
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +7 -3
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +5 -5
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +37 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +269 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +229 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +292 -0
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +23 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +260 -0
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +4 -4
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +4 -4
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- 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 +5 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +18 -10
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +12 -12
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +14 -31
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +82 -28
- metaflow-stubs/plugins/logs_cli.pyi +3 -3
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +47 -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 +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +3 -3
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +4 -4
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +26 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +354 -0
- metaflow-stubs/runner/metaflow_runner.pyi +10 -10
- metaflow-stubs/runner/nbdeploy.pyi +54 -0
- metaflow-stubs/runner/nbrun.pyi +7 -7
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +25 -0
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- {ob_metaflow_stubs-4.7.dist-info → ob_metaflow_stubs-4.8.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-4.8.dist-info/RECORD +150 -0
- ob_metaflow_stubs-4.7.dist-info/RECORD +0 -145
- {ob_metaflow_stubs-4.7.dist-info → ob_metaflow_stubs-4.8.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-4.7.dist-info → ob_metaflow_stubs-4.8.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.12.
|
4
|
-
# Generated on 2024-07-
|
3
|
+
# MF version: 2.12.9.1+ob(v1) #
|
4
|
+
# Generated on 2024-07-25T19:14:17.762690 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -9,17 +9,17 @@ from __future__ import annotations
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
11
|
import typing
|
12
|
+
import metaflow._vendor.click.types
|
12
13
|
import datetime
|
14
|
+
import metaflow.client.core
|
15
|
+
import metaflow.datastore.inputs
|
16
|
+
import metaflow.events
|
13
17
|
import metaflow.plugins.datatools.s3.s3
|
14
18
|
import metaflow.parameters
|
15
|
-
import metaflow.datastore.inputs
|
16
|
-
import metaflow.runner.metaflow_runner
|
17
19
|
import io
|
18
|
-
import metaflow.metaflow_current
|
19
20
|
import metaflow.flowspec
|
20
|
-
import metaflow.
|
21
|
-
import metaflow.
|
22
|
-
import metaflow.events
|
21
|
+
import metaflow.runner.metaflow_runner
|
22
|
+
import metaflow.metaflow_current
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -727,6 +727,131 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
727
727
|
"""
|
728
728
|
...
|
729
729
|
|
730
|
+
@typing.overload
|
731
|
+
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]]]:
|
732
|
+
"""
|
733
|
+
Specifies the PyPI packages for the step.
|
734
|
+
|
735
|
+
Information in this decorator will augment any
|
736
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
737
|
+
you can use `@pypi_base` to set packages required by all
|
738
|
+
steps and use `@pypi` to specify step-specific overrides.
|
739
|
+
|
740
|
+
Parameters
|
741
|
+
----------
|
742
|
+
packages : Dict[str, str], default: {}
|
743
|
+
Packages to use for this step. The key is the name of the package
|
744
|
+
and the value is the version to use.
|
745
|
+
python : str, optional, default: None
|
746
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
747
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
748
|
+
"""
|
749
|
+
...
|
750
|
+
|
751
|
+
@typing.overload
|
752
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
753
|
+
...
|
754
|
+
|
755
|
+
@typing.overload
|
756
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
757
|
+
...
|
758
|
+
|
759
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
760
|
+
"""
|
761
|
+
Specifies the PyPI packages for the step.
|
762
|
+
|
763
|
+
Information in this decorator will augment any
|
764
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
765
|
+
you can use `@pypi_base` to set packages required by all
|
766
|
+
steps and use `@pypi` to specify step-specific overrides.
|
767
|
+
|
768
|
+
Parameters
|
769
|
+
----------
|
770
|
+
packages : Dict[str, str], default: {}
|
771
|
+
Packages to use for this step. The key is the name of the package
|
772
|
+
and the value is the version to use.
|
773
|
+
python : str, optional, default: None
|
774
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
775
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
776
|
+
"""
|
777
|
+
...
|
778
|
+
|
779
|
+
@typing.overload
|
780
|
+
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]]]:
|
781
|
+
"""
|
782
|
+
Specifies the Conda environment for the step.
|
783
|
+
|
784
|
+
Information in this decorator will augment any
|
785
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
786
|
+
you can use `@conda_base` to set packages required by all
|
787
|
+
steps and use `@conda` to specify step-specific overrides.
|
788
|
+
|
789
|
+
Parameters
|
790
|
+
----------
|
791
|
+
packages : Dict[str, str], default {}
|
792
|
+
Packages to use for this step. The key is the name of the package
|
793
|
+
and the value is the version to use.
|
794
|
+
libraries : Dict[str, str], default {}
|
795
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
796
|
+
python : str, optional, default None
|
797
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
798
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
799
|
+
disabled : bool, default False
|
800
|
+
If set to True, disables @conda.
|
801
|
+
"""
|
802
|
+
...
|
803
|
+
|
804
|
+
@typing.overload
|
805
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
806
|
+
...
|
807
|
+
|
808
|
+
@typing.overload
|
809
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
810
|
+
...
|
811
|
+
|
812
|
+
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):
|
813
|
+
"""
|
814
|
+
Specifies the Conda environment for the step.
|
815
|
+
|
816
|
+
Information in this decorator will augment any
|
817
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
818
|
+
you can use `@conda_base` to set packages required by all
|
819
|
+
steps and use `@conda` to specify step-specific overrides.
|
820
|
+
|
821
|
+
Parameters
|
822
|
+
----------
|
823
|
+
packages : Dict[str, str], default {}
|
824
|
+
Packages to use for this step. The key is the name of the package
|
825
|
+
and the value is the version to use.
|
826
|
+
libraries : Dict[str, str], default {}
|
827
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
828
|
+
python : str, optional, default None
|
829
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
830
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
831
|
+
disabled : bool, default False
|
832
|
+
If set to True, disables @conda.
|
833
|
+
"""
|
834
|
+
...
|
835
|
+
|
836
|
+
@typing.overload
|
837
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
838
|
+
"""
|
839
|
+
Decorator prototype for all step decorators. This function gets specialized
|
840
|
+
and imported for all decorators types by _import_plugin_decorators().
|
841
|
+
"""
|
842
|
+
...
|
843
|
+
|
844
|
+
@typing.overload
|
845
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
846
|
+
...
|
847
|
+
|
848
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
849
|
+
"""
|
850
|
+
Decorator prototype for all step decorators. This function gets specialized
|
851
|
+
and imported for all decorators types by _import_plugin_decorators().
|
852
|
+
"""
|
853
|
+
...
|
854
|
+
|
730
855
|
@typing.overload
|
731
856
|
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]]]:
|
732
857
|
"""
|
@@ -781,79 +906,51 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
781
906
|
...
|
782
907
|
|
783
908
|
@typing.overload
|
784
|
-
def
|
909
|
+
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]]]:
|
785
910
|
"""
|
786
|
-
Specifies the
|
787
|
-
|
788
|
-
Use `@resources` to specify the resource requirements
|
789
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
911
|
+
Specifies that the step will success under all circumstances.
|
790
912
|
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
or
|
796
|
-
```
|
797
|
-
python myflow.py run --with kubernetes
|
798
|
-
```
|
799
|
-
which executes the flow on the desired system using the
|
800
|
-
requirements specified in `@resources`.
|
913
|
+
The decorator will create an optional artifact, specified by `var`, which
|
914
|
+
contains the exception raised. You can use it to detect the presence
|
915
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
916
|
+
are missing.
|
801
917
|
|
802
918
|
Parameters
|
803
919
|
----------
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
memory : int, default 4096
|
811
|
-
Memory size (in MB) required for this step.
|
812
|
-
shared_memory : int, optional, default None
|
813
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
814
|
-
This parameter maps to the `--shm-size` option in Docker.
|
920
|
+
var : str, optional, default None
|
921
|
+
Name of the artifact in which to store the caught exception.
|
922
|
+
If not specified, the exception is not stored.
|
923
|
+
print_exception : bool, default True
|
924
|
+
Determines whether or not the exception is printed to
|
925
|
+
stdout when caught.
|
815
926
|
"""
|
816
927
|
...
|
817
928
|
|
818
929
|
@typing.overload
|
819
|
-
def
|
930
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
820
931
|
...
|
821
932
|
|
822
933
|
@typing.overload
|
823
|
-
def
|
934
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
824
935
|
...
|
825
936
|
|
826
|
-
def
|
937
|
+
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):
|
827
938
|
"""
|
828
|
-
Specifies the
|
829
|
-
|
830
|
-
Use `@resources` to specify the resource requirements
|
831
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
939
|
+
Specifies that the step will success under all circumstances.
|
832
940
|
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
or
|
838
|
-
```
|
839
|
-
python myflow.py run --with kubernetes
|
840
|
-
```
|
841
|
-
which executes the flow on the desired system using the
|
842
|
-
requirements specified in `@resources`.
|
941
|
+
The decorator will create an optional artifact, specified by `var`, which
|
942
|
+
contains the exception raised. You can use it to detect the presence
|
943
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
944
|
+
are missing.
|
843
945
|
|
844
946
|
Parameters
|
845
947
|
----------
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
memory : int, default 4096
|
853
|
-
Memory size (in MB) required for this step.
|
854
|
-
shared_memory : int, optional, default None
|
855
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
856
|
-
This parameter maps to the `--shm-size` option in Docker.
|
948
|
+
var : str, optional, default None
|
949
|
+
Name of the artifact in which to store the caught exception.
|
950
|
+
If not specified, the exception is not stored.
|
951
|
+
print_exception : bool, default True
|
952
|
+
Determines whether or not the exception is printed to
|
953
|
+
stdout when caught.
|
857
954
|
"""
|
858
955
|
...
|
859
956
|
|
@@ -1005,92 +1102,33 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1005
1102
|
...
|
1006
1103
|
|
1007
1104
|
@typing.overload
|
1008
|
-
def
|
1105
|
+
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]]]:
|
1009
1106
|
"""
|
1010
|
-
Specifies
|
1011
|
-
|
1012
|
-
This decorator is useful if this step may hang indefinitely.
|
1013
|
-
|
1014
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1015
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1016
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1017
|
-
|
1018
|
-
Note that all the values specified in parameters are added together so if you specify
|
1019
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1107
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1020
1108
|
|
1021
1109
|
Parameters
|
1022
1110
|
----------
|
1023
|
-
|
1024
|
-
|
1025
|
-
minutes : int, default 0
|
1026
|
-
Number of minutes to wait prior to timing out.
|
1027
|
-
hours : int, default 0
|
1028
|
-
Number of hours to wait prior to timing out.
|
1111
|
+
vars : Dict[str, str], default {}
|
1112
|
+
Dictionary of environment variables to set.
|
1029
1113
|
"""
|
1030
1114
|
...
|
1031
1115
|
|
1032
1116
|
@typing.overload
|
1033
|
-
def
|
1117
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1034
1118
|
...
|
1035
1119
|
|
1036
1120
|
@typing.overload
|
1037
|
-
def
|
1121
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1038
1122
|
...
|
1039
1123
|
|
1040
|
-
def
|
1124
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1041
1125
|
"""
|
1042
|
-
Specifies
|
1043
|
-
|
1044
|
-
This decorator is useful if this step may hang indefinitely.
|
1045
|
-
|
1046
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1047
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1048
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1049
|
-
|
1050
|
-
Note that all the values specified in parameters are added together so if you specify
|
1051
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1126
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1052
1127
|
|
1053
1128
|
Parameters
|
1054
1129
|
----------
|
1055
|
-
|
1056
|
-
|
1057
|
-
minutes : int, default 0
|
1058
|
-
Number of minutes to wait prior to timing out.
|
1059
|
-
hours : int, default 0
|
1060
|
-
Number of hours to wait prior to timing out.
|
1061
|
-
"""
|
1062
|
-
...
|
1063
|
-
|
1064
|
-
@typing.overload
|
1065
|
-
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]]]:
|
1066
|
-
"""
|
1067
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
1068
|
-
the execution of a step.
|
1069
|
-
|
1070
|
-
Parameters
|
1071
|
-
----------
|
1072
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
1073
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1074
|
-
"""
|
1075
|
-
...
|
1076
|
-
|
1077
|
-
@typing.overload
|
1078
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1079
|
-
...
|
1080
|
-
|
1081
|
-
@typing.overload
|
1082
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1083
|
-
...
|
1084
|
-
|
1085
|
-
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]]] = []):
|
1086
|
-
"""
|
1087
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
1088
|
-
the execution of a step.
|
1089
|
-
|
1090
|
-
Parameters
|
1091
|
-
----------
|
1092
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
1093
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1130
|
+
vars : Dict[str, str], default {}
|
1131
|
+
Dictionary of environment variables to set.
|
1094
1132
|
"""
|
1095
1133
|
...
|
1096
1134
|
|
@@ -1154,157 +1192,92 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
1154
1192
|
...
|
1155
1193
|
|
1156
1194
|
@typing.overload
|
1157
|
-
def
|
1195
|
+
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]]]:
|
1158
1196
|
"""
|
1159
|
-
Specifies
|
1160
|
-
|
1161
|
-
Information in this decorator will augment any
|
1162
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1163
|
-
you can use `@conda_base` to set packages required by all
|
1164
|
-
steps and use `@conda` to specify step-specific overrides.
|
1197
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1198
|
+
the execution of a step.
|
1165
1199
|
|
1166
1200
|
Parameters
|
1167
1201
|
----------
|
1168
|
-
|
1169
|
-
|
1170
|
-
and the value is the version to use.
|
1171
|
-
libraries : Dict[str, str], default {}
|
1172
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1173
|
-
python : str, optional, default None
|
1174
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1175
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1176
|
-
disabled : bool, default False
|
1177
|
-
If set to True, disables @conda.
|
1202
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1203
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1178
1204
|
"""
|
1179
1205
|
...
|
1180
1206
|
|
1181
1207
|
@typing.overload
|
1182
|
-
def
|
1208
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1183
1209
|
...
|
1184
1210
|
|
1185
1211
|
@typing.overload
|
1186
|
-
def
|
1187
|
-
...
|
1188
|
-
|
1189
|
-
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):
|
1190
|
-
"""
|
1191
|
-
Specifies the Conda environment for the step.
|
1192
|
-
|
1193
|
-
Information in this decorator will augment any
|
1194
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1195
|
-
you can use `@conda_base` to set packages required by all
|
1196
|
-
steps and use `@conda` to specify step-specific overrides.
|
1197
|
-
|
1198
|
-
Parameters
|
1199
|
-
----------
|
1200
|
-
packages : Dict[str, str], default {}
|
1201
|
-
Packages to use for this step. The key is the name of the package
|
1202
|
-
and the value is the version to use.
|
1203
|
-
libraries : Dict[str, str], default {}
|
1204
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1205
|
-
python : str, optional, default None
|
1206
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1207
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1208
|
-
disabled : bool, default False
|
1209
|
-
If set to True, disables @conda.
|
1210
|
-
"""
|
1212
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1211
1213
|
...
|
1212
1214
|
|
1213
|
-
|
1214
|
-
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]]]:
|
1215
|
+
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]]] = []):
|
1215
1216
|
"""
|
1216
|
-
Specifies
|
1217
|
-
|
1218
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1219
|
-
contains the exception raised. You can use it to detect the presence
|
1220
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1221
|
-
are missing.
|
1217
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1218
|
+
the execution of a step.
|
1222
1219
|
|
1223
1220
|
Parameters
|
1224
1221
|
----------
|
1225
|
-
|
1226
|
-
|
1227
|
-
If not specified, the exception is not stored.
|
1228
|
-
print_exception : bool, default True
|
1229
|
-
Determines whether or not the exception is printed to
|
1230
|
-
stdout when caught.
|
1222
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1223
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1231
1224
|
"""
|
1232
1225
|
...
|
1233
1226
|
|
1234
1227
|
@typing.overload
|
1235
|
-
def
|
1236
|
-
...
|
1237
|
-
|
1238
|
-
@typing.overload
|
1239
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1240
|
-
...
|
1241
|
-
|
1242
|
-
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):
|
1228
|
+
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]]]:
|
1243
1229
|
"""
|
1244
|
-
Specifies
|
1230
|
+
Specifies a timeout for your step.
|
1245
1231
|
|
1246
|
-
|
1247
|
-
contains the exception raised. You can use it to detect the presence
|
1248
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1249
|
-
are missing.
|
1232
|
+
This decorator is useful if this step may hang indefinitely.
|
1250
1233
|
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
Name of the artifact in which to store the caught exception.
|
1255
|
-
If not specified, the exception is not stored.
|
1256
|
-
print_exception : bool, default True
|
1257
|
-
Determines whether or not the exception is printed to
|
1258
|
-
stdout when caught.
|
1259
|
-
"""
|
1260
|
-
...
|
1261
|
-
|
1262
|
-
@typing.overload
|
1263
|
-
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]]]:
|
1264
|
-
"""
|
1265
|
-
Specifies the PyPI packages for the step.
|
1234
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1235
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1236
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1266
1237
|
|
1267
|
-
|
1268
|
-
|
1269
|
-
you can use `@pypi_base` to set packages required by all
|
1270
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1238
|
+
Note that all the values specified in parameters are added together so if you specify
|
1239
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1271
1240
|
|
1272
1241
|
Parameters
|
1273
1242
|
----------
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1243
|
+
seconds : int, default 0
|
1244
|
+
Number of seconds to wait prior to timing out.
|
1245
|
+
minutes : int, default 0
|
1246
|
+
Number of minutes to wait prior to timing out.
|
1247
|
+
hours : int, default 0
|
1248
|
+
Number of hours to wait prior to timing out.
|
1280
1249
|
"""
|
1281
1250
|
...
|
1282
1251
|
|
1283
1252
|
@typing.overload
|
1284
|
-
def
|
1253
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1285
1254
|
...
|
1286
1255
|
|
1287
1256
|
@typing.overload
|
1288
|
-
def
|
1257
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1289
1258
|
...
|
1290
1259
|
|
1291
|
-
def
|
1260
|
+
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):
|
1292
1261
|
"""
|
1293
|
-
Specifies
|
1262
|
+
Specifies a timeout for your step.
|
1294
1263
|
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1264
|
+
This decorator is useful if this step may hang indefinitely.
|
1265
|
+
|
1266
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1267
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1268
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1269
|
+
|
1270
|
+
Note that all the values specified in parameters are added together so if you specify
|
1271
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1299
1272
|
|
1300
1273
|
Parameters
|
1301
1274
|
----------
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1275
|
+
seconds : int, default 0
|
1276
|
+
Number of seconds to wait prior to timing out.
|
1277
|
+
minutes : int, default 0
|
1278
|
+
Number of minutes to wait prior to timing out.
|
1279
|
+
hours : int, default 0
|
1280
|
+
Number of hours to wait prior to timing out.
|
1308
1281
|
"""
|
1309
1282
|
...
|
1310
1283
|
|
@@ -1360,79 +1333,121 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
1360
1333
|
...
|
1361
1334
|
|
1362
1335
|
@typing.overload
|
1363
|
-
def
|
1336
|
+
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]]]:
|
1364
1337
|
"""
|
1365
|
-
Specifies
|
1338
|
+
Specifies the resources needed when executing this step.
|
1339
|
+
|
1340
|
+
Use `@resources` to specify the resource requirements
|
1341
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1342
|
+
|
1343
|
+
You can choose the compute layer on the command line by executing e.g.
|
1344
|
+
```
|
1345
|
+
python myflow.py run --with batch
|
1346
|
+
```
|
1347
|
+
or
|
1348
|
+
```
|
1349
|
+
python myflow.py run --with kubernetes
|
1350
|
+
```
|
1351
|
+
which executes the flow on the desired system using the
|
1352
|
+
requirements specified in `@resources`.
|
1366
1353
|
|
1367
1354
|
Parameters
|
1368
1355
|
----------
|
1369
|
-
|
1370
|
-
|
1356
|
+
cpu : int, default 1
|
1357
|
+
Number of CPUs required for this step.
|
1358
|
+
gpu : int, default 0
|
1359
|
+
Number of GPUs required for this step.
|
1360
|
+
disk : int, optional, default None
|
1361
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1362
|
+
memory : int, default 4096
|
1363
|
+
Memory size (in MB) required for this step.
|
1364
|
+
shared_memory : int, optional, default None
|
1365
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1366
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1371
1367
|
"""
|
1372
1368
|
...
|
1373
1369
|
|
1374
1370
|
@typing.overload
|
1375
|
-
def
|
1371
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1376
1372
|
...
|
1377
1373
|
|
1378
1374
|
@typing.overload
|
1379
|
-
def
|
1375
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1380
1376
|
...
|
1381
1377
|
|
1382
|
-
def
|
1378
|
+
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):
|
1383
1379
|
"""
|
1384
|
-
Specifies
|
1380
|
+
Specifies the resources needed when executing this step.
|
1381
|
+
|
1382
|
+
Use `@resources` to specify the resource requirements
|
1383
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1384
|
+
|
1385
|
+
You can choose the compute layer on the command line by executing e.g.
|
1386
|
+
```
|
1387
|
+
python myflow.py run --with batch
|
1388
|
+
```
|
1389
|
+
or
|
1390
|
+
```
|
1391
|
+
python myflow.py run --with kubernetes
|
1392
|
+
```
|
1393
|
+
which executes the flow on the desired system using the
|
1394
|
+
requirements specified in `@resources`.
|
1385
1395
|
|
1386
1396
|
Parameters
|
1387
1397
|
----------
|
1388
|
-
|
1389
|
-
|
1398
|
+
cpu : int, default 1
|
1399
|
+
Number of CPUs required for this step.
|
1400
|
+
gpu : int, default 0
|
1401
|
+
Number of GPUs required for this step.
|
1402
|
+
disk : int, optional, default None
|
1403
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1404
|
+
memory : int, default 4096
|
1405
|
+
Memory size (in MB) required for this step.
|
1406
|
+
shared_memory : int, optional, default None
|
1407
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1408
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1390
1409
|
"""
|
1391
1410
|
...
|
1392
1411
|
|
1393
1412
|
@typing.overload
|
1394
|
-
def
|
1413
|
+
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]]:
|
1395
1414
|
"""
|
1396
|
-
Specifies the
|
1415
|
+
Specifies the event(s) that this flow depends on.
|
1397
1416
|
|
1398
1417
|
```
|
1399
|
-
@
|
1418
|
+
@trigger(event='foo')
|
1400
1419
|
```
|
1401
1420
|
or
|
1402
1421
|
```
|
1403
|
-
@
|
1422
|
+
@trigger(events=['foo', 'bar'])
|
1404
1423
|
```
|
1405
|
-
This decorator respects the @project decorator and triggers the flow
|
1406
|
-
when upstream runs within the same namespace complete successfully
|
1407
1424
|
|
1408
|
-
Additionally, you can specify
|
1409
|
-
|
1425
|
+
Additionally, you can specify the parameter mappings
|
1426
|
+
to map event payload to Metaflow parameters for the flow.
|
1410
1427
|
```
|
1411
|
-
@
|
1428
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1412
1429
|
```
|
1413
1430
|
or
|
1414
1431
|
```
|
1415
|
-
@
|
1432
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1433
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1416
1434
|
```
|
1417
1435
|
|
1418
|
-
|
1419
|
-
inferred from the current project or project branch):
|
1436
|
+
'parameters' can also be a list of strings and tuples like so:
|
1420
1437
|
```
|
1421
|
-
@
|
1438
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1439
|
+
```
|
1440
|
+
This is equivalent to:
|
1441
|
+
```
|
1442
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1422
1443
|
```
|
1423
|
-
|
1424
|
-
Note that `branch` is typically one of:
|
1425
|
-
- `prod`
|
1426
|
-
- `user.bob`
|
1427
|
-
- `test.my_experiment`
|
1428
|
-
- `prod.staging`
|
1429
1444
|
|
1430
1445
|
Parameters
|
1431
1446
|
----------
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1447
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1448
|
+
Event dependency for this flow.
|
1449
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1450
|
+
Events dependency for this flow.
|
1436
1451
|
options : Dict[str, Any], default {}
|
1437
1452
|
Backend-specific configuration for tuning eventing behavior.
|
1438
1453
|
|
@@ -1441,51 +1456,47 @@ def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] =
|
|
1441
1456
|
...
|
1442
1457
|
|
1443
1458
|
@typing.overload
|
1444
|
-
def
|
1459
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1445
1460
|
...
|
1446
1461
|
|
1447
|
-
def
|
1462
|
+
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] = {}):
|
1448
1463
|
"""
|
1449
|
-
Specifies the
|
1464
|
+
Specifies the event(s) that this flow depends on.
|
1450
1465
|
|
1451
1466
|
```
|
1452
|
-
@
|
1467
|
+
@trigger(event='foo')
|
1453
1468
|
```
|
1454
1469
|
or
|
1455
1470
|
```
|
1456
|
-
@
|
1471
|
+
@trigger(events=['foo', 'bar'])
|
1457
1472
|
```
|
1458
|
-
This decorator respects the @project decorator and triggers the flow
|
1459
|
-
when upstream runs within the same namespace complete successfully
|
1460
1473
|
|
1461
|
-
Additionally, you can specify
|
1462
|
-
|
1474
|
+
Additionally, you can specify the parameter mappings
|
1475
|
+
to map event payload to Metaflow parameters for the flow.
|
1463
1476
|
```
|
1464
|
-
@
|
1477
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1465
1478
|
```
|
1466
1479
|
or
|
1467
1480
|
```
|
1468
|
-
@
|
1481
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1482
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1469
1483
|
```
|
1470
1484
|
|
1471
|
-
|
1472
|
-
inferred from the current project or project branch):
|
1485
|
+
'parameters' can also be a list of strings and tuples like so:
|
1473
1486
|
```
|
1474
|
-
@
|
1487
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1488
|
+
```
|
1489
|
+
This is equivalent to:
|
1490
|
+
```
|
1491
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1475
1492
|
```
|
1476
|
-
|
1477
|
-
Note that `branch` is typically one of:
|
1478
|
-
- `prod`
|
1479
|
-
- `user.bob`
|
1480
|
-
- `test.my_experiment`
|
1481
|
-
- `prod.staging`
|
1482
1493
|
|
1483
1494
|
Parameters
|
1484
1495
|
----------
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1496
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1497
|
+
Event dependency for this flow.
|
1498
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1499
|
+
Events dependency for this flow.
|
1489
1500
|
options : Dict[str, Any], default {}
|
1490
1501
|
Backend-specific configuration for tuning eventing behavior.
|
1491
1502
|
|
@@ -1493,48 +1504,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1493
1504
|
"""
|
1494
1505
|
...
|
1495
1506
|
|
1496
|
-
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]]:
|
1497
|
-
"""
|
1498
|
-
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)
|
1499
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1500
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1501
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1502
|
-
starts only after all sensors finish.
|
1503
|
-
|
1504
|
-
Parameters
|
1505
|
-
----------
|
1506
|
-
timeout : int
|
1507
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1508
|
-
poke_interval : int
|
1509
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1510
|
-
mode : str
|
1511
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1512
|
-
exponential_backoff : bool
|
1513
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1514
|
-
pool : str
|
1515
|
-
the slot pool this task should run in,
|
1516
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1517
|
-
soft_fail : bool
|
1518
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1519
|
-
name : str
|
1520
|
-
Name of the sensor on Airflow
|
1521
|
-
description : str
|
1522
|
-
Description of sensor in the Airflow UI
|
1523
|
-
bucket_key : Union[str, List[str]]
|
1524
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1525
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1526
|
-
bucket_name : str
|
1527
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1528
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1529
|
-
wildcard_match : bool
|
1530
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1531
|
-
aws_conn_id : str
|
1532
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1533
|
-
verify : bool
|
1534
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1535
|
-
"""
|
1536
|
-
...
|
1537
|
-
|
1538
1507
|
@typing.overload
|
1539
1508
|
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1540
1509
|
"""
|
@@ -1574,55 +1543,6 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1574
1543
|
"""
|
1575
1544
|
...
|
1576
1545
|
|
1577
|
-
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1578
|
-
"""
|
1579
|
-
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1580
|
-
|
1581
|
-
User code call
|
1582
|
-
-----------
|
1583
|
-
@nim(
|
1584
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1585
|
-
backend='managed'
|
1586
|
-
)
|
1587
|
-
|
1588
|
-
Valid backend options
|
1589
|
-
---------------------
|
1590
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
1591
|
-
- 🚧 'dataplane': Run in your account.
|
1592
|
-
|
1593
|
-
Valid model options
|
1594
|
-
----------------
|
1595
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
1596
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
1597
|
-
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1598
|
-
|
1599
|
-
Parameters
|
1600
|
-
----------
|
1601
|
-
models: list[NIM]
|
1602
|
-
List of NIM containers running models in sidecars.
|
1603
|
-
backend: str
|
1604
|
-
Compute provider to run the NIM container.
|
1605
|
-
"""
|
1606
|
-
...
|
1607
|
-
|
1608
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1609
|
-
"""
|
1610
|
-
Specifies what flows belong to the same project.
|
1611
|
-
|
1612
|
-
A project-specific namespace is created for all flows that
|
1613
|
-
use the same `@project(name)`.
|
1614
|
-
|
1615
|
-
Parameters
|
1616
|
-
----------
|
1617
|
-
name : str
|
1618
|
-
Project name. Make sure that the name is unique amongst all
|
1619
|
-
projects that use the same production scheduler. The name may
|
1620
|
-
contain only lowercase alphanumeric characters and underscores.
|
1621
|
-
|
1622
|
-
|
1623
|
-
"""
|
1624
|
-
...
|
1625
|
-
|
1626
1546
|
@typing.overload
|
1627
1547
|
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]]:
|
1628
1548
|
"""
|
@@ -1659,100 +1579,111 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1659
1579
|
|
1660
1580
|
Parameters
|
1661
1581
|
----------
|
1662
|
-
packages : Dict[str, str], default {}
|
1663
|
-
Packages to use for this flow. The key is the name of the package
|
1664
|
-
and the value is the version to use.
|
1665
|
-
libraries : Dict[str, str], default {}
|
1666
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1667
|
-
python : str, optional, default None
|
1668
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1669
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1670
|
-
disabled : bool, default False
|
1671
|
-
If set to True, disables Conda.
|
1582
|
+
packages : Dict[str, str], default {}
|
1583
|
+
Packages to use for this flow. The key is the name of the package
|
1584
|
+
and the value is the version to use.
|
1585
|
+
libraries : Dict[str, str], default {}
|
1586
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1587
|
+
python : str, optional, default None
|
1588
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1589
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1590
|
+
disabled : bool, default False
|
1591
|
+
If set to True, disables Conda.
|
1592
|
+
"""
|
1593
|
+
...
|
1594
|
+
|
1595
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1596
|
+
"""
|
1597
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1598
|
+
|
1599
|
+
User code call
|
1600
|
+
-----------
|
1601
|
+
@nim(
|
1602
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1603
|
+
backend='managed'
|
1604
|
+
)
|
1605
|
+
|
1606
|
+
Valid backend options
|
1607
|
+
---------------------
|
1608
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1609
|
+
- 🚧 'dataplane': Run in your account.
|
1610
|
+
|
1611
|
+
Valid model options
|
1612
|
+
----------------
|
1613
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1614
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1615
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1616
|
+
|
1617
|
+
Parameters
|
1618
|
+
----------
|
1619
|
+
models: list[NIM]
|
1620
|
+
List of NIM containers running models in sidecars.
|
1621
|
+
backend: str
|
1622
|
+
Compute provider to run the NIM container.
|
1672
1623
|
"""
|
1673
1624
|
...
|
1674
1625
|
|
1675
|
-
def
|
1626
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1676
1627
|
"""
|
1677
|
-
|
1678
|
-
|
1628
|
+
Specifies what flows belong to the same project.
|
1629
|
+
|
1630
|
+
A project-specific namespace is created for all flows that
|
1631
|
+
use the same `@project(name)`.
|
1679
1632
|
|
1680
1633
|
Parameters
|
1681
1634
|
----------
|
1682
|
-
timeout : int
|
1683
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1684
|
-
poke_interval : int
|
1685
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1686
|
-
mode : str
|
1687
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1688
|
-
exponential_backoff : bool
|
1689
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1690
|
-
pool : str
|
1691
|
-
the slot pool this task should run in,
|
1692
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1693
|
-
soft_fail : bool
|
1694
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1695
1635
|
name : str
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
external_task_ids : List[str]
|
1702
|
-
The list of task_ids that you want to wait for.
|
1703
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1704
|
-
allowed_states : List[str]
|
1705
|
-
Iterable of allowed states, (Default: ['success'])
|
1706
|
-
failed_states : List[str]
|
1707
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1708
|
-
execution_delta : datetime.timedelta
|
1709
|
-
time difference with the previous execution to look at,
|
1710
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1711
|
-
check_existence: bool
|
1712
|
-
Set to True to check if the external task exists or check if
|
1713
|
-
the DAG to wait for exists. (Default: True)
|
1636
|
+
Project name. Make sure that the name is unique amongst all
|
1637
|
+
projects that use the same production scheduler. The name may
|
1638
|
+
contain only lowercase alphanumeric characters and underscores.
|
1639
|
+
|
1640
|
+
|
1714
1641
|
"""
|
1715
1642
|
...
|
1716
1643
|
|
1717
1644
|
@typing.overload
|
1718
|
-
def
|
1645
|
+
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]]:
|
1719
1646
|
"""
|
1720
|
-
Specifies the
|
1647
|
+
Specifies the flow(s) that this flow depends on.
|
1721
1648
|
|
1722
1649
|
```
|
1723
|
-
@
|
1650
|
+
@trigger_on_finish(flow='FooFlow')
|
1724
1651
|
```
|
1725
1652
|
or
|
1726
1653
|
```
|
1727
|
-
@
|
1654
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1728
1655
|
```
|
1656
|
+
This decorator respects the @project decorator and triggers the flow
|
1657
|
+
when upstream runs within the same namespace complete successfully
|
1729
1658
|
|
1730
|
-
Additionally, you can specify
|
1731
|
-
|
1659
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1660
|
+
by specifying the fully qualified project_flow_name.
|
1732
1661
|
```
|
1733
|
-
@
|
1662
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1734
1663
|
```
|
1735
1664
|
or
|
1736
1665
|
```
|
1737
|
-
@
|
1738
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1666
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1739
1667
|
```
|
1740
1668
|
|
1741
|
-
|
1742
|
-
|
1743
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1744
|
-
```
|
1745
|
-
This is equivalent to:
|
1669
|
+
You can also specify just the project or project branch (other values will be
|
1670
|
+
inferred from the current project or project branch):
|
1746
1671
|
```
|
1747
|
-
@
|
1672
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1748
1673
|
```
|
1749
1674
|
|
1675
|
+
Note that `branch` is typically one of:
|
1676
|
+
- `prod`
|
1677
|
+
- `user.bob`
|
1678
|
+
- `test.my_experiment`
|
1679
|
+
- `prod.staging`
|
1680
|
+
|
1750
1681
|
Parameters
|
1751
1682
|
----------
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1683
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1684
|
+
Upstream flow dependency for this flow.
|
1685
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1686
|
+
Upstream flow dependencies for this flow.
|
1756
1687
|
options : Dict[str, Any], default {}
|
1757
1688
|
Backend-specific configuration for tuning eventing behavior.
|
1758
1689
|
|
@@ -1761,47 +1692,51 @@ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = No
|
|
1761
1692
|
...
|
1762
1693
|
|
1763
1694
|
@typing.overload
|
1764
|
-
def
|
1695
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1765
1696
|
...
|
1766
1697
|
|
1767
|
-
def
|
1698
|
+
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] = {}):
|
1768
1699
|
"""
|
1769
|
-
Specifies the
|
1700
|
+
Specifies the flow(s) that this flow depends on.
|
1770
1701
|
|
1771
1702
|
```
|
1772
|
-
@
|
1703
|
+
@trigger_on_finish(flow='FooFlow')
|
1773
1704
|
```
|
1774
1705
|
or
|
1775
1706
|
```
|
1776
|
-
@
|
1707
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1777
1708
|
```
|
1709
|
+
This decorator respects the @project decorator and triggers the flow
|
1710
|
+
when upstream runs within the same namespace complete successfully
|
1778
1711
|
|
1779
|
-
Additionally, you can specify
|
1780
|
-
|
1712
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1713
|
+
by specifying the fully qualified project_flow_name.
|
1781
1714
|
```
|
1782
|
-
@
|
1715
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1783
1716
|
```
|
1784
1717
|
or
|
1785
1718
|
```
|
1786
|
-
@
|
1787
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1719
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1788
1720
|
```
|
1789
1721
|
|
1790
|
-
|
1791
|
-
|
1792
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1793
|
-
```
|
1794
|
-
This is equivalent to:
|
1722
|
+
You can also specify just the project or project branch (other values will be
|
1723
|
+
inferred from the current project or project branch):
|
1795
1724
|
```
|
1796
|
-
@
|
1725
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1797
1726
|
```
|
1798
1727
|
|
1728
|
+
Note that `branch` is typically one of:
|
1729
|
+
- `prod`
|
1730
|
+
- `user.bob`
|
1731
|
+
- `test.my_experiment`
|
1732
|
+
- `prod.staging`
|
1733
|
+
|
1799
1734
|
Parameters
|
1800
1735
|
----------
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1736
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1737
|
+
Upstream flow dependency for this flow.
|
1738
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1739
|
+
Upstream flow dependencies for this flow.
|
1805
1740
|
options : Dict[str, Any], default {}
|
1806
1741
|
Backend-specific configuration for tuning eventing behavior.
|
1807
1742
|
|
@@ -1809,6 +1744,48 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1809
1744
|
"""
|
1810
1745
|
...
|
1811
1746
|
|
1747
|
+
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]]:
|
1748
|
+
"""
|
1749
|
+
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.
|
1750
|
+
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.
|
1751
|
+
|
1752
|
+
Parameters
|
1753
|
+
----------
|
1754
|
+
timeout : int
|
1755
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1756
|
+
poke_interval : int
|
1757
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1758
|
+
mode : str
|
1759
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1760
|
+
exponential_backoff : bool
|
1761
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1762
|
+
pool : str
|
1763
|
+
the slot pool this task should run in,
|
1764
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1765
|
+
soft_fail : bool
|
1766
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1767
|
+
name : str
|
1768
|
+
Name of the sensor on Airflow
|
1769
|
+
description : str
|
1770
|
+
Description of sensor in the Airflow UI
|
1771
|
+
external_dag_id : str
|
1772
|
+
The dag_id that contains the task you want to wait for.
|
1773
|
+
external_task_ids : List[str]
|
1774
|
+
The list of task_ids that you want to wait for.
|
1775
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1776
|
+
allowed_states : List[str]
|
1777
|
+
Iterable of allowed states, (Default: ['success'])
|
1778
|
+
failed_states : List[str]
|
1779
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1780
|
+
execution_delta : datetime.timedelta
|
1781
|
+
time difference with the previous execution to look at,
|
1782
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1783
|
+
check_existence: bool
|
1784
|
+
Set to True to check if the external task exists or check if
|
1785
|
+
the DAG to wait for exists. (Default: True)
|
1786
|
+
"""
|
1787
|
+
...
|
1788
|
+
|
1812
1789
|
@typing.overload
|
1813
1790
|
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1814
1791
|
"""
|
@@ -1858,6 +1835,48 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1858
1835
|
"""
|
1859
1836
|
...
|
1860
1837
|
|
1838
|
+
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]]:
|
1839
|
+
"""
|
1840
|
+
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)
|
1841
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1842
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1843
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1844
|
+
starts only after all sensors finish.
|
1845
|
+
|
1846
|
+
Parameters
|
1847
|
+
----------
|
1848
|
+
timeout : int
|
1849
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1850
|
+
poke_interval : int
|
1851
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1852
|
+
mode : str
|
1853
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1854
|
+
exponential_backoff : bool
|
1855
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1856
|
+
pool : str
|
1857
|
+
the slot pool this task should run in,
|
1858
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1859
|
+
soft_fail : bool
|
1860
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1861
|
+
name : str
|
1862
|
+
Name of the sensor on Airflow
|
1863
|
+
description : str
|
1864
|
+
Description of sensor in the Airflow UI
|
1865
|
+
bucket_key : Union[str, List[str]]
|
1866
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1867
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1868
|
+
bucket_name : str
|
1869
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1870
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1871
|
+
wildcard_match : bool
|
1872
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1873
|
+
aws_conn_id : str
|
1874
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1875
|
+
verify : bool
|
1876
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1877
|
+
"""
|
1878
|
+
...
|
1879
|
+
|
1861
1880
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1862
1881
|
"""
|
1863
1882
|
Switch namespace to the one provided.
|
@@ -3006,6 +3025,36 @@ class NBRunner(object, metaclass=type):
|
|
3006
3025
|
...
|
3007
3026
|
...
|
3008
3027
|
|
3028
|
+
class Deployer(object, metaclass=type):
|
3029
|
+
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, **kwargs):
|
3030
|
+
...
|
3031
|
+
def _Deployer__make_function(self, deployer_class):
|
3032
|
+
"""
|
3033
|
+
Create a function for the given deployer class.
|
3034
|
+
|
3035
|
+
Parameters
|
3036
|
+
----------
|
3037
|
+
deployer_class : Type[DeployerImpl]
|
3038
|
+
Deployer implementation class.
|
3039
|
+
|
3040
|
+
Returns
|
3041
|
+
-------
|
3042
|
+
Callable
|
3043
|
+
Function that initializes and returns an instance of the deployer class.
|
3044
|
+
"""
|
3045
|
+
...
|
3046
|
+
...
|
3047
|
+
|
3048
|
+
class NBDeployer(object, metaclass=type):
|
3049
|
+
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", **kwargs):
|
3050
|
+
...
|
3051
|
+
def cleanup(self):
|
3052
|
+
"""
|
3053
|
+
Delete any temporary files created during execution.
|
3054
|
+
"""
|
3055
|
+
...
|
3056
|
+
...
|
3057
|
+
|
3009
3058
|
def get_aws_client(module, with_error = False, role_arn = None, session_vars = None, client_params = None):
|
3010
3059
|
...
|
3011
3060
|
|