ob-metaflow-stubs 3.4__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.
Files changed (136) hide show
  1. metaflow-stubs/__init__.pyi +517 -517
  2. metaflow-stubs/cards.pyi +6 -6
  3. metaflow-stubs/cli.pyi +3 -3
  4. metaflow-stubs/client/__init__.pyi +4 -4
  5. metaflow-stubs/client/core.pyi +7 -7
  6. metaflow-stubs/client/filecache.pyi +3 -3
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +5 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +5 -5
  13. metaflow-stubs/metadata/metadata.pyi +3 -3
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +2 -2
  16. metaflow-stubs/metaflow_current.pyi +5 -5
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +4 -4
  20. metaflow-stubs/plugins/__init__.pyi +3 -3
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
  23. metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
  24. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  31. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  35. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
  37. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  39. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  45. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  47. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +5 -5
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  56. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  57. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  60. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  61. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  62. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  63. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  64. metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
  65. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  66. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  69. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
  71. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  78. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  80. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
  81. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  82. metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
  83. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  84. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  85. metaflow-stubs/plugins/datatools/__init__.pyi +4 -4
  86. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  87. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  88. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
  89. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  90. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  91. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  92. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  93. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  94. metaflow-stubs/plugins/events_decorator.pyi +3 -3
  95. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  96. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  97. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  99. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  101. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  102. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
  105. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +4 -4
  106. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  107. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  108. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  109. metaflow-stubs/plugins/package_cli.pyi +2 -2
  110. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  111. metaflow-stubs/plugins/perimeters.pyi +2 -2
  112. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  113. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  116. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  118. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  119. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  120. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  122. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  123. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  124. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  125. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  126. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  127. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  128. metaflow-stubs/procpoll.pyi +2 -2
  129. metaflow-stubs/profilers/__init__.pyi +2 -2
  130. metaflow-stubs/pylint_wrapper.pyi +2 -2
  131. metaflow-stubs/tagging_util.pyi +2 -2
  132. {ob_metaflow_stubs-3.4.dist-info → ob_metaflow_stubs-3.5.dist-info}/METADATA +1 -1
  133. ob_metaflow_stubs-3.5.dist-info/RECORD +136 -0
  134. ob_metaflow_stubs-3.4.dist-info/RECORD +0 -136
  135. {ob_metaflow_stubs-3.4.dist-info → ob_metaflow_stubs-3.5.dist-info}/WHEEL +0 -0
  136. {ob_metaflow_stubs-3.4.dist-info → ob_metaflow_stubs-3.5.dist-info}/top_level.txt +0 -0
@@ -1,23 +1,23 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.11.15.2+ob(v1) #
4
- # Generated on 2024-05-17T19:44:44.623630 #
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
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
+ import typing
12
+ import metaflow.datastore.inputs
13
+ import metaflow.plugins.datatools.s3.s3
14
+ import metaflow.events
11
15
  import datetime
16
+ import metaflow._vendor.click.types
17
+ import metaflow.client.core
12
18
  import io
13
- import metaflow.events
14
19
  import metaflow.parameters
15
- import typing
16
20
  import metaflow.metaflow_current
17
- import metaflow.client.core
18
- import metaflow._vendor.click.types
19
- import metaflow.plugins.datatools.s3.s3
20
- import metaflow.datastore.inputs
21
21
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
22
22
  StepFlag = typing.NewType("StepFlag", bool)
23
23
 
@@ -726,195 +726,51 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
726
726
  ...
727
727
 
728
728
  @typing.overload
729
- 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]]]:
729
+ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
730
730
  """
731
- Specifies the Conda environment for the step.
731
+ Specifies the PyPI packages for the step.
732
732
 
733
733
  Information in this decorator will augment any
734
- attributes set in the `@conda_base` flow-level decorator. Hence,
735
- you can use `@conda_base` to set packages required by all
736
- steps and use `@conda` to specify step-specific overrides.
734
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
735
+ you can use `@pypi_base` to set packages required by all
736
+ steps and use `@pypi` to specify step-specific overrides.
737
737
 
738
738
  Parameters
739
739
  ----------
740
- packages : Dict[str, str], default {}
740
+ packages : Dict[str, str], default: {}
741
741
  Packages to use for this step. The key is the name of the package
742
742
  and the value is the version to use.
743
- libraries : Dict[str, str], default {}
744
- Supported for backward compatibility. When used with packages, packages will take precedence.
745
- python : str, optional, default None
743
+ python : str, optional, default: None
746
744
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
747
745
  that the version used will correspond to the version of the Python interpreter used to start the run.
748
- disabled : bool, default False
749
- If set to True, disables @conda.
750
746
  """
751
747
  ...
752
748
 
753
749
  @typing.overload
754
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
750
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
755
751
  ...
756
752
 
757
753
  @typing.overload
758
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
754
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
759
755
  ...
760
756
 
761
- 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):
757
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
762
758
  """
763
- Specifies the Conda environment for the step.
759
+ Specifies the PyPI packages for the step.
764
760
 
765
761
  Information in this decorator will augment any
766
- attributes set in the `@conda_base` flow-level decorator. Hence,
767
- you can use `@conda_base` to set packages required by all
768
- steps and use `@conda` to specify step-specific overrides.
762
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
763
+ you can use `@pypi_base` to set packages required by all
764
+ steps and use `@pypi` to specify step-specific overrides.
769
765
 
770
766
  Parameters
771
767
  ----------
772
- packages : Dict[str, str], default {}
768
+ packages : Dict[str, str], default: {}
773
769
  Packages to use for this step. The key is the name of the package
774
770
  and the value is the version to use.
775
- libraries : Dict[str, str], default {}
776
- Supported for backward compatibility. When used with packages, packages will take precedence.
777
- python : str, optional, default None
771
+ python : str, optional, default: None
778
772
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
779
773
  that the version used will correspond to the version of the Python interpreter used to start the run.
780
- disabled : bool, default False
781
- If set to True, disables @conda.
782
- """
783
- ...
784
-
785
- 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]]]:
786
- """
787
- Specifies that this step should execute on Kubernetes.
788
-
789
- Parameters
790
- ----------
791
- cpu : int, default 1
792
- Number of CPUs required for this step. If `@resources` is
793
- also present, the maximum value from all decorators is used.
794
- memory : int, default 4096
795
- Memory size (in MB) required for this step. If
796
- `@resources` is also present, the maximum value from all decorators is
797
- used.
798
- disk : int, default 10240
799
- Disk size (in MB) required for this step. If
800
- `@resources` is also present, the maximum value from all decorators is
801
- used.
802
- image : str, optional, default None
803
- Docker image to use when launching on Kubernetes. If not specified, and
804
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
805
- not, a default Docker image mapping to the current version of Python is used.
806
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
807
- If given, the imagePullPolicy to be applied to the Docker image of the step.
808
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
809
- Kubernetes service account to use when launching pod in Kubernetes.
810
- secrets : List[str], optional, default None
811
- Kubernetes secrets to use when launching pod in Kubernetes. These
812
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
813
- in Metaflow configuration.
814
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
815
- Kubernetes namespace to use when launching pod in Kubernetes.
816
- gpu : int, optional, default None
817
- Number of GPUs required for this step. A value of zero implies that
818
- the scheduled node should not have GPUs.
819
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
820
- The vendor of the GPUs to be used for this step.
821
- tolerations : List[str], default []
822
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
823
- Kubernetes tolerations to use when launching pod in Kubernetes.
824
- use_tmpfs : bool, default False
825
- This enables an explicit tmpfs mount for this step.
826
- tmpfs_tempdir : bool, default True
827
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
828
- tmpfs_size : int, optional, default: None
829
- The value for the size (in MiB) of the tmpfs mount for this step.
830
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
831
- memory allocated for this step.
832
- tmpfs_path : str, optional, default /metaflow_temp
833
- Path to tmpfs mount for this step.
834
- persistent_volume_claims : Dict[str, str], optional, default None
835
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
836
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
837
- shared_memory: int, optional
838
- Shared memory size (in MiB) required for this step
839
- port: int, optional
840
- Port number to specify in the Kubernetes job object
841
- """
842
- ...
843
-
844
- @typing.overload
845
- 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]]]:
846
- """
847
- Specifies the resources needed when executing this step.
848
-
849
- Use `@resources` to specify the resource requirements
850
- independently of the specific compute layer (`@batch`, `@kubernetes`).
851
-
852
- You can choose the compute layer on the command line by executing e.g.
853
- ```
854
- python myflow.py run --with batch
855
- ```
856
- or
857
- ```
858
- python myflow.py run --with kubernetes
859
- ```
860
- which executes the flow on the desired system using the
861
- requirements specified in `@resources`.
862
-
863
- Parameters
864
- ----------
865
- cpu : int, default 1
866
- Number of CPUs required for this step.
867
- gpu : int, default 0
868
- Number of GPUs required for this step.
869
- disk : int, optional, default None
870
- Disk size (in MB) required for this step. Only applies on Kubernetes.
871
- memory : int, default 4096
872
- Memory size (in MB) required for this step.
873
- shared_memory : int, optional, default None
874
- The value for the size (in MiB) of the /dev/shm volume for this step.
875
- This parameter maps to the `--shm-size` option in Docker.
876
- """
877
- ...
878
-
879
- @typing.overload
880
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
881
- ...
882
-
883
- @typing.overload
884
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
885
- ...
886
-
887
- 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):
888
- """
889
- Specifies the resources needed when executing this step.
890
-
891
- Use `@resources` to specify the resource requirements
892
- independently of the specific compute layer (`@batch`, `@kubernetes`).
893
-
894
- You can choose the compute layer on the command line by executing e.g.
895
- ```
896
- python myflow.py run --with batch
897
- ```
898
- or
899
- ```
900
- python myflow.py run --with kubernetes
901
- ```
902
- which executes the flow on the desired system using the
903
- requirements specified in `@resources`.
904
-
905
- Parameters
906
- ----------
907
- cpu : int, default 1
908
- Number of CPUs required for this step.
909
- gpu : int, default 0
910
- Number of GPUs required for this step.
911
- disk : int, optional, default None
912
- Disk size (in MB) required for this step. Only applies on Kubernetes.
913
- memory : int, default 4096
914
- Memory size (in MB) required for this step.
915
- shared_memory : int, optional, default None
916
- The value for the size (in MiB) of the /dev/shm volume for this step.
917
- This parameter maps to the `--shm-size` option in Docker.
918
774
  """
919
775
  ...
920
776
 
@@ -1065,36 +921,124 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1065
921
  """
1066
922
  ...
1067
923
 
1068
- @typing.overload
1069
- 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]]]:
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]]]:
1070
925
  """
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.
926
+ Specifies that this step should execute on Kubernetes.
1077
927
 
1078
928
  Parameters
1079
929
  ----------
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.
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
1086
980
  """
1087
981
  ...
1088
982
 
1089
983
  @typing.overload
1090
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1091
- ...
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
+ ...
1092
1007
 
1093
1008
  @typing.overload
1094
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1009
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1095
1010
  ...
1096
1011
 
1097
- 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):
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]]]:
1098
1042
  """
1099
1043
  Specifies that the step will success under all circumstances.
1100
1044
 
@@ -1115,86 +1059,87 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1115
1059
  ...
1116
1060
 
1117
1061
  @typing.overload
1118
- 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]]]:
1119
- """
1120
- Specifies environment variables to be set prior to the execution of a step.
1121
-
1122
- Parameters
1123
- ----------
1124
- vars : Dict[str, str], default {}
1125
- Dictionary of environment variables to set.
1126
- """
1127
- ...
1128
-
1129
- @typing.overload
1130
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1062
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1131
1063
  ...
1132
1064
 
1133
1065
  @typing.overload
1134
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1066
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1135
1067
  ...
1136
1068
 
1137
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
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):
1138
1070
  """
1139
- Specifies environment variables to be set prior to the execution of a step.
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.
1140
1077
 
1141
1078
  Parameters
1142
1079
  ----------
1143
- vars : Dict[str, str], default {}
1144
- Dictionary of environment variables to set.
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.
1145
1086
  """
1146
1087
  ...
1147
1088
 
1148
1089
  @typing.overload
1149
- 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]]]:
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]]]:
1150
1091
  """
1151
- Specifies the number of times the task corresponding
1152
- to a step needs to be retried.
1092
+ Specifies a timeout for your step.
1153
1093
 
1154
- This decorator is useful for handling transient errors, such as networking issues.
1155
- If your task contains operations that can't be retried safely, e.g. database updates,
1156
- it is advisable to annotate it with `@retry(times=0)`.
1094
+ This decorator is useful if this step may hang indefinitely.
1157
1095
 
1158
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1159
- decorator will execute a no-op task after all retries have been exhausted,
1160
- ensuring that the flow execution can continue.
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.
1161
1102
 
1162
1103
  Parameters
1163
1104
  ----------
1164
- times : int, default 3
1165
- Number of times to retry this task.
1166
- minutes_between_retries : int, default 2
1167
- Number of minutes between retries.
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.
1168
1111
  """
1169
1112
  ...
1170
1113
 
1171
1114
  @typing.overload
1172
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1115
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1173
1116
  ...
1174
1117
 
1175
1118
  @typing.overload
1176
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1119
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1177
1120
  ...
1178
1121
 
1179
- 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):
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):
1180
1123
  """
1181
- Specifies the number of times the task corresponding
1182
- to a step needs to be retried.
1124
+ Specifies a timeout for your step.
1183
1125
 
1184
- This decorator is useful for handling transient errors, such as networking issues.
1185
- If your task contains operations that can't be retried safely, e.g. database updates,
1186
- it is advisable to annotate it with `@retry(times=0)`.
1126
+ This decorator is useful if this step may hang indefinitely.
1187
1127
 
1188
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1189
- decorator will execute a no-op task after all retries have been exhausted,
1190
- ensuring that the flow execution can continue.
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.
1191
1134
 
1192
1135
  Parameters
1193
1136
  ----------
1194
- times : int, default 3
1195
- Number of times to retry this task.
1196
- minutes_between_retries : int, default 2
1197
- Number of minutes between retries.
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.
1198
1143
  """
1199
1144
  ...
1200
1145
 
@@ -1250,108 +1195,132 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
1250
1195
  ...
1251
1196
 
1252
1197
  @typing.overload
1253
- 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]]]:
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]]]:
1254
1199
  """
1255
- Specifies a timeout for your step.
1256
-
1257
- This decorator is useful if this step may hang indefinitely.
1200
+ Specifies the resources needed when executing this step.
1258
1201
 
1259
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1260
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1261
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1202
+ Use `@resources` to specify the resource requirements
1203
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1262
1204
 
1263
- Note that all the values specified in parameters are added together so if you specify
1264
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
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`.
1265
1215
 
1266
1216
  Parameters
1267
1217
  ----------
1268
- seconds : int, default 0
1269
- Number of seconds to wait prior to timing out.
1270
- minutes : int, default 0
1271
- Number of minutes to wait prior to timing out.
1272
- hours : int, default 0
1273
- Number of hours to wait prior to timing out.
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.
1274
1229
  """
1275
1230
  ...
1276
1231
 
1277
1232
  @typing.overload
1278
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1233
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1279
1234
  ...
1280
1235
 
1281
1236
  @typing.overload
1282
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1237
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1283
1238
  ...
1284
1239
 
1285
- 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):
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):
1286
1241
  """
1287
- Specifies a timeout for your step.
1288
-
1289
- This decorator is useful if this step may hang indefinitely.
1242
+ Specifies the resources needed when executing this step.
1290
1243
 
1291
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1292
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1293
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1244
+ Use `@resources` to specify the resource requirements
1245
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1294
1246
 
1295
- Note that all the values specified in parameters are added together so if you specify
1296
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
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`.
1297
1257
 
1298
1258
  Parameters
1299
1259
  ----------
1300
- seconds : int, default 0
1301
- Number of seconds to wait prior to timing out.
1302
- minutes : int, default 0
1303
- Number of minutes to wait prior to timing out.
1304
- hours : int, default 0
1305
- Number of hours to wait prior to timing out.
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.
1306
1271
  """
1307
1272
  ...
1308
1273
 
1309
1274
  @typing.overload
1310
- 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]]]:
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]]]:
1311
1276
  """
1312
- Specifies the PyPI packages for the step.
1277
+ Specifies the number of times the task corresponding
1278
+ to a step needs to be retried.
1313
1279
 
1314
- Information in this decorator will augment any
1315
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1316
- you can use `@pypi_base` to set packages required by all
1317
- steps and use `@pypi` to specify step-specific overrides.
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.
1318
1287
 
1319
1288
  Parameters
1320
1289
  ----------
1321
- packages : Dict[str, str], default: {}
1322
- Packages to use for this step. The key is the name of the package
1323
- and the value is the version to use.
1324
- python : str, optional, default: None
1325
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1326
- that the version used will correspond to the version of the Python interpreter used to start the run.
1327
- """
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
+ """
1328
1295
  ...
1329
1296
 
1330
1297
  @typing.overload
1331
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1298
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1332
1299
  ...
1333
1300
 
1334
1301
  @typing.overload
1335
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1302
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1336
1303
  ...
1337
1304
 
1338
- 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):
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):
1339
1306
  """
1340
- Specifies the PyPI packages for the step.
1307
+ Specifies the number of times the task corresponding
1308
+ to a step needs to be retried.
1341
1309
 
1342
- Information in this decorator will augment any
1343
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1344
- you can use `@pypi_base` to set packages required by all
1345
- steps and use `@pypi` to specify step-specific overrides.
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.
1346
1317
 
1347
1318
  Parameters
1348
1319
  ----------
1349
- packages : Dict[str, str], default: {}
1350
- Packages to use for this step. The key is the name of the package
1351
- and the value is the version to use.
1352
- python : str, optional, default: None
1353
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1354
- that the version used will correspond to the version of the Python interpreter used to start the run.
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.
1355
1324
  """
1356
1325
  ...
1357
1326
 
@@ -1388,6 +1357,37 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
1388
1357
  """
1389
1358
  ...
1390
1359
 
1360
+ @typing.overload
1361
+ def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1362
+ """
1363
+ Specifies environment variables to be set prior to the execution of a step.
1364
+
1365
+ Parameters
1366
+ ----------
1367
+ vars : Dict[str, str], default {}
1368
+ Dictionary of environment variables to set.
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
1391
  @typing.overload
1392
1392
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1393
1393
  """
@@ -1427,173 +1427,87 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1427
1427
  """
1428
1428
  ...
1429
1429
 
1430
- @typing.overload
1431
- 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]]:
1432
- """
1433
- Specifies the flow(s) that this flow depends on.
1434
-
1435
- ```
1436
- @trigger_on_finish(flow='FooFlow')
1437
- ```
1438
- or
1439
- ```
1440
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1441
- ```
1442
- This decorator respects the @project decorator and triggers the flow
1443
- when upstream runs within the same namespace complete successfully
1444
-
1445
- Additionally, you can specify project aware upstream flow dependencies
1446
- by specifying the fully qualified project_flow_name.
1447
- ```
1448
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1449
- ```
1450
- or
1451
- ```
1452
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1453
- ```
1454
-
1455
- You can also specify just the project or project branch (other values will be
1456
- inferred from the current project or project branch):
1457
- ```
1458
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1459
- ```
1460
-
1461
- Note that `branch` is typically one of:
1462
- - `prod`
1463
- - `user.bob`
1464
- - `test.my_experiment`
1465
- - `prod.staging`
1466
-
1467
- Parameters
1468
- ----------
1469
- flow : Union[str, Dict[str, str]], optional, default None
1470
- Upstream flow dependency for this flow.
1471
- flows : List[Union[str, Dict[str, str]]], default []
1472
- Upstream flow dependencies for this flow.
1473
- options : Dict[str, Any], default {}
1474
- Backend-specific configuration for tuning eventing behavior.
1475
-
1476
-
1477
- """
1478
- ...
1479
-
1480
- @typing.overload
1481
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1482
- ...
1483
-
1484
- 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] = {}):
1485
- """
1486
- Specifies the flow(s) that this flow depends on.
1487
-
1488
- ```
1489
- @trigger_on_finish(flow='FooFlow')
1490
- ```
1491
- or
1492
- ```
1493
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1494
- ```
1495
- This decorator respects the @project decorator and triggers the flow
1496
- when upstream runs within the same namespace complete successfully
1497
-
1498
- Additionally, you can specify project aware upstream flow dependencies
1499
- by specifying the fully qualified project_flow_name.
1500
- ```
1501
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1502
- ```
1503
- or
1504
- ```
1505
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1506
- ```
1507
-
1508
- You can also specify just the project or project branch (other values will be
1509
- inferred from the current project or project branch):
1510
- ```
1511
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1512
- ```
1513
-
1514
- Note that `branch` is typically one of:
1515
- - `prod`
1516
- - `user.bob`
1517
- - `test.my_experiment`
1518
- - `prod.staging`
1519
-
1520
- Parameters
1521
- ----------
1522
- flow : Union[str, Dict[str, str]], optional, default None
1523
- Upstream flow dependency for this flow.
1524
- flows : List[Union[str, Dict[str, str]]], default []
1525
- Upstream flow dependencies for this flow.
1526
- options : Dict[str, Any], default {}
1527
- Backend-specific configuration for tuning eventing behavior.
1528
-
1529
-
1530
- """
1531
- ...
1532
-
1533
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
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]]:
1534
1431
  """
1535
- Specifies what flows belong to the same project.
1536
-
1537
- A project-specific namespace is created for all flows that
1538
- use the same `@project(name)`.
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.
1539
1434
 
1540
1435
  Parameters
1541
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)
1542
1450
  name : str
1543
- Project name. Make sure that the name is unique amongst all
1544
- projects that use the same production scheduler. The name may
1545
- contain only lowercase alphanumeric characters and underscores.
1546
-
1547
-
1548
- """
1549
- ...
1550
-
1551
- @typing.overload
1552
- 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]]:
1553
- """
1554
- Specifies the Conda environment for all steps of the flow.
1555
-
1556
- Use `@conda_base` to set common libraries required by all
1557
- steps and use `@conda` to specify step-specific additions.
1558
-
1559
- Parameters
1560
- ----------
1561
- packages : Dict[str, str], default {}
1562
- Packages to use for this flow. The key is the name of the package
1563
- and the value is the version to use.
1564
- libraries : Dict[str, str], default {}
1565
- Supported for backward compatibility. When used with packages, packages will take precedence.
1566
- python : str, optional, default None
1567
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1568
- that the version used will correspond to the version of the Python interpreter used to start the run.
1569
- disabled : bool, default False
1570
- If set to True, disables Conda.
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)
1571
1469
  """
1572
1470
  ...
1573
1471
 
1574
- @typing.overload
1575
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1576
- ...
1577
-
1578
- 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):
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]]:
1579
1473
  """
1580
- Specifies the Conda environment for all steps of the flow.
1581
-
1582
- Use `@conda_base` to set common libraries required by all
1583
- steps and use `@conda` to specify step-specific additions.
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.
1584
1479
 
1585
1480
  Parameters
1586
- ----------
1587
- packages : Dict[str, str], default {}
1588
- Packages to use for this flow. The key is the name of the package
1589
- and the value is the version to use.
1590
- libraries : Dict[str, str], default {}
1591
- Supported for backward compatibility. When used with packages, packages will take precedence.
1592
- python : str, optional, default None
1593
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1594
- that the version used will correspond to the version of the Python interpreter used to start the run.
1595
- disabled : bool, default False
1596
- If set to True, disables Conda.
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)
1597
1511
  """
1598
1512
  ...
1599
1513
 
@@ -1692,6 +1606,73 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1692
1606
  """
1693
1607
  ...
1694
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.
1613
+
1614
+ Use `@conda_base` to set common libraries required by all
1615
+ steps and use `@conda` to specify step-specific additions.
1616
+
1617
+ Parameters
1618
+ ----------
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.
1639
+
1640
+ Use `@conda_base` to set common libraries required by all
1641
+ steps and use `@conda` to specify step-specific additions.
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.
1655
+ """
1656
+ ...
1657
+
1658
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1659
+ """
1660
+ Specifies what flows belong to the same project.
1661
+
1662
+ A project-specific namespace is created for all flows that
1663
+ use the same `@project(name)`.
1664
+
1665
+ Parameters
1666
+ ----------
1667
+ name : str
1668
+ Project name. Make sure that the name is unique amongst all
1669
+ projects that use the same production scheduler. The name may
1670
+ contain only lowercase alphanumeric characters and underscores.
1671
+
1672
+
1673
+ """
1674
+ ...
1675
+
1695
1676
  @typing.overload
1696
1677
  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]]:
1697
1678
  """
@@ -1741,87 +1722,106 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1741
1722
  """
1742
1723
  ...
1743
1724
 
1744
- 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]]:
1725
+ @typing.overload
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]]:
1745
1727
  """
1746
- 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.
1747
- 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.
1728
+ Specifies the flow(s) that this flow depends on.
1729
+
1730
+ ```
1731
+ @trigger_on_finish(flow='FooFlow')
1732
+ ```
1733
+ or
1734
+ ```
1735
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1736
+ ```
1737
+ This decorator respects the @project decorator and triggers the flow
1738
+ when upstream runs within the same namespace complete successfully
1739
+
1740
+ Additionally, you can specify project aware upstream flow dependencies
1741
+ by specifying the fully qualified project_flow_name.
1742
+ ```
1743
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1744
+ ```
1745
+ or
1746
+ ```
1747
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1748
+ ```
1749
+
1750
+ You can also specify just the project or project branch (other values will be
1751
+ inferred from the current project or project branch):
1752
+ ```
1753
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1754
+ ```
1755
+
1756
+ Note that `branch` is typically one of:
1757
+ - `prod`
1758
+ - `user.bob`
1759
+ - `test.my_experiment`
1760
+ - `prod.staging`
1748
1761
 
1749
1762
  Parameters
1750
1763
  ----------
1751
- timeout : int
1752
- Time, in seconds before the task times out and fails. (Default: 3600)
1753
- poke_interval : int
1754
- Time in seconds that the job should wait in between each try. (Default: 60)
1755
- mode : str
1756
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1757
- exponential_backoff : bool
1758
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1759
- pool : str
1760
- the slot pool this task should run in,
1761
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1762
- soft_fail : bool
1763
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1764
- name : str
1765
- Name of the sensor on Airflow
1766
- description : str
1767
- Description of sensor in the Airflow UI
1768
- external_dag_id : str
1769
- The dag_id that contains the task you want to wait for.
1770
- external_task_ids : List[str]
1771
- The list of task_ids that you want to wait for.
1772
- If None (default value) the sensor waits for the DAG. (Default: None)
1773
- allowed_states : List[str]
1774
- Iterable of allowed states, (Default: ['success'])
1775
- failed_states : List[str]
1776
- Iterable of failed or dis-allowed states. (Default: None)
1777
- execution_delta : datetime.timedelta
1778
- time difference with the previous execution to look at,
1779
- the default is the same logical date as the current task or DAG. (Default: None)
1780
- check_existence: bool
1781
- Set to True to check if the external task exists or check if
1782
- the DAG to wait for exists. (Default: True)
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.
1768
+ options : Dict[str, Any], default {}
1769
+ Backend-specific configuration for tuning eventing behavior.
1770
+
1771
+
1783
1772
  """
1784
1773
  ...
1785
1774
 
1786
- 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]]:
1775
+ @typing.overload
1776
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1777
+ ...
1778
+
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] = {}):
1787
1780
  """
1788
- 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)
1789
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1790
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1791
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1792
- starts only after all sensors finish.
1781
+ Specifies the flow(s) that this flow depends on.
1782
+
1783
+ ```
1784
+ @trigger_on_finish(flow='FooFlow')
1785
+ ```
1786
+ or
1787
+ ```
1788
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1789
+ ```
1790
+ This decorator respects the @project decorator and triggers the flow
1791
+ when upstream runs within the same namespace complete successfully
1792
+
1793
+ Additionally, you can specify project aware upstream flow dependencies
1794
+ by specifying the fully qualified project_flow_name.
1795
+ ```
1796
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1797
+ ```
1798
+ or
1799
+ ```
1800
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1801
+ ```
1802
+
1803
+ You can also specify just the project or project branch (other values will be
1804
+ inferred from the current project or project branch):
1805
+ ```
1806
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1807
+ ```
1808
+
1809
+ Note that `branch` is typically one of:
1810
+ - `prod`
1811
+ - `user.bob`
1812
+ - `test.my_experiment`
1813
+ - `prod.staging`
1793
1814
 
1794
1815
  Parameters
1795
1816
  ----------
1796
- timeout : int
1797
- Time, in seconds before the task times out and fails. (Default: 3600)
1798
- poke_interval : int
1799
- Time in seconds that the job should wait in between each try. (Default: 60)
1800
- mode : str
1801
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1802
- exponential_backoff : bool
1803
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1804
- pool : str
1805
- the slot pool this task should run in,
1806
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1807
- soft_fail : bool
1808
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1809
- name : str
1810
- Name of the sensor on Airflow
1811
- description : str
1812
- Description of sensor in the Airflow UI
1813
- bucket_key : Union[str, List[str]]
1814
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1815
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1816
- bucket_name : str
1817
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1818
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1819
- wildcard_match : bool
1820
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1821
- aws_conn_id : str
1822
- a reference to the s3 connection on Airflow. (Default: None)
1823
- verify : bool
1824
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
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
+ options : Dict[str, Any], default {}
1822
+ Backend-specific configuration for tuning eventing behavior.
1823
+
1824
+
1825
1825
  """
1826
1826
  ...
1827
1827