metaflow-stubs 2.11.13__py2.py3-none-any.whl → 2.11.15__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 (133) hide show
  1. metaflow-stubs/__init__.pyi +459 -459
  2. metaflow-stubs/cards.pyi +4 -4
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +4 -4
  5. metaflow-stubs/client/core.pyi +6 -6
  6. metaflow-stubs/client/filecache.pyi +3 -3
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +3 -3
  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 +4 -4
  13. metaflow-stubs/metadata/metadata.pyi +2 -2
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +2 -2
  16. metaflow-stubs/metaflow_current.pyi +3 -3
  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 +2 -2
  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 +2 -2
  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 +2 -2
  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 +3 -3
  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 +6 -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 +3 -3
  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_exceptions.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  59. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  60. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  61. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  62. metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
  63. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  64. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  67. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
  69. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  76. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  78. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
  79. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  80. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  81. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  82. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  83. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  84. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  85. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  86. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
  87. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  88. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  89. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  90. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  91. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  92. metaflow-stubs/plugins/events_decorator.pyi +3 -3
  93. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  94. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  95. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  96. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  99. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  101. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  102. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  103. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  105. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  106. metaflow-stubs/plugins/logs_cli.pyi +45 -0
  107. metaflow-stubs/plugins/package_cli.pyi +2 -2
  108. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  109. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  110. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  112. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  113. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  116. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  119. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  120. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  122. metaflow-stubs/plugins/tag_cli.pyi +3 -3
  123. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  124. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  125. metaflow-stubs/procpoll.pyi +2 -2
  126. metaflow-stubs/pylint_wrapper.pyi +2 -2
  127. metaflow-stubs/tagging_util.pyi +2 -2
  128. metaflow-stubs/version.pyi +2 -2
  129. {metaflow_stubs-2.11.13.dist-info → metaflow_stubs-2.11.15.dist-info}/METADATA +2 -2
  130. metaflow_stubs-2.11.15.dist-info/RECORD +133 -0
  131. metaflow_stubs-2.11.13.dist-info/RECORD +0 -132
  132. {metaflow_stubs-2.11.13.dist-info → metaflow_stubs-2.11.15.dist-info}/WHEEL +0 -0
  133. {metaflow_stubs-2.11.13.dist-info → metaflow_stubs-2.11.15.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.13 #
4
- # Generated on 2024-05-06T22:21:21.471072 #
3
+ # MF version: 2.11.15 #
4
+ # Generated on 2024-05-08T22:46:02.315605 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow.plugins.datatools.s3.s3
11
+ import metaflow.events
12
12
  import datetime
13
+ import metaflow.parameters
13
14
  import io
14
- import typing
15
15
  import metaflow.client.core
16
- import metaflow.parameters
17
- import metaflow._vendor.click.types
18
- import metaflow.events
19
- import metaflow.metaflow_current
20
16
  import metaflow.datastore.inputs
17
+ import metaflow.plugins.datatools.s3.s3
18
+ import metaflow.metaflow_current
19
+ import metaflow._vendor.click.types
20
+ import typing
21
21
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
22
22
  StepFlag = typing.NewType("StepFlag", bool)
23
23
 
@@ -726,92 +726,226 @@ 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 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]]]:
730
730
  """
731
- Specifies the Conda environment for the step.
731
+ Specifies the resources needed when executing this step.
732
732
 
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.
733
+ Use `@resources` to specify the resource requirements
734
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
735
+
736
+ You can choose the compute layer on the command line by executing e.g.
737
+ ```
738
+ python myflow.py run --with batch
739
+ ```
740
+ or
741
+ ```
742
+ python myflow.py run --with kubernetes
743
+ ```
744
+ which executes the flow on the desired system using the
745
+ requirements specified in `@resources`.
737
746
 
738
747
  Parameters
739
748
  ----------
740
- packages : Dict[str, str], default {}
741
- Packages to use for this step. The key is the name of the package
742
- and the value is the version to use.
743
- libraries : Dict[str, str], default {}
744
- Supported for backward compatibility. When used with packages, packages will take precedence.
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
- disabled : bool, default False
749
- If set to True, disables @conda.
749
+ cpu : int, default 1
750
+ Number of CPUs required for this step.
751
+ gpu : int, default 0
752
+ Number of GPUs required for this step.
753
+ disk : int, optional, default None
754
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
755
+ memory : int, default 4096
756
+ Memory size (in MB) required for this step.
757
+ shared_memory : int, optional, default None
758
+ The value for the size (in MiB) of the /dev/shm volume for this step.
759
+ This parameter maps to the `--shm-size` option in Docker.
750
760
  """
751
761
  ...
752
762
 
753
763
  @typing.overload
754
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
764
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
755
765
  ...
756
766
 
757
767
  @typing.overload
758
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
768
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
759
769
  ...
760
770
 
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):
771
+ 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):
762
772
  """
763
- Specifies the Conda environment for the step.
773
+ Specifies the resources needed when executing this step.
764
774
 
765
- 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.
775
+ Use `@resources` to specify the resource requirements
776
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
777
+
778
+ You can choose the compute layer on the command line by executing e.g.
779
+ ```
780
+ python myflow.py run --with batch
781
+ ```
782
+ or
783
+ ```
784
+ python myflow.py run --with kubernetes
785
+ ```
786
+ which executes the flow on the desired system using the
787
+ requirements specified in `@resources`.
769
788
 
770
789
  Parameters
771
790
  ----------
772
- packages : Dict[str, str], default {}
773
- Packages to use for this step. The key is the name of the package
774
- 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
778
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
779
- 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.
791
+ cpu : int, default 1
792
+ Number of CPUs required for this step.
793
+ gpu : int, default 0
794
+ Number of GPUs required for this step.
795
+ disk : int, optional, default None
796
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
797
+ memory : int, default 4096
798
+ Memory size (in MB) required for this step.
799
+ shared_memory : int, optional, default None
800
+ The value for the size (in MiB) of the /dev/shm volume for this step.
801
+ This parameter maps to the `--shm-size` option in Docker.
782
802
  """
783
803
  ...
784
804
 
785
805
  @typing.overload
786
- 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]]]:
806
+ def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
787
807
  """
788
- Specifies secrets to be retrieved and injected as environment variables prior to
789
- the execution of a step.
808
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
790
809
 
791
810
  Parameters
792
811
  ----------
793
- sources : List[Union[str, Dict[str, Any]]], default: []
794
- List of secret specs, defining how the secrets are to be retrieved
812
+ cpu : int, default 1
813
+ Number of CPUs required for this step. If `@resources` is
814
+ also present, the maximum value from all decorators is used.
815
+ gpu : int, default 0
816
+ Number of GPUs required for this step. If `@resources` is
817
+ also present, the maximum value from all decorators is used.
818
+ memory : int, default 4096
819
+ Memory size (in MB) required for this step. If
820
+ `@resources` is also present, the maximum value from all decorators is
821
+ used.
822
+ image : str, optional, default None
823
+ Docker image to use when launching on AWS Batch. If not specified, and
824
+ METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
825
+ not, a default Docker image mapping to the current version of Python is used.
826
+ queue : str, default METAFLOW_BATCH_JOB_QUEUE
827
+ AWS Batch Job Queue to submit the job to.
828
+ iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
829
+ AWS IAM role that AWS Batch container uses to access AWS cloud resources.
830
+ execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
831
+ AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
832
+ (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
833
+ shared_memory : int, optional, default None
834
+ The value for the size (in MiB) of the /dev/shm volume for this step.
835
+ This parameter maps to the `--shm-size` option in Docker.
836
+ max_swap : int, optional, default None
837
+ The total amount of swap memory (in MiB) a container can use for this
838
+ step. This parameter is translated to the `--memory-swap` option in
839
+ Docker where the value is the sum of the container memory plus the
840
+ `max_swap` value.
841
+ swappiness : int, optional, default None
842
+ This allows you to tune memory swappiness behavior for this step.
843
+ A swappiness value of 0 causes swapping not to happen unless absolutely
844
+ necessary. A swappiness value of 100 causes pages to be swapped very
845
+ aggressively. Accepted values are whole numbers between 0 and 100.
846
+ use_tmpfs : bool, default False
847
+ This enables an explicit tmpfs mount for this step. Note that tmpfs is
848
+ not available on Fargate compute environments
849
+ tmpfs_tempdir : bool, default True
850
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
851
+ tmpfs_size : int, optional, default None
852
+ The value for the size (in MiB) of the tmpfs mount for this step.
853
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
854
+ memory allocated for this step.
855
+ tmpfs_path : str, optional, default None
856
+ Path to tmpfs mount for this step. Defaults to /metaflow_temp.
857
+ inferentia : int, default 0
858
+ Number of Inferentia chips required for this step.
859
+ trainium : int, default None
860
+ Alias for inferentia. Use only one of the two.
861
+ efa : int, default 0
862
+ Number of elastic fabric adapter network devices to attach to container
863
+ ephemeral_storage: int, default None
864
+ The total amount, in GiB, of ephemeral storage to set for the task (21-200)
865
+ This is only relevant for Fargate compute environments
866
+ log_driver: str, optional, default None
867
+ The log driver to use for the Amazon ECS container.
868
+ log_options: List[str], optional, default None
869
+ List of strings containing options for the chosen log driver. The configurable values
870
+ depend on the `log driver` chosen. Validation of these options is not supported yet.
871
+ Example usage: ["awslogs-group:aws/batch/job"]
795
872
  """
796
873
  ...
797
874
 
798
875
  @typing.overload
799
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
876
+ def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
800
877
  ...
801
878
 
802
879
  @typing.overload
803
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
880
+ def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
804
881
  ...
805
882
 
806
- 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]]] = []):
883
+ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None):
807
884
  """
808
- Specifies secrets to be retrieved and injected as environment variables prior to
809
- the execution of a step.
885
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
810
886
 
811
887
  Parameters
812
888
  ----------
813
- sources : List[Union[str, Dict[str, Any]]], default: []
814
- List of secret specs, defining how the secrets are to be retrieved
889
+ cpu : int, default 1
890
+ Number of CPUs required for this step. If `@resources` is
891
+ also present, the maximum value from all decorators is used.
892
+ gpu : int, default 0
893
+ Number of GPUs required for this step. If `@resources` is
894
+ also present, the maximum value from all decorators is used.
895
+ memory : int, default 4096
896
+ Memory size (in MB) required for this step. If
897
+ `@resources` is also present, the maximum value from all decorators is
898
+ used.
899
+ image : str, optional, default None
900
+ Docker image to use when launching on AWS Batch. If not specified, and
901
+ METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
902
+ not, a default Docker image mapping to the current version of Python is used.
903
+ queue : str, default METAFLOW_BATCH_JOB_QUEUE
904
+ AWS Batch Job Queue to submit the job to.
905
+ iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
906
+ AWS IAM role that AWS Batch container uses to access AWS cloud resources.
907
+ execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
908
+ AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
909
+ (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
910
+ shared_memory : int, optional, default None
911
+ The value for the size (in MiB) of the /dev/shm volume for this step.
912
+ This parameter maps to the `--shm-size` option in Docker.
913
+ max_swap : int, optional, default None
914
+ The total amount of swap memory (in MiB) a container can use for this
915
+ step. This parameter is translated to the `--memory-swap` option in
916
+ Docker where the value is the sum of the container memory plus the
917
+ `max_swap` value.
918
+ swappiness : int, optional, default None
919
+ This allows you to tune memory swappiness behavior for this step.
920
+ A swappiness value of 0 causes swapping not to happen unless absolutely
921
+ necessary. A swappiness value of 100 causes pages to be swapped very
922
+ aggressively. Accepted values are whole numbers between 0 and 100.
923
+ use_tmpfs : bool, default False
924
+ This enables an explicit tmpfs mount for this step. Note that tmpfs is
925
+ not available on Fargate compute environments
926
+ tmpfs_tempdir : bool, default True
927
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
928
+ tmpfs_size : int, optional, default None
929
+ The value for the size (in MiB) of the tmpfs mount for this step.
930
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
931
+ memory allocated for this step.
932
+ tmpfs_path : str, optional, default None
933
+ Path to tmpfs mount for this step. Defaults to /metaflow_temp.
934
+ inferentia : int, default 0
935
+ Number of Inferentia chips required for this step.
936
+ trainium : int, default None
937
+ Alias for inferentia. Use only one of the two.
938
+ efa : int, default 0
939
+ Number of elastic fabric adapter network devices to attach to container
940
+ ephemeral_storage: int, default None
941
+ The total amount, in GiB, of ephemeral storage to set for the task (21-200)
942
+ This is only relevant for Fargate compute environments
943
+ log_driver: str, optional, default None
944
+ The log driver to use for the Amazon ECS container.
945
+ log_options: List[str], optional, default None
946
+ List of strings containing options for the chosen log driver. The configurable values
947
+ depend on the `log driver` chosen. Validation of these options is not supported yet.
948
+ Example usage: ["awslogs-group:aws/batch/job"]
815
949
  """
816
950
  ...
817
951
 
@@ -875,88 +1009,11 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
875
1009
  ...
876
1010
 
877
1011
  @typing.overload
878
- 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]]]:
1012
+ def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
879
1013
  """
880
- Specifies the resources needed when executing this step.
881
-
882
- Use `@resources` to specify the resource requirements
883
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1014
+ Creates a human-readable report, a Metaflow Card, after this step completes.
884
1015
 
885
- You can choose the compute layer on the command line by executing e.g.
886
- ```
887
- python myflow.py run --with batch
888
- ```
889
- or
890
- ```
891
- python myflow.py run --with kubernetes
892
- ```
893
- which executes the flow on the desired system using the
894
- requirements specified in `@resources`.
895
-
896
- Parameters
897
- ----------
898
- cpu : int, default 1
899
- Number of CPUs required for this step.
900
- gpu : int, default 0
901
- Number of GPUs required for this step.
902
- disk : int, optional, default None
903
- Disk size (in MB) required for this step. Only applies on Kubernetes.
904
- memory : int, default 4096
905
- Memory size (in MB) required for this step.
906
- shared_memory : int, optional, default None
907
- The value for the size (in MiB) of the /dev/shm volume for this step.
908
- This parameter maps to the `--shm-size` option in Docker.
909
- """
910
- ...
911
-
912
- @typing.overload
913
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
914
- ...
915
-
916
- @typing.overload
917
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
918
- ...
919
-
920
- 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):
921
- """
922
- Specifies the resources needed when executing this step.
923
-
924
- Use `@resources` to specify the resource requirements
925
- independently of the specific compute layer (`@batch`, `@kubernetes`).
926
-
927
- You can choose the compute layer on the command line by executing e.g.
928
- ```
929
- python myflow.py run --with batch
930
- ```
931
- or
932
- ```
933
- python myflow.py run --with kubernetes
934
- ```
935
- which executes the flow on the desired system using the
936
- requirements specified in `@resources`.
937
-
938
- Parameters
939
- ----------
940
- cpu : int, default 1
941
- Number of CPUs required for this step.
942
- gpu : int, default 0
943
- Number of GPUs required for this step.
944
- disk : int, optional, default None
945
- Disk size (in MB) required for this step. Only applies on Kubernetes.
946
- memory : int, default 4096
947
- Memory size (in MB) required for this step.
948
- shared_memory : int, optional, default None
949
- The value for the size (in MiB) of the /dev/shm volume for this step.
950
- This parameter maps to the `--shm-size` option in Docker.
951
- """
952
- ...
953
-
954
- @typing.overload
955
- def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
956
- """
957
- Creates a human-readable report, a Metaflow Card, after this step completes.
958
-
959
- Note that you may add multiple `@card` decorators in a step with different parameters.
1016
+ Note that you may add multiple `@card` decorators in a step with different parameters.
960
1017
 
961
1018
  Parameters
962
1019
  ----------
@@ -1051,6 +1108,63 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
1051
1108
  """
1052
1109
  ...
1053
1110
 
1111
+ @typing.overload
1112
+ 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]]]:
1113
+ """
1114
+ Specifies a timeout for your step.
1115
+
1116
+ This decorator is useful if this step may hang indefinitely.
1117
+
1118
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1119
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1120
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1121
+
1122
+ Note that all the values specified in parameters are added together so if you specify
1123
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1124
+
1125
+ Parameters
1126
+ ----------
1127
+ seconds : int, default 0
1128
+ Number of seconds to wait prior to timing out.
1129
+ minutes : int, default 0
1130
+ Number of minutes to wait prior to timing out.
1131
+ hours : int, default 0
1132
+ Number of hours to wait prior to timing out.
1133
+ """
1134
+ ...
1135
+
1136
+ @typing.overload
1137
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1138
+ ...
1139
+
1140
+ @typing.overload
1141
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1142
+ ...
1143
+
1144
+ 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):
1145
+ """
1146
+ Specifies a timeout for your step.
1147
+
1148
+ This decorator is useful if this step may hang indefinitely.
1149
+
1150
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1151
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1152
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1153
+
1154
+ Note that all the values specified in parameters are added together so if you specify
1155
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1156
+
1157
+ Parameters
1158
+ ----------
1159
+ seconds : int, default 0
1160
+ Number of seconds to wait prior to timing out.
1161
+ minutes : int, default 0
1162
+ Number of minutes to wait prior to timing out.
1163
+ hours : int, default 0
1164
+ Number of hours to wait prior to timing out.
1165
+ """
1166
+ ...
1167
+
1054
1168
  @typing.overload
1055
1169
  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]]]:
1056
1170
  """
@@ -1101,55 +1215,92 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1101
1215
  ...
1102
1216
 
1103
1217
  @typing.overload
1104
- 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]]]:
1218
+ 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]]]:
1105
1219
  """
1106
- Specifies the number of times the task corresponding
1107
- to a step needs to be retried.
1220
+ Specifies secrets to be retrieved and injected as environment variables prior to
1221
+ the execution of a step.
1108
1222
 
1109
- This decorator is useful for handling transient errors, such as networking issues.
1110
- If your task contains operations that can't be retried safely, e.g. database updates,
1111
- it is advisable to annotate it with `@retry(times=0)`.
1223
+ Parameters
1224
+ ----------
1225
+ sources : List[Union[str, Dict[str, Any]]], default: []
1226
+ List of secret specs, defining how the secrets are to be retrieved
1227
+ """
1228
+ ...
1229
+
1230
+ @typing.overload
1231
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1232
+ ...
1233
+
1234
+ @typing.overload
1235
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1236
+ ...
1237
+
1238
+ 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]]] = []):
1239
+ """
1240
+ Specifies secrets to be retrieved and injected as environment variables prior to
1241
+ the execution of a step.
1112
1242
 
1113
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1114
- decorator will execute a no-op task after all retries have been exhausted,
1115
- ensuring that the flow execution can continue.
1243
+ Parameters
1244
+ ----------
1245
+ sources : List[Union[str, Dict[str, Any]]], default: []
1246
+ List of secret specs, defining how the secrets are to be retrieved
1247
+ """
1248
+ ...
1249
+
1250
+ @typing.overload
1251
+ 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]]]:
1252
+ """
1253
+ Specifies the Conda environment for the step.
1254
+
1255
+ Information in this decorator will augment any
1256
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1257
+ you can use `@conda_base` to set packages required by all
1258
+ steps and use `@conda` to specify step-specific overrides.
1116
1259
 
1117
1260
  Parameters
1118
1261
  ----------
1119
- times : int, default 3
1120
- Number of times to retry this task.
1121
- minutes_between_retries : int, default 2
1122
- Number of minutes between retries.
1262
+ packages : Dict[str, str], default {}
1263
+ Packages to use for this step. The key is the name of the package
1264
+ and the value is the version to use.
1265
+ libraries : Dict[str, str], default {}
1266
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1267
+ python : str, optional, default None
1268
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1269
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1270
+ disabled : bool, default False
1271
+ If set to True, disables @conda.
1123
1272
  """
1124
1273
  ...
1125
1274
 
1126
1275
  @typing.overload
1127
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1276
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1128
1277
  ...
1129
1278
 
1130
1279
  @typing.overload
1131
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1280
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1132
1281
  ...
1133
1282
 
1134
- 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):
1283
+ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1135
1284
  """
1136
- Specifies the number of times the task corresponding
1137
- to a step needs to be retried.
1138
-
1139
- This decorator is useful for handling transient errors, such as networking issues.
1140
- If your task contains operations that can't be retried safely, e.g. database updates,
1141
- it is advisable to annotate it with `@retry(times=0)`.
1285
+ Specifies the Conda environment for the step.
1142
1286
 
1143
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1144
- decorator will execute a no-op task after all retries have been exhausted,
1145
- ensuring that the flow execution can continue.
1287
+ Information in this decorator will augment any
1288
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1289
+ you can use `@conda_base` to set packages required by all
1290
+ steps and use `@conda` to specify step-specific overrides.
1146
1291
 
1147
1292
  Parameters
1148
1293
  ----------
1149
- times : int, default 3
1150
- Number of times to retry this task.
1151
- minutes_between_retries : int, default 2
1152
- Number of minutes between retries.
1294
+ packages : Dict[str, str], default {}
1295
+ Packages to use for this step. The key is the name of the package
1296
+ and the value is the version to use.
1297
+ libraries : Dict[str, str], default {}
1298
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1299
+ python : str, optional, default None
1300
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1301
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1302
+ disabled : bool, default False
1303
+ If set to True, disables @conda.
1153
1304
  """
1154
1305
  ...
1155
1306
 
@@ -1185,206 +1336,104 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
1185
1336
  ...
1186
1337
 
1187
1338
  @typing.overload
1188
- def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1339
+ 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]]]:
1189
1340
  """
1190
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1341
+ Specifies the number of times the task corresponding
1342
+ to a step needs to be retried.
1343
+
1344
+ This decorator is useful for handling transient errors, such as networking issues.
1345
+ If your task contains operations that can't be retried safely, e.g. database updates,
1346
+ it is advisable to annotate it with `@retry(times=0)`.
1347
+
1348
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1349
+ decorator will execute a no-op task after all retries have been exhausted,
1350
+ ensuring that the flow execution can continue.
1191
1351
 
1192
1352
  Parameters
1193
1353
  ----------
1194
- cpu : int, default 1
1195
- Number of CPUs required for this step. If `@resources` is
1196
- also present, the maximum value from all decorators is used.
1197
- gpu : int, default 0
1198
- Number of GPUs required for this step. If `@resources` is
1199
- also present, the maximum value from all decorators is used.
1200
- memory : int, default 4096
1201
- Memory size (in MB) required for this step. If
1202
- `@resources` is also present, the maximum value from all decorators is
1203
- used.
1204
- image : str, optional, default None
1205
- Docker image to use when launching on AWS Batch. If not specified, and
1206
- METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
1207
- not, a default Docker image mapping to the current version of Python is used.
1208
- queue : str, default METAFLOW_BATCH_JOB_QUEUE
1209
- AWS Batch Job Queue to submit the job to.
1210
- iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
1211
- AWS IAM role that AWS Batch container uses to access AWS cloud resources.
1212
- execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
1213
- AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
1214
- (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
1215
- shared_memory : int, optional, default None
1216
- The value for the size (in MiB) of the /dev/shm volume for this step.
1217
- This parameter maps to the `--shm-size` option in Docker.
1218
- max_swap : int, optional, default None
1219
- The total amount of swap memory (in MiB) a container can use for this
1220
- step. This parameter is translated to the `--memory-swap` option in
1221
- Docker where the value is the sum of the container memory plus the
1222
- `max_swap` value.
1223
- swappiness : int, optional, default None
1224
- This allows you to tune memory swappiness behavior for this step.
1225
- A swappiness value of 0 causes swapping not to happen unless absolutely
1226
- necessary. A swappiness value of 100 causes pages to be swapped very
1227
- aggressively. Accepted values are whole numbers between 0 and 100.
1228
- use_tmpfs : bool, default False
1229
- This enables an explicit tmpfs mount for this step. Note that tmpfs is
1230
- not available on Fargate compute environments
1231
- tmpfs_tempdir : bool, default True
1232
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1233
- tmpfs_size : int, optional, default None
1234
- The value for the size (in MiB) of the tmpfs mount for this step.
1235
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1236
- memory allocated for this step.
1237
- tmpfs_path : str, optional, default None
1238
- Path to tmpfs mount for this step. Defaults to /metaflow_temp.
1239
- inferentia : int, default 0
1240
- Number of Inferentia chips required for this step.
1241
- trainium : int, default None
1242
- Alias for inferentia. Use only one of the two.
1243
- efa : int, default 0
1244
- Number of elastic fabric adapter network devices to attach to container
1245
- ephemeral_storage: int, default None
1246
- The total amount, in GiB, of ephemeral storage to set for the task (21-200)
1247
- This is only relevant for Fargate compute environments
1248
- log_driver: str, optional, default None
1249
- The log driver to use for the Amazon ECS container.
1250
- log_options: List[str], optional, default None
1251
- List of strings containing options for the chosen log driver. The configurable values
1252
- depend on the `log driver` chosen. Validation of these options is not supported yet.
1253
- Example usage: ["awslogs-group:aws/batch/job"]
1354
+ times : int, default 3
1355
+ Number of times to retry this task.
1356
+ minutes_between_retries : int, default 2
1357
+ Number of minutes between retries.
1254
1358
  """
1255
1359
  ...
1256
1360
 
1257
1361
  @typing.overload
1258
- def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1362
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1259
1363
  ...
1260
1364
 
1261
1365
  @typing.overload
1262
- def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1366
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1263
1367
  ...
1264
1368
 
1265
- def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None):
1369
+ 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):
1266
1370
  """
1267
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1371
+ Specifies the number of times the task corresponding
1372
+ to a step needs to be retried.
1373
+
1374
+ This decorator is useful for handling transient errors, such as networking issues.
1375
+ If your task contains operations that can't be retried safely, e.g. database updates,
1376
+ it is advisable to annotate it with `@retry(times=0)`.
1377
+
1378
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1379
+ decorator will execute a no-op task after all retries have been exhausted,
1380
+ ensuring that the flow execution can continue.
1268
1381
 
1269
1382
  Parameters
1270
1383
  ----------
1271
- cpu : int, default 1
1272
- Number of CPUs required for this step. If `@resources` is
1273
- also present, the maximum value from all decorators is used.
1274
- gpu : int, default 0
1275
- Number of GPUs required for this step. If `@resources` is
1276
- also present, the maximum value from all decorators is used.
1277
- memory : int, default 4096
1278
- Memory size (in MB) required for this step. If
1279
- `@resources` is also present, the maximum value from all decorators is
1280
- used.
1281
- image : str, optional, default None
1282
- Docker image to use when launching on AWS Batch. If not specified, and
1283
- METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
1284
- not, a default Docker image mapping to the current version of Python is used.
1285
- queue : str, default METAFLOW_BATCH_JOB_QUEUE
1286
- AWS Batch Job Queue to submit the job to.
1287
- iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
1288
- AWS IAM role that AWS Batch container uses to access AWS cloud resources.
1289
- execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
1290
- AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
1291
- (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
1292
- shared_memory : int, optional, default None
1293
- The value for the size (in MiB) of the /dev/shm volume for this step.
1294
- This parameter maps to the `--shm-size` option in Docker.
1295
- max_swap : int, optional, default None
1296
- The total amount of swap memory (in MiB) a container can use for this
1297
- step. This parameter is translated to the `--memory-swap` option in
1298
- Docker where the value is the sum of the container memory plus the
1299
- `max_swap` value.
1300
- swappiness : int, optional, default None
1301
- This allows you to tune memory swappiness behavior for this step.
1302
- A swappiness value of 0 causes swapping not to happen unless absolutely
1303
- necessary. A swappiness value of 100 causes pages to be swapped very
1304
- aggressively. Accepted values are whole numbers between 0 and 100.
1305
- use_tmpfs : bool, default False
1306
- This enables an explicit tmpfs mount for this step. Note that tmpfs is
1307
- not available on Fargate compute environments
1308
- tmpfs_tempdir : bool, default True
1309
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1310
- tmpfs_size : int, optional, default None
1311
- The value for the size (in MiB) of the tmpfs mount for this step.
1312
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1313
- memory allocated for this step.
1314
- tmpfs_path : str, optional, default None
1315
- Path to tmpfs mount for this step. Defaults to /metaflow_temp.
1316
- inferentia : int, default 0
1317
- Number of Inferentia chips required for this step.
1318
- trainium : int, default None
1319
- Alias for inferentia. Use only one of the two.
1320
- efa : int, default 0
1321
- Number of elastic fabric adapter network devices to attach to container
1322
- ephemeral_storage: int, default None
1323
- The total amount, in GiB, of ephemeral storage to set for the task (21-200)
1324
- This is only relevant for Fargate compute environments
1325
- log_driver: str, optional, default None
1326
- The log driver to use for the Amazon ECS container.
1327
- log_options: List[str], optional, default None
1328
- List of strings containing options for the chosen log driver. The configurable values
1329
- depend on the `log driver` chosen. Validation of these options is not supported yet.
1330
- Example usage: ["awslogs-group:aws/batch/job"]
1384
+ times : int, default 3
1385
+ Number of times to retry this task.
1386
+ minutes_between_retries : int, default 2
1387
+ Number of minutes between retries.
1331
1388
  """
1332
1389
  ...
1333
1390
 
1334
1391
  @typing.overload
1335
- 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]]]:
1392
+ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1336
1393
  """
1337
- Specifies a timeout for your step.
1338
-
1339
- This decorator is useful if this step may hang indefinitely.
1340
-
1341
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1342
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1343
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1394
+ Specifies the Conda environment for all steps of the flow.
1344
1395
 
1345
- Note that all the values specified in parameters are added together so if you specify
1346
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1396
+ Use `@conda_base` to set common libraries required by all
1397
+ steps and use `@conda` to specify step-specific additions.
1347
1398
 
1348
1399
  Parameters
1349
1400
  ----------
1350
- seconds : int, default 0
1351
- Number of seconds to wait prior to timing out.
1352
- minutes : int, default 0
1353
- Number of minutes to wait prior to timing out.
1354
- hours : int, default 0
1355
- Number of hours to wait prior to timing out.
1401
+ packages : Dict[str, str], default {}
1402
+ Packages to use for this flow. The key is the name of the package
1403
+ and the value is the version to use.
1404
+ libraries : Dict[str, str], default {}
1405
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1406
+ python : str, optional, default None
1407
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1408
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1409
+ disabled : bool, default False
1410
+ If set to True, disables Conda.
1356
1411
  """
1357
1412
  ...
1358
1413
 
1359
1414
  @typing.overload
1360
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1361
- ...
1362
-
1363
- @typing.overload
1364
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1415
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1365
1416
  ...
1366
1417
 
1367
- 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):
1418
+ 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):
1368
1419
  """
1369
- Specifies a timeout for your step.
1370
-
1371
- This decorator is useful if this step may hang indefinitely.
1372
-
1373
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1374
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1375
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1420
+ Specifies the Conda environment for all steps of the flow.
1376
1421
 
1377
- Note that all the values specified in parameters are added together so if you specify
1378
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1422
+ Use `@conda_base` to set common libraries required by all
1423
+ steps and use `@conda` to specify step-specific additions.
1379
1424
 
1380
1425
  Parameters
1381
1426
  ----------
1382
- seconds : int, default 0
1383
- Number of seconds to wait prior to timing out.
1384
- minutes : int, default 0
1385
- Number of minutes to wait prior to timing out.
1386
- hours : int, default 0
1387
- Number of hours to wait prior to timing out.
1427
+ packages : Dict[str, str], default {}
1428
+ Packages to use for this flow. The key is the name of the package
1429
+ and the value is the version to use.
1430
+ libraries : Dict[str, str], default {}
1431
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1432
+ python : str, optional, default None
1433
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1434
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1435
+ disabled : bool, default False
1436
+ If set to True, disables Conda.
1388
1437
  """
1389
1438
  ...
1390
1439
 
@@ -1483,73 +1532,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1483
1532
  """
1484
1533
  ...
1485
1534
 
1486
- @typing.overload
1487
- 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]]:
1488
- """
1489
- Specifies the times when the flow should be run when running on a
1490
- production scheduler.
1491
-
1492
- Parameters
1493
- ----------
1494
- hourly : bool, default False
1495
- Run the workflow hourly.
1496
- daily : bool, default True
1497
- Run the workflow daily.
1498
- weekly : bool, default False
1499
- Run the workflow weekly.
1500
- cron : str, optional, default None
1501
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1502
- specified by this expression.
1503
- timezone : str, optional, default None
1504
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1505
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1506
- """
1507
- ...
1508
-
1509
- @typing.overload
1510
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1511
- ...
1512
-
1513
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1514
- """
1515
- Specifies the times when the flow should be run when running on a
1516
- production scheduler.
1517
-
1518
- Parameters
1519
- ----------
1520
- hourly : bool, default False
1521
- Run the workflow hourly.
1522
- daily : bool, default True
1523
- Run the workflow daily.
1524
- weekly : bool, default False
1525
- Run the workflow weekly.
1526
- cron : str, optional, default None
1527
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1528
- specified by this expression.
1529
- timezone : str, optional, default None
1530
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1531
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1532
- """
1533
- ...
1534
-
1535
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1536
- """
1537
- Specifies what flows belong to the same project.
1538
-
1539
- A project-specific namespace is created for all flows that
1540
- use the same `@project(name)`.
1541
-
1542
- Parameters
1543
- ----------
1544
- name : str
1545
- Project name. Make sure that the name is unique amongst all
1546
- projects that use the same production scheduler. The name may
1547
- contain only lowercase alphanumeric characters and underscores.
1548
-
1549
-
1550
- """
1551
- ...
1552
-
1553
1535
  @typing.overload
1554
1536
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1555
1537
  """
@@ -1589,10 +1571,13 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1589
1571
  """
1590
1572
  ...
1591
1573
 
1592
- 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]]:
1574
+ 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]]:
1593
1575
  """
1594
- 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.
1595
- 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.
1576
+ 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)
1577
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1578
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1579
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1580
+ starts only after all sensors finish.
1596
1581
 
1597
1582
  Parameters
1598
1583
  ----------
@@ -1613,31 +1598,25 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1613
1598
  Name of the sensor on Airflow
1614
1599
  description : str
1615
1600
  Description of sensor in the Airflow UI
1616
- external_dag_id : str
1617
- The dag_id that contains the task you want to wait for.
1618
- external_task_ids : List[str]
1619
- The list of task_ids that you want to wait for.
1620
- If None (default value) the sensor waits for the DAG. (Default: None)
1621
- allowed_states : List[str]
1622
- Iterable of allowed states, (Default: ['success'])
1623
- failed_states : List[str]
1624
- Iterable of failed or dis-allowed states. (Default: None)
1625
- execution_delta : datetime.timedelta
1626
- time difference with the previous execution to look at,
1627
- the default is the same logical date as the current task or DAG. (Default: None)
1628
- check_existence: bool
1629
- Set to True to check if the external task exists or check if
1630
- the DAG to wait for exists. (Default: True)
1601
+ bucket_key : Union[str, List[str]]
1602
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1603
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1604
+ bucket_name : str
1605
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1606
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1607
+ wildcard_match : bool
1608
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1609
+ aws_conn_id : str
1610
+ a reference to the s3 connection on Airflow. (Default: None)
1611
+ verify : bool
1612
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1631
1613
  """
1632
1614
  ...
1633
1615
 
1634
- 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]]:
1616
+ 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]]:
1635
1617
  """
1636
- 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)
1637
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1638
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1639
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1640
- starts only after all sensors finish.
1618
+ 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.
1619
+ 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.
1641
1620
 
1642
1621
  Parameters
1643
1622
  ----------
@@ -1658,67 +1637,88 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1658
1637
  Name of the sensor on Airflow
1659
1638
  description : str
1660
1639
  Description of sensor in the Airflow UI
1661
- bucket_key : Union[str, List[str]]
1662
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1663
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1664
- bucket_name : str
1665
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1666
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1667
- wildcard_match : bool
1668
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1669
- aws_conn_id : str
1670
- a reference to the s3 connection on Airflow. (Default: None)
1671
- verify : bool
1672
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1640
+ external_dag_id : str
1641
+ The dag_id that contains the task you want to wait for.
1642
+ external_task_ids : List[str]
1643
+ The list of task_ids that you want to wait for.
1644
+ If None (default value) the sensor waits for the DAG. (Default: None)
1645
+ allowed_states : List[str]
1646
+ Iterable of allowed states, (Default: ['success'])
1647
+ failed_states : List[str]
1648
+ Iterable of failed or dis-allowed states. (Default: None)
1649
+ execution_delta : datetime.timedelta
1650
+ time difference with the previous execution to look at,
1651
+ the default is the same logical date as the current task or DAG. (Default: None)
1652
+ check_existence: bool
1653
+ Set to True to check if the external task exists or check if
1654
+ the DAG to wait for exists. (Default: True)
1673
1655
  """
1674
1656
  ...
1675
1657
 
1676
1658
  @typing.overload
1677
- 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]]:
1659
+ 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]]:
1678
1660
  """
1679
- Specifies the Conda environment for all steps of the flow.
1680
-
1681
- Use `@conda_base` to set common libraries required by all
1682
- steps and use `@conda` to specify step-specific additions.
1661
+ Specifies the times when the flow should be run when running on a
1662
+ production scheduler.
1683
1663
 
1684
1664
  Parameters
1685
1665
  ----------
1686
- packages : Dict[str, str], default {}
1687
- Packages to use for this flow. The key is the name of the package
1688
- and the value is the version to use.
1689
- libraries : Dict[str, str], default {}
1690
- Supported for backward compatibility. When used with packages, packages will take precedence.
1691
- python : str, optional, default None
1692
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1693
- that the version used will correspond to the version of the Python interpreter used to start the run.
1694
- disabled : bool, default False
1695
- If set to True, disables Conda.
1666
+ hourly : bool, default False
1667
+ Run the workflow hourly.
1668
+ daily : bool, default True
1669
+ Run the workflow daily.
1670
+ weekly : bool, default False
1671
+ Run the workflow weekly.
1672
+ cron : str, optional, default None
1673
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1674
+ specified by this expression.
1675
+ timezone : str, optional, default None
1676
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1677
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1696
1678
  """
1697
1679
  ...
1698
1680
 
1699
1681
  @typing.overload
1700
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1682
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1701
1683
  ...
1702
1684
 
1703
- 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):
1685
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1704
1686
  """
1705
- Specifies the Conda environment for all steps of the flow.
1687
+ Specifies the times when the flow should be run when running on a
1688
+ production scheduler.
1706
1689
 
1707
- Use `@conda_base` to set common libraries required by all
1708
- steps and use `@conda` to specify step-specific additions.
1690
+ Parameters
1691
+ ----------
1692
+ hourly : bool, default False
1693
+ Run the workflow hourly.
1694
+ daily : bool, default True
1695
+ Run the workflow daily.
1696
+ weekly : bool, default False
1697
+ Run the workflow weekly.
1698
+ cron : str, optional, default None
1699
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1700
+ specified by this expression.
1701
+ timezone : str, optional, default None
1702
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1703
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1704
+ """
1705
+ ...
1706
+
1707
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1708
+ """
1709
+ Specifies what flows belong to the same project.
1710
+
1711
+ A project-specific namespace is created for all flows that
1712
+ use the same `@project(name)`.
1709
1713
 
1710
1714
  Parameters
1711
1715
  ----------
1712
- packages : Dict[str, str], default {}
1713
- Packages to use for this flow. The key is the name of the package
1714
- and the value is the version to use.
1715
- libraries : Dict[str, str], default {}
1716
- Supported for backward compatibility. When used with packages, packages will take precedence.
1717
- python : str, optional, default None
1718
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1719
- that the version used will correspond to the version of the Python interpreter used to start the run.
1720
- disabled : bool, default False
1721
- If set to True, disables Conda.
1716
+ name : str
1717
+ Project name. Make sure that the name is unique amongst all
1718
+ projects that use the same production scheduler. The name may
1719
+ contain only lowercase alphanumeric characters and underscores.
1720
+
1721
+
1722
1722
  """
1723
1723
  ...
1724
1724