metaflow-stubs 2.12.16__py2.py3-none-any.whl → 2.12.18__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 (150) hide show
  1. metaflow-stubs/__init__.pyi +581 -581
  2. metaflow-stubs/cards.pyi +5 -5
  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 +2 -2
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +4 -4
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  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 +18 -18
  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 +4 -4
  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 +6 -6
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
  37. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  38. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  39. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  40. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  45. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +4 -4
  46. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  48. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +4 -4
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  56. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  57. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  58. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  61. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  62. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  63. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  64. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  65. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
  67. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  68. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  71. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  78. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  80. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  81. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  82. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  83. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  84. metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
  85. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  86. metaflow-stubs/plugins/catch_decorator.pyi +4 -4
  87. metaflow-stubs/plugins/datatools/__init__.pyi +4 -4
  88. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  89. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  90. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
  91. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  92. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  93. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  94. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  95. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  96. metaflow-stubs/plugins/events_decorator.pyi +3 -3
  97. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  98. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  99. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  101. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  102. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  103. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  104. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  106. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
  107. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +4 -4
  108. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  109. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -4
  110. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  111. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  112. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  113. metaflow-stubs/plugins/package_cli.pyi +2 -2
  114. metaflow-stubs/plugins/parallel_decorator.pyi +3 -3
  115. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  116. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  117. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  119. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  120. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  121. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  122. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  123. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  124. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  125. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  126. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  127. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  128. metaflow-stubs/plugins/tag_cli.pyi +5 -5
  129. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  130. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  131. metaflow-stubs/procpoll.pyi +2 -2
  132. metaflow-stubs/pylint_wrapper.pyi +2 -2
  133. metaflow-stubs/runner/__init__.pyi +2 -2
  134. metaflow-stubs/runner/deployer.pyi +3 -3
  135. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  136. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  137. metaflow-stubs/runner/nbrun.pyi +2 -2
  138. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  139. metaflow-stubs/runner/utils.pyi +2 -2
  140. metaflow-stubs/system/__init__.pyi +3 -3
  141. metaflow-stubs/system/system_logger.pyi +3 -3
  142. metaflow-stubs/system/system_monitor.pyi +2 -2
  143. metaflow-stubs/tagging_util.pyi +2 -2
  144. metaflow-stubs/tuple_util.pyi +2 -2
  145. metaflow-stubs/version.pyi +2 -2
  146. {metaflow_stubs-2.12.16.dist-info → metaflow_stubs-2.12.18.dist-info}/METADATA +2 -2
  147. metaflow_stubs-2.12.18.dist-info/RECORD +150 -0
  148. {metaflow_stubs-2.12.16.dist-info → metaflow_stubs-2.12.18.dist-info}/WHEEL +1 -1
  149. metaflow_stubs-2.12.16.dist-info/RECORD +0 -150
  150. {metaflow_stubs-2.12.16.dist-info → metaflow_stubs-2.12.18.dist-info}/top_level.txt +0 -0
@@ -1,25 +1,25 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.16 #
4
- # Generated on 2024-08-26T21:06:14.574066 #
3
+ # MF version: 2.12.18 #
4
+ # Generated on 2024-08-28T16:18:32.928126 #
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
11
+ import metaflow.metaflow_current
12
+ import metaflow._vendor.click.types
13
+ import io
12
14
  import metaflow.client.core
15
+ import metaflow.runner.metaflow_runner
16
+ import typing
13
17
  import metaflow.flowspec
14
- import metaflow._vendor.click.types
18
+ import metaflow.plugins.datatools.s3.s3
15
19
  import metaflow.parameters
16
- import metaflow.metaflow_current
17
- import io
20
+ import metaflow.events
18
21
  import datetime
19
22
  import metaflow.datastore.inputs
20
- import metaflow.events
21
- import metaflow.runner.metaflow_runner
22
- import metaflow.plugins.datatools.s3.s3
23
23
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
24
24
  StepFlag = typing.NewType("StepFlag", bool)
25
25
 
@@ -728,182 +728,59 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
728
728
  ...
729
729
 
730
730
  @typing.overload
731
- 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]]]:
731
+ 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]]]:
732
732
  """
733
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
733
+ Specifies a timeout for your step.
734
734
 
735
- Parameters
736
- ----------
737
- cpu : int, default 1
738
- Number of CPUs required for this step. If `@resources` is
739
- also present, the maximum value from all decorators is used.
740
- gpu : int, default 0
741
- Number of GPUs required for this step. If `@resources` is
742
- also present, the maximum value from all decorators is used.
743
- memory : int, default 4096
744
- Memory size (in MB) required for this step. If
745
- `@resources` is also present, the maximum value from all decorators is
746
- used.
747
- image : str, optional, default None
748
- Docker image to use when launching on AWS Batch. If not specified, and
749
- METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
750
- not, a default Docker image mapping to the current version of Python is used.
751
- queue : str, default METAFLOW_BATCH_JOB_QUEUE
752
- AWS Batch Job Queue to submit the job to.
753
- iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
754
- AWS IAM role that AWS Batch container uses to access AWS cloud resources.
755
- execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
756
- AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
757
- (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
758
- shared_memory : int, optional, default None
759
- The value for the size (in MiB) of the /dev/shm volume for this step.
760
- This parameter maps to the `--shm-size` option in Docker.
761
- max_swap : int, optional, default None
762
- The total amount of swap memory (in MiB) a container can use for this
763
- step. This parameter is translated to the `--memory-swap` option in
764
- Docker where the value is the sum of the container memory plus the
765
- `max_swap` value.
766
- swappiness : int, optional, default None
767
- This allows you to tune memory swappiness behavior for this step.
768
- A swappiness value of 0 causes swapping not to happen unless absolutely
769
- necessary. A swappiness value of 100 causes pages to be swapped very
770
- aggressively. Accepted values are whole numbers between 0 and 100.
771
- use_tmpfs : bool, default False
772
- This enables an explicit tmpfs mount for this step. Note that tmpfs is
773
- not available on Fargate compute environments
774
- tmpfs_tempdir : bool, default True
775
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
776
- tmpfs_size : int, optional, default None
777
- The value for the size (in MiB) of the tmpfs mount for this step.
778
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
779
- memory allocated for this step.
780
- tmpfs_path : str, optional, default None
781
- Path to tmpfs mount for this step. Defaults to /metaflow_temp.
782
- inferentia : int, default 0
783
- Number of Inferentia chips required for this step.
784
- trainium : int, default None
785
- Alias for inferentia. Use only one of the two.
786
- efa : int, default 0
787
- Number of elastic fabric adapter network devices to attach to container
788
- ephemeral_storage : int, default None
789
- The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
790
- This is only relevant for Fargate compute environments
791
- log_driver: str, optional, default None
792
- The log driver to use for the Amazon ECS container.
793
- log_options: List[str], optional, default None
794
- List of strings containing options for the chosen log driver. The configurable values
795
- depend on the `log driver` chosen. Validation of these options is not supported yet.
796
- Example: [`awslogs-group:aws/batch/job`]
797
- """
798
- ...
799
-
800
- @typing.overload
801
- def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
802
- ...
803
-
804
- @typing.overload
805
- def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
806
- ...
807
-
808
- 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):
809
- """
810
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
735
+ This decorator is useful if this step may hang indefinitely.
811
736
 
812
- Parameters
813
- ----------
814
- cpu : int, default 1
815
- Number of CPUs required for this step. If `@resources` is
816
- also present, the maximum value from all decorators is used.
817
- gpu : int, default 0
818
- Number of GPUs required for this step. If `@resources` is
819
- also present, the maximum value from all decorators is used.
820
- memory : int, default 4096
821
- Memory size (in MB) required for this step. If
822
- `@resources` is also present, the maximum value from all decorators is
823
- used.
824
- image : str, optional, default None
825
- Docker image to use when launching on AWS Batch. If not specified, and
826
- METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
827
- not, a default Docker image mapping to the current version of Python is used.
828
- queue : str, default METAFLOW_BATCH_JOB_QUEUE
829
- AWS Batch Job Queue to submit the job to.
830
- iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
831
- AWS IAM role that AWS Batch container uses to access AWS cloud resources.
832
- execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
833
- AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
834
- (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
835
- shared_memory : int, optional, default None
836
- The value for the size (in MiB) of the /dev/shm volume for this step.
837
- This parameter maps to the `--shm-size` option in Docker.
838
- max_swap : int, optional, default None
839
- The total amount of swap memory (in MiB) a container can use for this
840
- step. This parameter is translated to the `--memory-swap` option in
841
- Docker where the value is the sum of the container memory plus the
842
- `max_swap` value.
843
- swappiness : int, optional, default None
844
- This allows you to tune memory swappiness behavior for this step.
845
- A swappiness value of 0 causes swapping not to happen unless absolutely
846
- necessary. A swappiness value of 100 causes pages to be swapped very
847
- aggressively. Accepted values are whole numbers between 0 and 100.
848
- use_tmpfs : bool, default False
849
- This enables an explicit tmpfs mount for this step. Note that tmpfs is
850
- not available on Fargate compute environments
851
- tmpfs_tempdir : bool, default True
852
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
853
- tmpfs_size : int, optional, default None
854
- The value for the size (in MiB) of the tmpfs mount for this step.
855
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
856
- memory allocated for this step.
857
- tmpfs_path : str, optional, default None
858
- Path to tmpfs mount for this step. Defaults to /metaflow_temp.
859
- inferentia : int, default 0
860
- Number of Inferentia chips required for this step.
861
- trainium : int, default None
862
- Alias for inferentia. Use only one of the two.
863
- efa : int, default 0
864
- Number of elastic fabric adapter network devices to attach to container
865
- ephemeral_storage : int, default None
866
- The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
867
- This is only relevant for Fargate compute environments
868
- log_driver: str, optional, default None
869
- The log driver to use for the Amazon ECS container.
870
- log_options: List[str], optional, default None
871
- List of strings containing options for the chosen log driver. The configurable values
872
- depend on the `log driver` chosen. Validation of these options is not supported yet.
873
- Example: [`awslogs-group:aws/batch/job`]
874
- """
875
- ...
876
-
877
- @typing.overload
878
- 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]]]:
879
- """
880
- Specifies secrets to be retrieved and injected as environment variables prior to
881
- the execution of a step.
737
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
738
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
739
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
740
+
741
+ Note that all the values specified in parameters are added together so if you specify
742
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
882
743
 
883
744
  Parameters
884
745
  ----------
885
- sources : List[Union[str, Dict[str, Any]]], default: []
886
- List of secret specs, defining how the secrets are to be retrieved
746
+ seconds : int, default 0
747
+ Number of seconds to wait prior to timing out.
748
+ minutes : int, default 0
749
+ Number of minutes to wait prior to timing out.
750
+ hours : int, default 0
751
+ Number of hours to wait prior to timing out.
887
752
  """
888
753
  ...
889
754
 
890
755
  @typing.overload
891
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
756
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
892
757
  ...
893
758
 
894
759
  @typing.overload
895
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
760
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
896
761
  ...
897
762
 
898
- 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]]] = []):
763
+ 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):
899
764
  """
900
- Specifies secrets to be retrieved and injected as environment variables prior to
901
- the execution of a step.
765
+ Specifies a timeout for your step.
766
+
767
+ This decorator is useful if this step may hang indefinitely.
768
+
769
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
770
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
771
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
772
+
773
+ Note that all the values specified in parameters are added together so if you specify
774
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
902
775
 
903
776
  Parameters
904
777
  ----------
905
- sources : List[Union[str, Dict[str, Any]]], default: []
906
- List of secret specs, defining how the secrets are to be retrieved
778
+ seconds : int, default 0
779
+ Number of seconds to wait prior to timing out.
780
+ minutes : int, default 0
781
+ Number of minutes to wait prior to timing out.
782
+ hours : int, default 0
783
+ Number of hours to wait prior to timing out.
907
784
  """
908
785
  ...
909
786
 
@@ -959,318 +836,264 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
959
836
  ...
960
837
 
961
838
  @typing.overload
962
- 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]]]:
839
+ 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]]]:
963
840
  """
964
- Specifies the resources needed when executing this step.
965
-
966
- Use `@resources` to specify the resource requirements
967
- independently of the specific compute layer (`@batch`, `@kubernetes`).
841
+ Specifies that the step will success under all circumstances.
968
842
 
969
- You can choose the compute layer on the command line by executing e.g.
970
- ```
971
- python myflow.py run --with batch
972
- ```
973
- or
974
- ```
975
- python myflow.py run --with kubernetes
976
- ```
977
- which executes the flow on the desired system using the
978
- requirements specified in `@resources`.
843
+ The decorator will create an optional artifact, specified by `var`, which
844
+ contains the exception raised. You can use it to detect the presence
845
+ of errors, indicating that all happy-path artifacts produced by the step
846
+ are missing.
979
847
 
980
848
  Parameters
981
849
  ----------
982
- cpu : int, default 1
983
- Number of CPUs required for this step.
984
- gpu : int, default 0
985
- Number of GPUs required for this step.
986
- disk : int, optional, default None
987
- Disk size (in MB) required for this step. Only applies on Kubernetes.
988
- memory : int, default 4096
989
- Memory size (in MB) required for this step.
990
- shared_memory : int, optional, default None
991
- The value for the size (in MiB) of the /dev/shm volume for this step.
992
- This parameter maps to the `--shm-size` option in Docker.
850
+ var : str, optional, default None
851
+ Name of the artifact in which to store the caught exception.
852
+ If not specified, the exception is not stored.
853
+ print_exception : bool, default True
854
+ Determines whether or not the exception is printed to
855
+ stdout when caught.
993
856
  """
994
857
  ...
995
858
 
996
859
  @typing.overload
997
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
860
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
998
861
  ...
999
862
 
1000
863
  @typing.overload
1001
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
864
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1002
865
  ...
1003
866
 
1004
- 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):
867
+ 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):
1005
868
  """
1006
- Specifies the resources needed when executing this step.
1007
-
1008
- Use `@resources` to specify the resource requirements
1009
- independently of the specific compute layer (`@batch`, `@kubernetes`).
869
+ Specifies that the step will success under all circumstances.
1010
870
 
1011
- You can choose the compute layer on the command line by executing e.g.
1012
- ```
1013
- python myflow.py run --with batch
1014
- ```
1015
- or
1016
- ```
1017
- python myflow.py run --with kubernetes
1018
- ```
1019
- which executes the flow on the desired system using the
1020
- requirements specified in `@resources`.
871
+ The decorator will create an optional artifact, specified by `var`, which
872
+ contains the exception raised. You can use it to detect the presence
873
+ of errors, indicating that all happy-path artifacts produced by the step
874
+ are missing.
1021
875
 
1022
876
  Parameters
1023
877
  ----------
1024
- cpu : int, default 1
1025
- Number of CPUs required for this step.
1026
- gpu : int, default 0
1027
- Number of GPUs required for this step.
1028
- disk : int, optional, default None
1029
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1030
- memory : int, default 4096
1031
- Memory size (in MB) required for this step.
1032
- shared_memory : int, optional, default None
1033
- The value for the size (in MiB) of the /dev/shm volume for this step.
1034
- This parameter maps to the `--shm-size` option in Docker.
878
+ var : str, optional, default None
879
+ Name of the artifact in which to store the caught exception.
880
+ If not specified, the exception is not stored.
881
+ print_exception : bool, default True
882
+ Determines whether or not the exception is printed to
883
+ stdout when caught.
1035
884
  """
1036
885
  ...
1037
886
 
1038
887
  @typing.overload
1039
- 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]]]:
888
+ 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]]]:
1040
889
  """
1041
- Specifies the number of times the task corresponding
1042
- to a step needs to be retried.
1043
-
1044
- This decorator is useful for handling transient errors, such as networking issues.
1045
- If your task contains operations that can't be retried safely, e.g. database updates,
1046
- it is advisable to annotate it with `@retry(times=0)`.
1047
-
1048
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1049
- decorator will execute a no-op task after all retries have been exhausted,
1050
- ensuring that the flow execution can continue.
890
+ Specifies environment variables to be set prior to the execution of a step.
1051
891
 
1052
892
  Parameters
1053
893
  ----------
1054
- times : int, default 3
1055
- Number of times to retry this task.
1056
- minutes_between_retries : int, default 2
1057
- Number of minutes between retries.
894
+ vars : Dict[str, str], default {}
895
+ Dictionary of environment variables to set.
1058
896
  """
1059
897
  ...
1060
898
 
1061
899
  @typing.overload
1062
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
900
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1063
901
  ...
1064
902
 
1065
903
  @typing.overload
1066
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
904
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1067
905
  ...
1068
906
 
1069
- 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):
907
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1070
908
  """
1071
- Specifies the number of times the task corresponding
1072
- to a step needs to be retried.
1073
-
1074
- This decorator is useful for handling transient errors, such as networking issues.
1075
- If your task contains operations that can't be retried safely, e.g. database updates,
1076
- it is advisable to annotate it with `@retry(times=0)`.
1077
-
1078
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1079
- decorator will execute a no-op task after all retries have been exhausted,
1080
- ensuring that the flow execution can continue.
909
+ Specifies environment variables to be set prior to the execution of a step.
1081
910
 
1082
911
  Parameters
1083
912
  ----------
1084
- times : int, default 3
1085
- Number of times to retry this task.
1086
- minutes_between_retries : int, default 2
1087
- Number of minutes between retries.
913
+ vars : Dict[str, str], default {}
914
+ Dictionary of environment variables to set.
1088
915
  """
1089
916
  ...
1090
917
 
1091
918
  @typing.overload
1092
- 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]]]:
919
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1093
920
  """
1094
- Specifies a timeout for your step.
1095
-
1096
- This decorator is useful if this step may hang indefinitely.
1097
-
1098
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1099
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1100
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1101
-
1102
- Note that all the values specified in parameters are added together so if you specify
1103
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1104
-
1105
- Parameters
1106
- ----------
1107
- seconds : int, default 0
1108
- Number of seconds to wait prior to timing out.
1109
- minutes : int, default 0
1110
- Number of minutes to wait prior to timing out.
1111
- hours : int, default 0
1112
- Number of hours to wait prior to timing out.
921
+ Decorator prototype for all step decorators. This function gets specialized
922
+ and imported for all decorators types by _import_plugin_decorators().
1113
923
  """
1114
924
  ...
1115
925
 
1116
926
  @typing.overload
1117
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1118
- ...
1119
-
1120
- @typing.overload
1121
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
927
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1122
928
  ...
1123
929
 
1124
- 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):
930
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1125
931
  """
1126
- Specifies a timeout for your step.
1127
-
1128
- This decorator is useful if this step may hang indefinitely.
1129
-
1130
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1131
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1132
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1133
-
1134
- Note that all the values specified in parameters are added together so if you specify
1135
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1136
-
1137
- Parameters
1138
- ----------
1139
- seconds : int, default 0
1140
- Number of seconds to wait prior to timing out.
1141
- minutes : int, default 0
1142
- Number of minutes to wait prior to timing out.
1143
- hours : int, default 0
1144
- Number of hours to wait prior to timing out.
932
+ Decorator prototype for all step decorators. This function gets specialized
933
+ and imported for all decorators types by _import_plugin_decorators().
1145
934
  """
1146
935
  ...
1147
936
 
1148
937
  @typing.overload
1149
- 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]]]:
938
+ 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]]]:
1150
939
  """
1151
- Specifies the PyPI packages for the step.
1152
-
1153
- Information in this decorator will augment any
1154
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1155
- you can use `@pypi_base` to set packages required by all
1156
- steps and use `@pypi` to specify step-specific overrides.
940
+ Specifies secrets to be retrieved and injected as environment variables prior to
941
+ the execution of a step.
1157
942
 
1158
943
  Parameters
1159
944
  ----------
1160
- packages : Dict[str, str], default: {}
1161
- Packages to use for this step. The key is the name of the package
1162
- and the value is the version to use.
1163
- python : str, optional, default: None
1164
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1165
- that the version used will correspond to the version of the Python interpreter used to start the run.
945
+ sources : List[Union[str, Dict[str, Any]]], default: []
946
+ List of secret specs, defining how the secrets are to be retrieved
1166
947
  """
1167
948
  ...
1168
949
 
1169
950
  @typing.overload
1170
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
951
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1171
952
  ...
1172
953
 
1173
954
  @typing.overload
1174
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
955
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1175
956
  ...
1176
957
 
1177
- 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):
958
+ 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]]] = []):
1178
959
  """
1179
- Specifies the PyPI packages for the step.
1180
-
1181
- Information in this decorator will augment any
1182
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1183
- you can use `@pypi_base` to set packages required by all
1184
- steps and use `@pypi` to specify step-specific overrides.
960
+ Specifies secrets to be retrieved and injected as environment variables prior to
961
+ the execution of a step.
1185
962
 
1186
963
  Parameters
1187
964
  ----------
1188
- packages : Dict[str, str], default: {}
1189
- Packages to use for this step. The key is the name of the package
1190
- and the value is the version to use.
1191
- python : str, optional, default: None
1192
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1193
- that the version used will correspond to the version of the Python interpreter used to start the run.
965
+ sources : List[Union[str, Dict[str, Any]]], default: []
966
+ List of secret specs, defining how the secrets are to be retrieved
1194
967
  """
1195
968
  ...
1196
969
 
1197
970
  @typing.overload
1198
- 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]]]:
971
+ 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]]]:
1199
972
  """
1200
- Specifies environment variables to be set prior to the execution of a step.
973
+ Specifies the number of times the task corresponding
974
+ to a step needs to be retried.
975
+
976
+ This decorator is useful for handling transient errors, such as networking issues.
977
+ If your task contains operations that can't be retried safely, e.g. database updates,
978
+ it is advisable to annotate it with `@retry(times=0)`.
979
+
980
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
981
+ decorator will execute a no-op task after all retries have been exhausted,
982
+ ensuring that the flow execution can continue.
1201
983
 
1202
984
  Parameters
1203
985
  ----------
1204
- vars : Dict[str, str], default {}
1205
- Dictionary of environment variables to set.
986
+ times : int, default 3
987
+ Number of times to retry this task.
988
+ minutes_between_retries : int, default 2
989
+ Number of minutes between retries.
1206
990
  """
1207
991
  ...
1208
992
 
1209
993
  @typing.overload
1210
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
994
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1211
995
  ...
1212
996
 
1213
997
  @typing.overload
1214
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
998
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1215
999
  ...
1216
1000
 
1217
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1001
+ 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):
1218
1002
  """
1219
- Specifies environment variables to be set prior to the execution of a step.
1003
+ Specifies the number of times the task corresponding
1004
+ to a step needs to be retried.
1005
+
1006
+ This decorator is useful for handling transient errors, such as networking issues.
1007
+ If your task contains operations that can't be retried safely, e.g. database updates,
1008
+ it is advisable to annotate it with `@retry(times=0)`.
1009
+
1010
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1011
+ decorator will execute a no-op task after all retries have been exhausted,
1012
+ ensuring that the flow execution can continue.
1220
1013
 
1221
1014
  Parameters
1222
1015
  ----------
1223
- vars : Dict[str, str], default {}
1224
- Dictionary of environment variables to set.
1016
+ times : int, default 3
1017
+ Number of times to retry this task.
1018
+ minutes_between_retries : int, default 2
1019
+ Number of minutes between retries.
1225
1020
  """
1226
1021
  ...
1227
1022
 
1228
1023
  @typing.overload
1229
- 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]]]:
1024
+ 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]]]:
1230
1025
  """
1231
- Specifies that the step will success under all circumstances.
1026
+ Specifies the resources needed when executing this step.
1232
1027
 
1233
- The decorator will create an optional artifact, specified by `var`, which
1234
- contains the exception raised. You can use it to detect the presence
1235
- of errors, indicating that all happy-path artifacts produced by the step
1236
- are missing.
1028
+ Use `@resources` to specify the resource requirements
1029
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1030
+
1031
+ You can choose the compute layer on the command line by executing e.g.
1032
+ ```
1033
+ python myflow.py run --with batch
1034
+ ```
1035
+ or
1036
+ ```
1037
+ python myflow.py run --with kubernetes
1038
+ ```
1039
+ which executes the flow on the desired system using the
1040
+ requirements specified in `@resources`.
1237
1041
 
1238
1042
  Parameters
1239
1043
  ----------
1240
- var : str, optional, default None
1241
- Name of the artifact in which to store the caught exception.
1242
- If not specified, the exception is not stored.
1243
- print_exception : bool, default True
1244
- Determines whether or not the exception is printed to
1245
- stdout when caught.
1044
+ cpu : int, default 1
1045
+ Number of CPUs required for this step.
1046
+ gpu : int, default 0
1047
+ Number of GPUs required for this step.
1048
+ disk : int, optional, default None
1049
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1050
+ memory : int, default 4096
1051
+ Memory size (in MB) required for this step.
1052
+ shared_memory : int, optional, default None
1053
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1054
+ This parameter maps to the `--shm-size` option in Docker.
1246
1055
  """
1247
1056
  ...
1248
1057
 
1249
1058
  @typing.overload
1250
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1059
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1251
1060
  ...
1252
1061
 
1253
1062
  @typing.overload
1254
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1063
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1255
1064
  ...
1256
1065
 
1257
- 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):
1066
+ 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):
1258
1067
  """
1259
- Specifies that the step will success under all circumstances.
1260
-
1261
- The decorator will create an optional artifact, specified by `var`, which
1262
- contains the exception raised. You can use it to detect the presence
1263
- of errors, indicating that all happy-path artifacts produced by the step
1264
- are missing.
1068
+ Specifies the resources needed when executing this step.
1069
+
1070
+ Use `@resources` to specify the resource requirements
1071
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1072
+
1073
+ You can choose the compute layer on the command line by executing e.g.
1074
+ ```
1075
+ python myflow.py run --with batch
1076
+ ```
1077
+ or
1078
+ ```
1079
+ python myflow.py run --with kubernetes
1080
+ ```
1081
+ which executes the flow on the desired system using the
1082
+ requirements specified in `@resources`.
1265
1083
 
1266
1084
  Parameters
1267
1085
  ----------
1268
- var : str, optional, default None
1269
- Name of the artifact in which to store the caught exception.
1270
- If not specified, the exception is not stored.
1271
- print_exception : bool, default True
1272
- Determines whether or not the exception is printed to
1273
- stdout when caught.
1086
+ cpu : int, default 1
1087
+ Number of CPUs required for this step.
1088
+ gpu : int, default 0
1089
+ Number of GPUs required for this step.
1090
+ disk : int, optional, default None
1091
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1092
+ memory : int, default 4096
1093
+ Memory size (in MB) required for this step.
1094
+ shared_memory : int, optional, default None
1095
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1096
+ This parameter maps to the `--shm-size` option in Docker.
1274
1097
  """
1275
1098
  ...
1276
1099
 
@@ -1394,98 +1217,166 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1394
1217
  ...
1395
1218
 
1396
1219
  @typing.overload
1397
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1220
+ 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]]]:
1398
1221
  """
1399
- Decorator prototype for all step decorators. This function gets specialized
1400
- and imported for all decorators types by _import_plugin_decorators().
1222
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1223
+
1224
+ Parameters
1225
+ ----------
1226
+ cpu : int, default 1
1227
+ Number of CPUs required for this step. If `@resources` is
1228
+ also present, the maximum value from all decorators is used.
1229
+ gpu : int, default 0
1230
+ Number of GPUs required for this step. If `@resources` is
1231
+ also present, the maximum value from all decorators is used.
1232
+ memory : int, default 4096
1233
+ Memory size (in MB) required for this step. If
1234
+ `@resources` is also present, the maximum value from all decorators is
1235
+ used.
1236
+ image : str, optional, default None
1237
+ Docker image to use when launching on AWS Batch. If not specified, and
1238
+ METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
1239
+ not, a default Docker image mapping to the current version of Python is used.
1240
+ queue : str, default METAFLOW_BATCH_JOB_QUEUE
1241
+ AWS Batch Job Queue to submit the job to.
1242
+ iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
1243
+ AWS IAM role that AWS Batch container uses to access AWS cloud resources.
1244
+ execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
1245
+ AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
1246
+ (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
1247
+ shared_memory : int, optional, default None
1248
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1249
+ This parameter maps to the `--shm-size` option in Docker.
1250
+ max_swap : int, optional, default None
1251
+ The total amount of swap memory (in MiB) a container can use for this
1252
+ step. This parameter is translated to the `--memory-swap` option in
1253
+ Docker where the value is the sum of the container memory plus the
1254
+ `max_swap` value.
1255
+ swappiness : int, optional, default None
1256
+ This allows you to tune memory swappiness behavior for this step.
1257
+ A swappiness value of 0 causes swapping not to happen unless absolutely
1258
+ necessary. A swappiness value of 100 causes pages to be swapped very
1259
+ aggressively. Accepted values are whole numbers between 0 and 100.
1260
+ use_tmpfs : bool, default False
1261
+ This enables an explicit tmpfs mount for this step. Note that tmpfs is
1262
+ not available on Fargate compute environments
1263
+ tmpfs_tempdir : bool, default True
1264
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1265
+ tmpfs_size : int, optional, default None
1266
+ The value for the size (in MiB) of the tmpfs mount for this step.
1267
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1268
+ memory allocated for this step.
1269
+ tmpfs_path : str, optional, default None
1270
+ Path to tmpfs mount for this step. Defaults to /metaflow_temp.
1271
+ inferentia : int, default 0
1272
+ Number of Inferentia chips required for this step.
1273
+ trainium : int, default None
1274
+ Alias for inferentia. Use only one of the two.
1275
+ efa : int, default 0
1276
+ Number of elastic fabric adapter network devices to attach to container
1277
+ ephemeral_storage : int, default None
1278
+ The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
1279
+ This is only relevant for Fargate compute environments
1280
+ log_driver: str, optional, default None
1281
+ The log driver to use for the Amazon ECS container.
1282
+ log_options: List[str], optional, default None
1283
+ List of strings containing options for the chosen log driver. The configurable values
1284
+ depend on the `log driver` chosen. Validation of these options is not supported yet.
1285
+ Example: [`awslogs-group:aws/batch/job`]
1401
1286
  """
1402
1287
  ...
1403
1288
 
1404
1289
  @typing.overload
1405
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1290
+ def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1406
1291
  ...
1407
1292
 
1408
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1409
- """
1410
- Decorator prototype for all step decorators. This function gets specialized
1411
- and imported for all decorators types by _import_plugin_decorators().
1412
- """
1293
+ @typing.overload
1294
+ def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1413
1295
  ...
1414
1296
 
1415
- 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]]:
1297
+ 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):
1416
1298
  """
1417
- 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.
1418
- 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.
1299
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1419
1300
 
1420
1301
  Parameters
1421
1302
  ----------
1422
- timeout : int
1423
- Time, in seconds before the task times out and fails. (Default: 3600)
1424
- poke_interval : int
1425
- Time in seconds that the job should wait in between each try. (Default: 60)
1426
- mode : str
1427
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1428
- exponential_backoff : bool
1429
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1430
- pool : str
1431
- the slot pool this task should run in,
1432
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1433
- soft_fail : bool
1434
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1435
- name : str
1436
- Name of the sensor on Airflow
1437
- description : str
1438
- Description of sensor in the Airflow UI
1439
- external_dag_id : str
1440
- The dag_id that contains the task you want to wait for.
1441
- external_task_ids : List[str]
1442
- The list of task_ids that you want to wait for.
1443
- If None (default value) the sensor waits for the DAG. (Default: None)
1444
- allowed_states : List[str]
1445
- Iterable of allowed states, (Default: ['success'])
1446
- failed_states : List[str]
1447
- Iterable of failed or dis-allowed states. (Default: None)
1448
- execution_delta : datetime.timedelta
1449
- time difference with the previous execution to look at,
1450
- the default is the same logical date as the current task or DAG. (Default: None)
1451
- check_existence: bool
1452
- Set to True to check if the external task exists or check if
1453
- the DAG to wait for exists. (Default: True)
1303
+ cpu : int, default 1
1304
+ Number of CPUs required for this step. If `@resources` is
1305
+ also present, the maximum value from all decorators is used.
1306
+ gpu : int, default 0
1307
+ Number of GPUs required for this step. If `@resources` is
1308
+ also present, the maximum value from all decorators is used.
1309
+ memory : int, default 4096
1310
+ Memory size (in MB) required for this step. If
1311
+ `@resources` is also present, the maximum value from all decorators is
1312
+ used.
1313
+ image : str, optional, default None
1314
+ Docker image to use when launching on AWS Batch. If not specified, and
1315
+ METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
1316
+ not, a default Docker image mapping to the current version of Python is used.
1317
+ queue : str, default METAFLOW_BATCH_JOB_QUEUE
1318
+ AWS Batch Job Queue to submit the job to.
1319
+ iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
1320
+ AWS IAM role that AWS Batch container uses to access AWS cloud resources.
1321
+ execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
1322
+ AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
1323
+ (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
1324
+ shared_memory : int, optional, default None
1325
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1326
+ This parameter maps to the `--shm-size` option in Docker.
1327
+ max_swap : int, optional, default None
1328
+ The total amount of swap memory (in MiB) a container can use for this
1329
+ step. This parameter is translated to the `--memory-swap` option in
1330
+ Docker where the value is the sum of the container memory plus the
1331
+ `max_swap` value.
1332
+ swappiness : int, optional, default None
1333
+ This allows you to tune memory swappiness behavior for this step.
1334
+ A swappiness value of 0 causes swapping not to happen unless absolutely
1335
+ necessary. A swappiness value of 100 causes pages to be swapped very
1336
+ aggressively. Accepted values are whole numbers between 0 and 100.
1337
+ use_tmpfs : bool, default False
1338
+ This enables an explicit tmpfs mount for this step. Note that tmpfs is
1339
+ not available on Fargate compute environments
1340
+ tmpfs_tempdir : bool, default True
1341
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1342
+ tmpfs_size : int, optional, default None
1343
+ The value for the size (in MiB) of the tmpfs mount for this step.
1344
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1345
+ memory allocated for this step.
1346
+ tmpfs_path : str, optional, default None
1347
+ Path to tmpfs mount for this step. Defaults to /metaflow_temp.
1348
+ inferentia : int, default 0
1349
+ Number of Inferentia chips required for this step.
1350
+ trainium : int, default None
1351
+ Alias for inferentia. Use only one of the two.
1352
+ efa : int, default 0
1353
+ Number of elastic fabric adapter network devices to attach to container
1354
+ ephemeral_storage : int, default None
1355
+ The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
1356
+ This is only relevant for Fargate compute environments
1357
+ log_driver: str, optional, default None
1358
+ The log driver to use for the Amazon ECS container.
1359
+ log_options: List[str], optional, default None
1360
+ List of strings containing options for the chosen log driver. The configurable values
1361
+ depend on the `log driver` chosen. Validation of these options is not supported yet.
1362
+ Example: [`awslogs-group:aws/batch/job`]
1454
1363
  """
1455
1364
  ...
1456
1365
 
1457
1366
  @typing.overload
1458
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1367
+ 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]]]:
1459
1368
  """
1460
- Specifies the PyPI packages for all steps of the flow.
1369
+ Specifies the PyPI packages for the step.
1461
1370
 
1462
- Use `@pypi_base` to set common packages required by all
1371
+ Information in this decorator will augment any
1372
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1373
+ you can use `@pypi_base` to set packages required by all
1463
1374
  steps and use `@pypi` to specify step-specific overrides.
1464
- Parameters
1465
- ----------
1466
- packages : Dict[str, str], default: {}
1467
- Packages to use for this flow. The key is the name of the package
1468
- and the value is the version to use.
1469
- python : str, optional, default: None
1470
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1471
- that the version used will correspond to the version of the Python interpreter used to start the run.
1472
- """
1473
- ...
1474
-
1475
- @typing.overload
1476
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1477
- ...
1478
-
1479
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1480
- """
1481
- Specifies the PyPI packages for all steps of the flow.
1482
1375
 
1483
- Use `@pypi_base` to set common packages required by all
1484
- steps and use `@pypi` to specify step-specific overrides.
1485
1376
  Parameters
1486
1377
  ----------
1487
1378
  packages : Dict[str, str], default: {}
1488
- Packages to use for this flow. The key is the name of the package
1379
+ Packages to use for this step. The key is the name of the package
1489
1380
  and the value is the version to use.
1490
1381
  python : str, optional, default: None
1491
1382
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
@@ -1493,165 +1384,31 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1493
1384
  """
1494
1385
  ...
1495
1386
 
1496
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1497
- """
1498
- Specifies what flows belong to the same project.
1499
-
1500
- A project-specific namespace is created for all flows that
1501
- use the same `@project(name)`.
1502
-
1503
- Parameters
1504
- ----------
1505
- name : str
1506
- Project name. Make sure that the name is unique amongst all
1507
- projects that use the same production scheduler. The name may
1508
- contain only lowercase alphanumeric characters and underscores.
1509
-
1510
-
1511
- """
1512
- ...
1513
-
1514
1387
  @typing.overload
1515
- def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1516
- """
1517
- Specifies the event(s) that this flow depends on.
1518
-
1519
- ```
1520
- @trigger(event='foo')
1521
- ```
1522
- or
1523
- ```
1524
- @trigger(events=['foo', 'bar'])
1525
- ```
1526
-
1527
- Additionally, you can specify the parameter mappings
1528
- to map event payload to Metaflow parameters for the flow.
1529
- ```
1530
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1531
- ```
1532
- or
1533
- ```
1534
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1535
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1536
- ```
1537
-
1538
- 'parameters' can also be a list of strings and tuples like so:
1539
- ```
1540
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1541
- ```
1542
- This is equivalent to:
1543
- ```
1544
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1545
- ```
1546
-
1547
- Parameters
1548
- ----------
1549
- event : Union[str, Dict[str, Any]], optional, default None
1550
- Event dependency for this flow.
1551
- events : List[Union[str, Dict[str, Any]]], default []
1552
- Events dependency for this flow.
1553
- options : Dict[str, Any], default {}
1554
- Backend-specific configuration for tuning eventing behavior.
1555
-
1556
-
1557
- """
1558
- ...
1559
-
1560
- @typing.overload
1561
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1562
- ...
1563
-
1564
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1565
- """
1566
- Specifies the event(s) that this flow depends on.
1567
-
1568
- ```
1569
- @trigger(event='foo')
1570
- ```
1571
- or
1572
- ```
1573
- @trigger(events=['foo', 'bar'])
1574
- ```
1575
-
1576
- Additionally, you can specify the parameter mappings
1577
- to map event payload to Metaflow parameters for the flow.
1578
- ```
1579
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1580
- ```
1581
- or
1582
- ```
1583
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1584
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1585
- ```
1586
-
1587
- 'parameters' can also be a list of strings and tuples like so:
1588
- ```
1589
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1590
- ```
1591
- This is equivalent to:
1592
- ```
1593
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1594
- ```
1595
-
1596
- Parameters
1597
- ----------
1598
- event : Union[str, Dict[str, Any]], optional, default None
1599
- Event dependency for this flow.
1600
- events : List[Union[str, Dict[str, Any]]], default []
1601
- Events dependency for this flow.
1602
- options : Dict[str, Any], default {}
1603
- Backend-specific configuration for tuning eventing behavior.
1604
-
1605
-
1606
- """
1607
- ...
1608
-
1609
- @typing.overload
1610
- def 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]]:
1611
- """
1612
- Specifies the times when the flow should be run when running on a
1613
- production scheduler.
1614
-
1615
- Parameters
1616
- ----------
1617
- hourly : bool, default False
1618
- Run the workflow hourly.
1619
- daily : bool, default True
1620
- Run the workflow daily.
1621
- weekly : bool, default False
1622
- Run the workflow weekly.
1623
- cron : str, optional, default None
1624
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1625
- specified by this expression.
1626
- timezone : str, optional, default None
1627
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1628
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1629
- """
1388
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1630
1389
  ...
1631
1390
 
1632
1391
  @typing.overload
1633
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1392
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1634
1393
  ...
1635
1394
 
1636
- 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):
1395
+ 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):
1637
1396
  """
1638
- Specifies the times when the flow should be run when running on a
1639
- production scheduler.
1397
+ Specifies the PyPI packages for the step.
1640
1398
 
1641
- Parameters
1642
- ----------
1643
- hourly : bool, default False
1644
- Run the workflow hourly.
1645
- daily : bool, default True
1646
- Run the workflow daily.
1647
- weekly : bool, default False
1648
- Run the workflow weekly.
1649
- cron : str, optional, default None
1650
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1651
- specified by this expression.
1652
- timezone : str, optional, default None
1653
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1654
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1399
+ Information in this decorator will augment any
1400
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1401
+ you can use `@pypi_base` to set packages required by all
1402
+ steps and use `@pypi` to specify step-specific overrides.
1403
+
1404
+ Parameters
1405
+ ----------
1406
+ packages : Dict[str, str], default: {}
1407
+ Packages to use for this step. The key is the name of the package
1408
+ and the value is the version to use.
1409
+ python : str, optional, default: None
1410
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1411
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1655
1412
  """
1656
1413
  ...
1657
1414
 
@@ -1758,6 +1515,48 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1758
1515
  """
1759
1516
  ...
1760
1517
 
1518
+ 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]]:
1519
+ """
1520
+ 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.
1521
+ 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.
1522
+
1523
+ Parameters
1524
+ ----------
1525
+ timeout : int
1526
+ Time, in seconds before the task times out and fails. (Default: 3600)
1527
+ poke_interval : int
1528
+ Time in seconds that the job should wait in between each try. (Default: 60)
1529
+ mode : str
1530
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1531
+ exponential_backoff : bool
1532
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1533
+ pool : str
1534
+ the slot pool this task should run in,
1535
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1536
+ soft_fail : bool
1537
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1538
+ name : str
1539
+ Name of the sensor on Airflow
1540
+ description : str
1541
+ Description of sensor in the Airflow UI
1542
+ external_dag_id : str
1543
+ The dag_id that contains the task you want to wait for.
1544
+ external_task_ids : List[str]
1545
+ The list of task_ids that you want to wait for.
1546
+ If None (default value) the sensor waits for the DAG. (Default: None)
1547
+ allowed_states : List[str]
1548
+ Iterable of allowed states, (Default: ['success'])
1549
+ failed_states : List[str]
1550
+ Iterable of failed or dis-allowed states. (Default: None)
1551
+ execution_delta : datetime.timedelta
1552
+ time difference with the previous execution to look at,
1553
+ the default is the same logical date as the current task or DAG. (Default: None)
1554
+ check_existence: bool
1555
+ Set to True to check if the external task exists or check if
1556
+ the DAG to wait for exists. (Default: True)
1557
+ """
1558
+ ...
1559
+
1761
1560
  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]]:
1762
1561
  """
1763
1562
  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)
@@ -1800,6 +1599,94 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1800
1599
  """
1801
1600
  ...
1802
1601
 
1602
+ @typing.overload
1603
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1604
+ """
1605
+ Specifies the PyPI packages for all steps of the flow.
1606
+
1607
+ Use `@pypi_base` to set common packages required by all
1608
+ steps and use `@pypi` to specify step-specific overrides.
1609
+ Parameters
1610
+ ----------
1611
+ packages : Dict[str, str], default: {}
1612
+ Packages to use for this flow. The key is the name of the package
1613
+ and the value is the version to use.
1614
+ python : str, optional, default: None
1615
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1616
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1617
+ """
1618
+ ...
1619
+
1620
+ @typing.overload
1621
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1622
+ ...
1623
+
1624
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1625
+ """
1626
+ Specifies the PyPI packages for all steps of the flow.
1627
+
1628
+ Use `@pypi_base` to set common packages required by all
1629
+ steps and use `@pypi` to specify step-specific overrides.
1630
+ Parameters
1631
+ ----------
1632
+ packages : Dict[str, str], default: {}
1633
+ Packages to use for this flow. The key is the name of the package
1634
+ and the value is the version to use.
1635
+ python : str, optional, default: None
1636
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1637
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1638
+ """
1639
+ ...
1640
+
1641
+ @typing.overload
1642
+ 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]]:
1643
+ """
1644
+ Specifies the times when the flow should be run when running on a
1645
+ production scheduler.
1646
+
1647
+ Parameters
1648
+ ----------
1649
+ hourly : bool, default False
1650
+ Run the workflow hourly.
1651
+ daily : bool, default True
1652
+ Run the workflow daily.
1653
+ weekly : bool, default False
1654
+ Run the workflow weekly.
1655
+ cron : str, optional, default None
1656
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1657
+ specified by this expression.
1658
+ timezone : str, optional, default None
1659
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1660
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1661
+ """
1662
+ ...
1663
+
1664
+ @typing.overload
1665
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1666
+ ...
1667
+
1668
+ 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):
1669
+ """
1670
+ Specifies the times when the flow should be run when running on a
1671
+ production scheduler.
1672
+
1673
+ Parameters
1674
+ ----------
1675
+ hourly : bool, default False
1676
+ Run the workflow hourly.
1677
+ daily : bool, default True
1678
+ Run the workflow daily.
1679
+ weekly : bool, default False
1680
+ Run the workflow weekly.
1681
+ cron : str, optional, default None
1682
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1683
+ specified by this expression.
1684
+ timezone : str, optional, default None
1685
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1686
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1687
+ """
1688
+ ...
1689
+
1803
1690
  @typing.overload
1804
1691
  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]]:
1805
1692
  """
@@ -1849,6 +1736,119 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1849
1736
  """
1850
1737
  ...
1851
1738
 
1739
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1740
+ """
1741
+ Specifies what flows belong to the same project.
1742
+
1743
+ A project-specific namespace is created for all flows that
1744
+ use the same `@project(name)`.
1745
+
1746
+ Parameters
1747
+ ----------
1748
+ name : str
1749
+ Project name. Make sure that the name is unique amongst all
1750
+ projects that use the same production scheduler. The name may
1751
+ contain only lowercase alphanumeric characters and underscores.
1752
+
1753
+
1754
+ """
1755
+ ...
1756
+
1757
+ @typing.overload
1758
+ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1759
+ """
1760
+ Specifies the event(s) that this flow depends on.
1761
+
1762
+ ```
1763
+ @trigger(event='foo')
1764
+ ```
1765
+ or
1766
+ ```
1767
+ @trigger(events=['foo', 'bar'])
1768
+ ```
1769
+
1770
+ Additionally, you can specify the parameter mappings
1771
+ to map event payload to Metaflow parameters for the flow.
1772
+ ```
1773
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1774
+ ```
1775
+ or
1776
+ ```
1777
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1778
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1779
+ ```
1780
+
1781
+ 'parameters' can also be a list of strings and tuples like so:
1782
+ ```
1783
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1784
+ ```
1785
+ This is equivalent to:
1786
+ ```
1787
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1788
+ ```
1789
+
1790
+ Parameters
1791
+ ----------
1792
+ event : Union[str, Dict[str, Any]], optional, default None
1793
+ Event dependency for this flow.
1794
+ events : List[Union[str, Dict[str, Any]]], default []
1795
+ Events dependency for this flow.
1796
+ options : Dict[str, Any], default {}
1797
+ Backend-specific configuration for tuning eventing behavior.
1798
+
1799
+
1800
+ """
1801
+ ...
1802
+
1803
+ @typing.overload
1804
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1805
+ ...
1806
+
1807
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1808
+ """
1809
+ Specifies the event(s) that this flow depends on.
1810
+
1811
+ ```
1812
+ @trigger(event='foo')
1813
+ ```
1814
+ or
1815
+ ```
1816
+ @trigger(events=['foo', 'bar'])
1817
+ ```
1818
+
1819
+ Additionally, you can specify the parameter mappings
1820
+ to map event payload to Metaflow parameters for the flow.
1821
+ ```
1822
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1823
+ ```
1824
+ or
1825
+ ```
1826
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1827
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1828
+ ```
1829
+
1830
+ 'parameters' can also be a list of strings and tuples like so:
1831
+ ```
1832
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1833
+ ```
1834
+ This is equivalent to:
1835
+ ```
1836
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1837
+ ```
1838
+
1839
+ Parameters
1840
+ ----------
1841
+ event : Union[str, Dict[str, Any]], optional, default None
1842
+ Event dependency for this flow.
1843
+ events : List[Union[str, Dict[str, Any]]], default []
1844
+ Events dependency for this flow.
1845
+ options : Dict[str, Any], default {}
1846
+ Backend-specific configuration for tuning eventing behavior.
1847
+
1848
+
1849
+ """
1850
+ ...
1851
+
1852
1852
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1853
1853
  """
1854
1854
  Switch namespace to the one provided.