metaflow-stubs 2.12.9__py2.py3-none-any.whl → 2.12.11__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 +570 -570
  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 +7 -7
  6. metaflow-stubs/client/filecache.pyi +2 -2
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +5 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +3 -3
  13. metaflow-stubs/metadata/metadata.pyi +3 -3
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +4 -2
  16. metaflow-stubs/metaflow_current.pyi +6 -6
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +3 -3
  20. metaflow-stubs/plugins/__init__.pyi +3 -3
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
  23. metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
  24. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +4 -4
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +4 -4
  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 +45 -11
  35. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +13 -13
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
  37. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +5 -5
  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 +3 -3
  46. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
  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 +3 -3
  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 +4 -4
  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 +2 -2
  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 +3 -3
  85. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  86. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  87. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  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 +4 -4
  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 +2 -2
  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 +4 -4
  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 +2 -2
  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 +3 -3
  110. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  111. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -4
  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 +2 -2
  115. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  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 +3 -3
  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 +4 -4
  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 +2 -2
  141. metaflow-stubs/system/system_logger.pyi +2 -2
  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.9.dist-info → metaflow_stubs-2.12.11.dist-info}/METADATA +2 -2
  147. metaflow_stubs-2.12.11.dist-info/RECORD +150 -0
  148. {metaflow_stubs-2.12.9.dist-info → metaflow_stubs-2.12.11.dist-info}/WHEEL +1 -1
  149. metaflow_stubs-2.12.9.dist-info/RECORD +0 -150
  150. {metaflow_stubs-2.12.9.dist-info → metaflow_stubs-2.12.11.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.9 #
4
- # Generated on 2024-07-25T18:20:16.223359 #
3
+ # MF version: 2.12.11 #
4
+ # Generated on 2024-08-09T01:05:47.258349 #
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.runner.metaflow_runner
12
11
  import io
13
- import metaflow.flowspec
14
- import typing
15
- import datetime
16
- import metaflow.client.core
17
- import metaflow.parameters
18
12
  import metaflow.metaflow_current
13
+ import typing
14
+ import metaflow.flowspec
15
+ import metaflow.runner.metaflow_runner
19
16
  import metaflow.datastore.inputs
20
17
  import metaflow._vendor.click.types
21
18
  import metaflow.events
19
+ import metaflow.parameters
22
20
  import metaflow.plugins.datatools.s3.s3
21
+ import datetime
22
+ import metaflow.client.core
23
23
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
24
24
  StepFlag = typing.NewType("StepFlag", bool)
25
25
 
@@ -727,113 +727,144 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
727
727
  """
728
728
  ...
729
729
 
730
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
730
+ @typing.overload
731
+ 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]]]:
731
732
  """
732
- Specifies that this step should execute on Kubernetes.
733
+ Specifies environment variables to be set prior to the execution of a step.
733
734
 
734
735
  Parameters
735
736
  ----------
736
- cpu : int, default 1
737
- Number of CPUs required for this step. If `@resources` is
738
- also present, the maximum value from all decorators is used.
739
- memory : int, default 4096
740
- Memory size (in MB) required for this step. If
741
- `@resources` is also present, the maximum value from all decorators is
742
- used.
743
- disk : int, default 10240
744
- Disk 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 Kubernetes. If not specified, and
749
- METAFLOW_KUBERNETES_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
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
752
- If given, the imagePullPolicy to be applied to the Docker image of the step.
753
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
754
- Kubernetes service account to use when launching pod in Kubernetes.
755
- secrets : List[str], optional, default None
756
- Kubernetes secrets to use when launching pod in Kubernetes. These
757
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
758
- in Metaflow configuration.
759
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
760
- Kubernetes namespace to use when launching pod in Kubernetes.
761
- gpu : int, optional, default None
762
- Number of GPUs required for this step. A value of zero implies that
763
- the scheduled node should not have GPUs.
764
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
765
- The vendor of the GPUs to be used for this step.
766
- tolerations : List[str], default []
767
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
768
- Kubernetes tolerations to use when launching pod in Kubernetes.
769
- use_tmpfs : bool, default False
770
- This enables an explicit tmpfs mount for this step.
771
- tmpfs_tempdir : bool, default True
772
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
773
- tmpfs_size : int, optional, default: None
774
- The value for the size (in MiB) of the tmpfs mount for this step.
775
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
776
- memory allocated for this step.
777
- tmpfs_path : str, optional, default /metaflow_temp
778
- Path to tmpfs mount for this step.
779
- persistent_volume_claims : Dict[str, str], optional, default None
780
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
781
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
782
- shared_memory: int, optional
783
- Shared memory size (in MiB) required for this step
784
- port: int, optional
785
- Port number to specify in the Kubernetes job object
737
+ vars : Dict[str, str], default {}
738
+ Dictionary of environment variables to set.
786
739
  """
787
740
  ...
788
741
 
789
742
  @typing.overload
790
- 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]]]:
743
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
744
+ ...
745
+
746
+ @typing.overload
747
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
748
+ ...
749
+
750
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
791
751
  """
792
- Creates a human-readable report, a Metaflow Card, after this step completes.
793
-
794
- Note that you may add multiple `@card` decorators in a step with different parameters.
752
+ Specifies environment variables to be set prior to the execution of a step.
795
753
 
796
754
  Parameters
797
755
  ----------
798
- type : str, default 'default'
799
- Card type.
800
- id : str, optional, default None
801
- If multiple cards are present, use this id to identify this card.
802
- options : Dict[str, Any], default {}
803
- Options passed to the card. The contents depend on the card type.
804
- timeout : int, default 45
805
- Interrupt reporting if it takes more than this many seconds.
756
+ vars : Dict[str, str], default {}
757
+ Dictionary of environment variables to set.
758
+ """
759
+ ...
760
+
761
+ @typing.overload
762
+ 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]]]:
763
+ """
764
+ Specifies the Conda environment for the step.
806
765
 
766
+ Information in this decorator will augment any
767
+ attributes set in the `@conda_base` flow-level decorator. Hence,
768
+ you can use `@conda_base` to set packages required by all
769
+ steps and use `@conda` to specify step-specific overrides.
807
770
 
771
+ Parameters
772
+ ----------
773
+ packages : Dict[str, str], default {}
774
+ Packages to use for this step. The key is the name of the package
775
+ and the value is the version to use.
776
+ libraries : Dict[str, str], default {}
777
+ Supported for backward compatibility. When used with packages, packages will take precedence.
778
+ python : str, optional, default None
779
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
780
+ that the version used will correspond to the version of the Python interpreter used to start the run.
781
+ disabled : bool, default False
782
+ If set to True, disables @conda.
808
783
  """
809
784
  ...
810
785
 
811
786
  @typing.overload
812
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
787
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
813
788
  ...
814
789
 
815
790
  @typing.overload
816
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
791
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
817
792
  ...
818
793
 
819
- def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
794
+ 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):
820
795
  """
821
- Creates a human-readable report, a Metaflow Card, after this step completes.
796
+ Specifies the Conda environment for the step.
822
797
 
823
- Note that you may add multiple `@card` decorators in a step with different parameters.
798
+ Information in this decorator will augment any
799
+ attributes set in the `@conda_base` flow-level decorator. Hence,
800
+ you can use `@conda_base` to set packages required by all
801
+ steps and use `@conda` to specify step-specific overrides.
824
802
 
825
803
  Parameters
826
804
  ----------
827
- type : str, default 'default'
828
- Card type.
829
- id : str, optional, default None
830
- If multiple cards are present, use this id to identify this card.
831
- options : Dict[str, Any], default {}
832
- Options passed to the card. The contents depend on the card type.
833
- timeout : int, default 45
834
- Interrupt reporting if it takes more than this many seconds.
805
+ packages : Dict[str, str], default {}
806
+ Packages to use for this step. The key is the name of the package
807
+ and the value is the version to use.
808
+ libraries : Dict[str, str], default {}
809
+ Supported for backward compatibility. When used with packages, packages will take precedence.
810
+ python : str, optional, default None
811
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
812
+ that the version used will correspond to the version of the Python interpreter used to start the run.
813
+ disabled : bool, default False
814
+ If set to True, disables @conda.
815
+ """
816
+ ...
817
+
818
+ @typing.overload
819
+ 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]]]:
820
+ """
821
+ Specifies the number of times the task corresponding
822
+ to a step needs to be retried.
823
+
824
+ This decorator is useful for handling transient errors, such as networking issues.
825
+ If your task contains operations that can't be retried safely, e.g. database updates,
826
+ it is advisable to annotate it with `@retry(times=0)`.
827
+
828
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
829
+ decorator will execute a no-op task after all retries have been exhausted,
830
+ ensuring that the flow execution can continue.
831
+
832
+ Parameters
833
+ ----------
834
+ times : int, default 3
835
+ Number of times to retry this task.
836
+ minutes_between_retries : int, default 2
837
+ Number of minutes between retries.
838
+ """
839
+ ...
840
+
841
+ @typing.overload
842
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
843
+ ...
844
+
845
+ @typing.overload
846
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
847
+ ...
848
+
849
+ 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):
850
+ """
851
+ Specifies the number of times the task corresponding
852
+ to a step needs to be retried.
835
853
 
854
+ This decorator is useful for handling transient errors, such as networking issues.
855
+ If your task contains operations that can't be retried safely, e.g. database updates,
856
+ it is advisable to annotate it with `@retry(times=0)`.
857
+
858
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
859
+ decorator will execute a no-op task after all retries have been exhausted,
860
+ ensuring that the flow execution can continue.
836
861
 
862
+ Parameters
863
+ ----------
864
+ times : int, default 3
865
+ Number of times to retry this task.
866
+ minutes_between_retries : int, default 2
867
+ Number of minutes between retries.
837
868
  """
838
869
  ...
839
870
 
@@ -985,56 +1016,141 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
985
1016
  ...
986
1017
 
987
1018
  @typing.overload
988
- 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]]]:
1019
+ 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]]]:
989
1020
  """
990
- Specifies the PyPI packages for the step.
1021
+ Specifies a timeout for your step.
991
1022
 
992
- Information in this decorator will augment any
993
- attributes set in the `@pyi_base` flow-level decorator. Hence,
994
- you can use `@pypi_base` to set packages required by all
995
- steps and use `@pypi` to specify step-specific overrides.
1023
+ This decorator is useful if this step may hang indefinitely.
1024
+
1025
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1026
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1027
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1028
+
1029
+ Note that all the values specified in parameters are added together so if you specify
1030
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
996
1031
 
997
1032
  Parameters
998
1033
  ----------
999
- packages : Dict[str, str], default: {}
1000
- Packages to use for this step. The key is the name of the package
1001
- and the value is the version to use.
1002
- python : str, optional, default: None
1003
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1004
- that the version used will correspond to the version of the Python interpreter used to start the run.
1034
+ seconds : int, default 0
1035
+ Number of seconds to wait prior to timing out.
1036
+ minutes : int, default 0
1037
+ Number of minutes to wait prior to timing out.
1038
+ hours : int, default 0
1039
+ Number of hours to wait prior to timing out.
1005
1040
  """
1006
1041
  ...
1007
1042
 
1008
1043
  @typing.overload
1009
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1044
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1010
1045
  ...
1011
1046
 
1012
1047
  @typing.overload
1013
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1048
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1014
1049
  ...
1015
1050
 
1016
- 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):
1051
+ 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):
1017
1052
  """
1018
- Specifies the PyPI packages for the step.
1053
+ Specifies a timeout for your step.
1019
1054
 
1020
- Information in this decorator will augment any
1021
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1022
- you can use `@pypi_base` to set packages required by all
1023
- steps and use `@pypi` to specify step-specific overrides.
1055
+ This decorator is useful if this step may hang indefinitely.
1056
+
1057
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1058
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1059
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1060
+
1061
+ Note that all the values specified in parameters are added together so if you specify
1062
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1024
1063
 
1025
1064
  Parameters
1026
1065
  ----------
1027
- packages : Dict[str, str], default: {}
1028
- Packages to use for this step. The key is the name of the package
1029
- and the value is the version to use.
1030
- python : str, optional, default: None
1031
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1032
- that the version used will correspond to the version of the Python interpreter used to start the run.
1033
- """
1034
- ...
1035
-
1036
- @typing.overload
1037
- 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]]]:
1066
+ seconds : int, default 0
1067
+ Number of seconds to wait prior to timing out.
1068
+ minutes : int, default 0
1069
+ Number of minutes to wait prior to timing out.
1070
+ hours : int, default 0
1071
+ Number of hours to wait prior to timing out.
1072
+ """
1073
+ ...
1074
+
1075
+ @typing.overload
1076
+ 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]]]:
1077
+ """
1078
+ Specifies the resources needed when executing this step.
1079
+
1080
+ Use `@resources` to specify the resource requirements
1081
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1082
+
1083
+ You can choose the compute layer on the command line by executing e.g.
1084
+ ```
1085
+ python myflow.py run --with batch
1086
+ ```
1087
+ or
1088
+ ```
1089
+ python myflow.py run --with kubernetes
1090
+ ```
1091
+ which executes the flow on the desired system using the
1092
+ requirements specified in `@resources`.
1093
+
1094
+ Parameters
1095
+ ----------
1096
+ cpu : int, default 1
1097
+ Number of CPUs required for this step.
1098
+ gpu : int, default 0
1099
+ Number of GPUs required for this step.
1100
+ disk : int, optional, default None
1101
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1102
+ memory : int, default 4096
1103
+ Memory size (in MB) required for this step.
1104
+ shared_memory : int, optional, default None
1105
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1106
+ This parameter maps to the `--shm-size` option in Docker.
1107
+ """
1108
+ ...
1109
+
1110
+ @typing.overload
1111
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1112
+ ...
1113
+
1114
+ @typing.overload
1115
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1116
+ ...
1117
+
1118
+ 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):
1119
+ """
1120
+ Specifies the resources needed when executing this step.
1121
+
1122
+ Use `@resources` to specify the resource requirements
1123
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1124
+
1125
+ You can choose the compute layer on the command line by executing e.g.
1126
+ ```
1127
+ python myflow.py run --with batch
1128
+ ```
1129
+ or
1130
+ ```
1131
+ python myflow.py run --with kubernetes
1132
+ ```
1133
+ which executes the flow on the desired system using the
1134
+ requirements specified in `@resources`.
1135
+
1136
+ Parameters
1137
+ ----------
1138
+ cpu : int, default 1
1139
+ Number of CPUs required for this step.
1140
+ gpu : int, default 0
1141
+ Number of GPUs required for this step.
1142
+ disk : int, optional, default None
1143
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1144
+ memory : int, default 4096
1145
+ Memory size (in MB) required for this step.
1146
+ shared_memory : int, optional, default None
1147
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1148
+ This parameter maps to the `--shm-size` option in Docker.
1149
+ """
1150
+ ...
1151
+
1152
+ @typing.overload
1153
+ 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]]]:
1038
1154
  """
1039
1155
  Specifies that the step will success under all circumstances.
1040
1156
 
@@ -1082,6 +1198,116 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1082
1198
  """
1083
1199
  ...
1084
1200
 
1201
+ @typing.overload
1202
+ 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]]]:
1203
+ """
1204
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1205
+
1206
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1207
+
1208
+ Parameters
1209
+ ----------
1210
+ type : str, default 'default'
1211
+ Card type.
1212
+ id : str, optional, default None
1213
+ If multiple cards are present, use this id to identify this card.
1214
+ options : Dict[str, Any], default {}
1215
+ Options passed to the card. The contents depend on the card type.
1216
+ timeout : int, default 45
1217
+ Interrupt reporting if it takes more than this many seconds.
1218
+
1219
+
1220
+ """
1221
+ ...
1222
+
1223
+ @typing.overload
1224
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1225
+ ...
1226
+
1227
+ @typing.overload
1228
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1229
+ ...
1230
+
1231
+ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
1232
+ """
1233
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1234
+
1235
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1236
+
1237
+ Parameters
1238
+ ----------
1239
+ type : str, default 'default'
1240
+ Card type.
1241
+ id : str, optional, default None
1242
+ If multiple cards are present, use this id to identify this card.
1243
+ options : Dict[str, Any], default {}
1244
+ Options passed to the card. The contents depend on the card type.
1245
+ timeout : int, default 45
1246
+ Interrupt reporting if it takes more than this many seconds.
1247
+
1248
+
1249
+ """
1250
+ ...
1251
+
1252
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1253
+ """
1254
+ Specifies that this step should execute on Kubernetes.
1255
+
1256
+ Parameters
1257
+ ----------
1258
+ cpu : int, default 1
1259
+ Number of CPUs required for this step. If `@resources` is
1260
+ also present, the maximum value from all decorators is used.
1261
+ memory : int, default 4096
1262
+ Memory size (in MB) required for this step. If
1263
+ `@resources` is also present, the maximum value from all decorators is
1264
+ used.
1265
+ disk : int, default 10240
1266
+ Disk size (in MB) required for this step. If
1267
+ `@resources` is also present, the maximum value from all decorators is
1268
+ used.
1269
+ image : str, optional, default None
1270
+ Docker image to use when launching on Kubernetes. If not specified, and
1271
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1272
+ not, a default Docker image mapping to the current version of Python is used.
1273
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1274
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
1275
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1276
+ Kubernetes service account to use when launching pod in Kubernetes.
1277
+ secrets : List[str], optional, default None
1278
+ Kubernetes secrets to use when launching pod in Kubernetes. These
1279
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1280
+ in Metaflow configuration.
1281
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1282
+ Kubernetes namespace to use when launching pod in Kubernetes.
1283
+ gpu : int, optional, default None
1284
+ Number of GPUs required for this step. A value of zero implies that
1285
+ the scheduled node should not have GPUs.
1286
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1287
+ The vendor of the GPUs to be used for this step.
1288
+ tolerations : List[str], default []
1289
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1290
+ Kubernetes tolerations to use when launching pod in Kubernetes.
1291
+ use_tmpfs : bool, default False
1292
+ This enables an explicit tmpfs mount for this step.
1293
+ tmpfs_tempdir : bool, default True
1294
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1295
+ tmpfs_size : int, optional, default: None
1296
+ The value for the size (in MiB) of the tmpfs mount for this step.
1297
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1298
+ memory allocated for this step.
1299
+ tmpfs_path : str, optional, default /metaflow_temp
1300
+ Path to tmpfs mount for this step.
1301
+ persistent_volume_claims : Dict[str, str], optional, default None
1302
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1303
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1304
+ shared_memory: int, optional
1305
+ Shared memory size (in MiB) required for this step
1306
+ port: int, optional
1307
+ Port number to specify in the Kubernetes job object
1308
+ """
1309
+ ...
1310
+
1085
1311
  @typing.overload
1086
1312
  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]]]:
1087
1313
  """
@@ -1116,391 +1342,252 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
1116
1342
  ...
1117
1343
 
1118
1344
  @typing.overload
1119
- 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]]]:
1345
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1120
1346
  """
1121
- Specifies the number of times the task corresponding
1122
- to a step needs to be retried.
1123
-
1124
- This decorator is useful for handling transient errors, such as networking issues.
1125
- If your task contains operations that can't be retried safely, e.g. database updates,
1126
- it is advisable to annotate it with `@retry(times=0)`.
1127
-
1128
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1129
- decorator will execute a no-op task after all retries have been exhausted,
1130
- ensuring that the flow execution can continue.
1131
-
1132
- Parameters
1133
- ----------
1134
- times : int, default 3
1135
- Number of times to retry this task.
1136
- minutes_between_retries : int, default 2
1137
- Number of minutes between retries.
1347
+ Decorator prototype for all step decorators. This function gets specialized
1348
+ and imported for all decorators types by _import_plugin_decorators().
1138
1349
  """
1139
1350
  ...
1140
1351
 
1141
1352
  @typing.overload
1142
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1143
- ...
1144
-
1145
- @typing.overload
1146
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1353
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1147
1354
  ...
1148
1355
 
1149
- 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):
1356
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1150
1357
  """
1151
- Specifies the number of times the task corresponding
1152
- to a step needs to be retried.
1153
-
1154
- This decorator is useful for handling transient errors, such as networking issues.
1155
- If your task contains operations that can't be retried safely, e.g. database updates,
1156
- it is advisable to annotate it with `@retry(times=0)`.
1157
-
1158
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1159
- decorator will execute a no-op task after all retries have been exhausted,
1160
- ensuring that the flow execution can continue.
1161
-
1162
- Parameters
1163
- ----------
1164
- times : int, default 3
1165
- Number of times to retry this task.
1166
- minutes_between_retries : int, default 2
1167
- Number of minutes between retries.
1358
+ Decorator prototype for all step decorators. This function gets specialized
1359
+ and imported for all decorators types by _import_plugin_decorators().
1168
1360
  """
1169
1361
  ...
1170
1362
 
1171
1363
  @typing.overload
1172
- 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]]]:
1364
+ 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]]]:
1173
1365
  """
1174
- Specifies the Conda environment for the step.
1366
+ Specifies the PyPI packages for the step.
1175
1367
 
1176
1368
  Information in this decorator will augment any
1177
- attributes set in the `@conda_base` flow-level decorator. Hence,
1178
- you can use `@conda_base` to set packages required by all
1179
- steps and use `@conda` to specify step-specific overrides.
1369
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1370
+ you can use `@pypi_base` to set packages required by all
1371
+ steps and use `@pypi` to specify step-specific overrides.
1180
1372
 
1181
1373
  Parameters
1182
1374
  ----------
1183
- packages : Dict[str, str], default {}
1375
+ packages : Dict[str, str], default: {}
1184
1376
  Packages to use for this step. The key is the name of the package
1185
1377
  and the value is the version to use.
1186
- libraries : Dict[str, str], default {}
1187
- Supported for backward compatibility. When used with packages, packages will take precedence.
1188
- python : str, optional, default None
1378
+ python : str, optional, default: None
1189
1379
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1190
1380
  that the version used will correspond to the version of the Python interpreter used to start the run.
1191
- disabled : bool, default False
1192
- If set to True, disables @conda.
1193
1381
  """
1194
1382
  ...
1195
1383
 
1196
1384
  @typing.overload
1197
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1385
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1198
1386
  ...
1199
1387
 
1200
1388
  @typing.overload
1201
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1389
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1202
1390
  ...
1203
1391
 
1204
- 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):
1392
+ 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):
1205
1393
  """
1206
- Specifies the Conda environment for the step.
1394
+ Specifies the PyPI packages for the step.
1207
1395
 
1208
1396
  Information in this decorator will augment any
1209
- attributes set in the `@conda_base` flow-level decorator. Hence,
1210
- you can use `@conda_base` to set packages required by all
1211
- steps and use `@conda` to specify step-specific overrides.
1397
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1398
+ you can use `@pypi_base` to set packages required by all
1399
+ steps and use `@pypi` to specify step-specific overrides.
1212
1400
 
1213
1401
  Parameters
1214
1402
  ----------
1215
- packages : Dict[str, str], default {}
1403
+ packages : Dict[str, str], default: {}
1216
1404
  Packages to use for this step. The key is the name of the package
1217
1405
  and the value is the version to use.
1218
- libraries : Dict[str, str], default {}
1219
- Supported for backward compatibility. When used with packages, packages will take precedence.
1220
- python : str, optional, default None
1406
+ python : str, optional, default: None
1221
1407
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1222
1408
  that the version used will correspond to the version of the Python interpreter used to start the run.
1223
- disabled : bool, default False
1224
- If set to True, disables @conda.
1225
- """
1226
- ...
1227
-
1228
- @typing.overload
1229
- 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]]]:
1230
- """
1231
- Specifies environment variables to be set prior to the execution of a step.
1232
-
1233
- Parameters
1234
- ----------
1235
- vars : Dict[str, str], default {}
1236
- Dictionary of environment variables to set.
1237
- """
1238
- ...
1239
-
1240
- @typing.overload
1241
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1242
- ...
1243
-
1244
- @typing.overload
1245
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1246
- ...
1247
-
1248
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1249
- """
1250
- Specifies environment variables to be set prior to the execution of a step.
1251
-
1252
- Parameters
1253
- ----------
1254
- vars : Dict[str, str], default {}
1255
- Dictionary of environment variables to set.
1256
- """
1257
- ...
1258
-
1259
- @typing.overload
1260
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1261
- """
1262
- Decorator prototype for all step decorators. This function gets specialized
1263
- and imported for all decorators types by _import_plugin_decorators().
1264
1409
  """
1265
1410
  ...
1266
1411
 
1267
- @typing.overload
1268
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1269
- ...
1270
-
1271
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1272
- """
1273
- Decorator prototype for all step decorators. This function gets specialized
1274
- and imported for all decorators types by _import_plugin_decorators().
1275
- """
1276
- ...
1277
-
1278
- @typing.overload
1279
- 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]]]:
1412
+ 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]]:
1280
1413
  """
1281
- Specifies a timeout for your step.
1282
-
1283
- This decorator is useful if this step may hang indefinitely.
1284
-
1285
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1286
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1287
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1288
-
1289
- Note that all the values specified in parameters are added together so if you specify
1290
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1414
+ 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)
1415
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1416
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1417
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1418
+ starts only after all sensors finish.
1291
1419
 
1292
1420
  Parameters
1293
1421
  ----------
1294
- seconds : int, default 0
1295
- Number of seconds to wait prior to timing out.
1296
- minutes : int, default 0
1297
- Number of minutes to wait prior to timing out.
1298
- hours : int, default 0
1299
- Number of hours to wait prior to timing out.
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
+ bucket_key : Union[str, List[str]]
1440
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1441
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1442
+ bucket_name : str
1443
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1444
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1445
+ wildcard_match : bool
1446
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1447
+ aws_conn_id : str
1448
+ a reference to the s3 connection on Airflow. (Default: None)
1449
+ verify : bool
1450
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1300
1451
  """
1301
1452
  ...
1302
1453
 
1303
- @typing.overload
1304
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1305
- ...
1306
-
1307
- @typing.overload
1308
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1309
- ...
1310
-
1311
- 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):
1454
+ 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]]:
1312
1455
  """
1313
- Specifies a timeout for your step.
1314
-
1315
- This decorator is useful if this step may hang indefinitely.
1316
-
1317
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1318
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1319
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1320
-
1321
- Note that all the values specified in parameters are added together so if you specify
1322
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1456
+ 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.
1457
+ 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.
1323
1458
 
1324
1459
  Parameters
1325
1460
  ----------
1326
- seconds : int, default 0
1327
- Number of seconds to wait prior to timing out.
1328
- minutes : int, default 0
1329
- Number of minutes to wait prior to timing out.
1330
- hours : int, default 0
1331
- Number of hours to wait prior to timing out.
1461
+ timeout : int
1462
+ Time, in seconds before the task times out and fails. (Default: 3600)
1463
+ poke_interval : int
1464
+ Time in seconds that the job should wait in between each try. (Default: 60)
1465
+ mode : str
1466
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1467
+ exponential_backoff : bool
1468
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1469
+ pool : str
1470
+ the slot pool this task should run in,
1471
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1472
+ soft_fail : bool
1473
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1474
+ name : str
1475
+ Name of the sensor on Airflow
1476
+ description : str
1477
+ Description of sensor in the Airflow UI
1478
+ external_dag_id : str
1479
+ The dag_id that contains the task you want to wait for.
1480
+ external_task_ids : List[str]
1481
+ The list of task_ids that you want to wait for.
1482
+ If None (default value) the sensor waits for the DAG. (Default: None)
1483
+ allowed_states : List[str]
1484
+ Iterable of allowed states, (Default: ['success'])
1485
+ failed_states : List[str]
1486
+ Iterable of failed or dis-allowed states. (Default: None)
1487
+ execution_delta : datetime.timedelta
1488
+ time difference with the previous execution to look at,
1489
+ the default is the same logical date as the current task or DAG. (Default: None)
1490
+ check_existence: bool
1491
+ Set to True to check if the external task exists or check if
1492
+ the DAG to wait for exists. (Default: True)
1332
1493
  """
1333
1494
  ...
1334
1495
 
1335
1496
  @typing.overload
1336
- def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1497
+ 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]]:
1337
1498
  """
1338
- Specifies the resources needed when executing this step.
1339
-
1340
- Use `@resources` to specify the resource requirements
1341
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1342
-
1343
- You can choose the compute layer on the command line by executing e.g.
1344
- ```
1345
- python myflow.py run --with batch
1346
- ```
1347
- or
1348
- ```
1349
- python myflow.py run --with kubernetes
1350
- ```
1351
- which executes the flow on the desired system using the
1352
- requirements specified in `@resources`.
1499
+ Specifies the times when the flow should be run when running on a
1500
+ production scheduler.
1353
1501
 
1354
1502
  Parameters
1355
1503
  ----------
1356
- cpu : int, default 1
1357
- Number of CPUs required for this step.
1358
- gpu : int, default 0
1359
- Number of GPUs required for this step.
1360
- disk : int, optional, default None
1361
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1362
- memory : int, default 4096
1363
- Memory size (in MB) required for this step.
1364
- shared_memory : int, optional, default None
1365
- The value for the size (in MiB) of the /dev/shm volume for this step.
1366
- This parameter maps to the `--shm-size` option in Docker.
1504
+ hourly : bool, default False
1505
+ Run the workflow hourly.
1506
+ daily : bool, default True
1507
+ Run the workflow daily.
1508
+ weekly : bool, default False
1509
+ Run the workflow weekly.
1510
+ cron : str, optional, default None
1511
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1512
+ specified by this expression.
1513
+ timezone : str, optional, default None
1514
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1515
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1367
1516
  """
1368
1517
  ...
1369
1518
 
1370
1519
  @typing.overload
1371
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1372
- ...
1373
-
1374
- @typing.overload
1375
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1520
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1376
1521
  ...
1377
1522
 
1378
- def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
1523
+ 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):
1379
1524
  """
1380
- Specifies the resources needed when executing this step.
1381
-
1382
- Use `@resources` to specify the resource requirements
1383
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1384
-
1385
- You can choose the compute layer on the command line by executing e.g.
1386
- ```
1387
- python myflow.py run --with batch
1388
- ```
1389
- or
1390
- ```
1391
- python myflow.py run --with kubernetes
1392
- ```
1393
- which executes the flow on the desired system using the
1394
- requirements specified in `@resources`.
1525
+ Specifies the times when the flow should be run when running on a
1526
+ production scheduler.
1395
1527
 
1396
1528
  Parameters
1397
1529
  ----------
1398
- cpu : int, default 1
1399
- Number of CPUs required for this step.
1400
- gpu : int, default 0
1401
- Number of GPUs required for this step.
1402
- disk : int, optional, default None
1403
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1404
- memory : int, default 4096
1405
- Memory size (in MB) required for this step.
1406
- shared_memory : int, optional, default None
1407
- The value for the size (in MiB) of the /dev/shm volume for this step.
1408
- This parameter maps to the `--shm-size` option in Docker.
1530
+ hourly : bool, default False
1531
+ Run the workflow hourly.
1532
+ daily : bool, default True
1533
+ Run the workflow daily.
1534
+ weekly : bool, default False
1535
+ Run the workflow weekly.
1536
+ cron : str, optional, default None
1537
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1538
+ specified by this expression.
1539
+ timezone : str, optional, default None
1540
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1541
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1409
1542
  """
1410
1543
  ...
1411
1544
 
1412
1545
  @typing.overload
1413
- def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1546
+ 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]]:
1414
1547
  """
1415
- Specifies the event(s) that this flow depends on.
1416
-
1417
- ```
1418
- @trigger(event='foo')
1419
- ```
1420
- or
1421
- ```
1422
- @trigger(events=['foo', 'bar'])
1423
- ```
1424
-
1425
- Additionally, you can specify the parameter mappings
1426
- to map event payload to Metaflow parameters for the flow.
1427
- ```
1428
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1429
- ```
1430
- or
1431
- ```
1432
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1433
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1434
- ```
1548
+ Specifies the Conda environment for all steps of the flow.
1435
1549
 
1436
- 'parameters' can also be a list of strings and tuples like so:
1437
- ```
1438
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1439
- ```
1440
- This is equivalent to:
1441
- ```
1442
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1443
- ```
1550
+ Use `@conda_base` to set common libraries required by all
1551
+ steps and use `@conda` to specify step-specific additions.
1444
1552
 
1445
1553
  Parameters
1446
1554
  ----------
1447
- event : Union[str, Dict[str, Any]], optional, default None
1448
- Event dependency for this flow.
1449
- events : List[Union[str, Dict[str, Any]]], default []
1450
- Events dependency for this flow.
1451
- options : Dict[str, Any], default {}
1452
- Backend-specific configuration for tuning eventing behavior.
1453
-
1454
-
1555
+ packages : Dict[str, str], default {}
1556
+ Packages to use for this flow. The key is the name of the package
1557
+ and the value is the version to use.
1558
+ libraries : Dict[str, str], default {}
1559
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1560
+ python : str, optional, default None
1561
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1562
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1563
+ disabled : bool, default False
1564
+ If set to True, disables Conda.
1455
1565
  """
1456
1566
  ...
1457
1567
 
1458
1568
  @typing.overload
1459
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1569
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1460
1570
  ...
1461
1571
 
1462
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1572
+ 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):
1463
1573
  """
1464
- Specifies the event(s) that this flow depends on.
1465
-
1466
- ```
1467
- @trigger(event='foo')
1468
- ```
1469
- or
1470
- ```
1471
- @trigger(events=['foo', 'bar'])
1472
- ```
1473
-
1474
- Additionally, you can specify the parameter mappings
1475
- to map event payload to Metaflow parameters for the flow.
1476
- ```
1477
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1478
- ```
1479
- or
1480
- ```
1481
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1482
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1483
- ```
1484
-
1485
- 'parameters' can also be a list of strings and tuples like so:
1486
- ```
1487
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1488
- ```
1489
- This is equivalent to:
1490
- ```
1491
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1492
- ```
1574
+ Specifies the Conda environment for all steps of the flow.
1575
+
1576
+ Use `@conda_base` to set common libraries required by all
1577
+ steps and use `@conda` to specify step-specific additions.
1493
1578
 
1494
1579
  Parameters
1495
1580
  ----------
1496
- event : Union[str, Dict[str, Any]], optional, default None
1497
- Event dependency for this flow.
1498
- events : List[Union[str, Dict[str, Any]]], default []
1499
- Events dependency for this flow.
1500
- options : Dict[str, Any], default {}
1501
- Backend-specific configuration for tuning eventing behavior.
1502
-
1503
-
1581
+ packages : Dict[str, str], default {}
1582
+ Packages to use for this flow. The key is the name of the package
1583
+ and the value is the version to use.
1584
+ libraries : Dict[str, str], default {}
1585
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1586
+ python : str, optional, default None
1587
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1588
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1589
+ disabled : bool, default False
1590
+ If set to True, disables Conda.
1504
1591
  """
1505
1592
  ...
1506
1593
 
@@ -1647,93 +1734,97 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1647
1734
  ...
1648
1735
 
1649
1736
  @typing.overload
1650
- 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]]:
1737
+ 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]]:
1651
1738
  """
1652
- Specifies the Conda environment for all steps of the flow.
1739
+ Specifies the event(s) that this flow depends on.
1653
1740
 
1654
- Use `@conda_base` to set common libraries required by all
1655
- steps and use `@conda` to specify step-specific additions.
1741
+ ```
1742
+ @trigger(event='foo')
1743
+ ```
1744
+ or
1745
+ ```
1746
+ @trigger(events=['foo', 'bar'])
1747
+ ```
1748
+
1749
+ Additionally, you can specify the parameter mappings
1750
+ to map event payload to Metaflow parameters for the flow.
1751
+ ```
1752
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1753
+ ```
1754
+ or
1755
+ ```
1756
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1757
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1758
+ ```
1759
+
1760
+ 'parameters' can also be a list of strings and tuples like so:
1761
+ ```
1762
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1763
+ ```
1764
+ This is equivalent to:
1765
+ ```
1766
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1767
+ ```
1656
1768
 
1657
1769
  Parameters
1658
1770
  ----------
1659
- packages : Dict[str, str], default {}
1660
- Packages to use for this flow. The key is the name of the package
1661
- and the value is the version to use.
1662
- libraries : Dict[str, str], default {}
1663
- Supported for backward compatibility. When used with packages, packages will take precedence.
1664
- python : str, optional, default None
1665
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1666
- that the version used will correspond to the version of the Python interpreter used to start the run.
1667
- disabled : bool, default False
1668
- If set to True, disables Conda.
1771
+ event : Union[str, Dict[str, Any]], optional, default None
1772
+ Event dependency for this flow.
1773
+ events : List[Union[str, Dict[str, Any]]], default []
1774
+ Events dependency for this flow.
1775
+ options : Dict[str, Any], default {}
1776
+ Backend-specific configuration for tuning eventing behavior.
1777
+
1778
+
1669
1779
  """
1670
1780
  ...
1671
1781
 
1672
1782
  @typing.overload
1673
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1783
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1674
1784
  ...
1675
1785
 
1676
- 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):
1786
+ 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] = {}):
1677
1787
  """
1678
- Specifies the Conda environment for all steps of the flow.
1788
+ Specifies the event(s) that this flow depends on.
1679
1789
 
1680
- Use `@conda_base` to set common libraries required by all
1681
- steps and use `@conda` to specify step-specific additions.
1790
+ ```
1791
+ @trigger(event='foo')
1792
+ ```
1793
+ or
1794
+ ```
1795
+ @trigger(events=['foo', 'bar'])
1796
+ ```
1682
1797
 
1683
- Parameters
1684
- ----------
1685
- packages : Dict[str, str], default {}
1686
- Packages to use for this flow. The key is the name of the package
1687
- and the value is the version to use.
1688
- libraries : Dict[str, str], default {}
1689
- Supported for backward compatibility. When used with packages, packages will take precedence.
1690
- python : str, optional, default None
1691
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1692
- that the version used will correspond to the version of the Python interpreter used to start the run.
1693
- disabled : bool, default False
1694
- If set to True, disables Conda.
1695
- """
1696
- ...
1697
-
1698
- 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]]:
1699
- """
1700
- 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.
1701
- 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.
1798
+ Additionally, you can specify the parameter mappings
1799
+ to map event payload to Metaflow parameters for the flow.
1800
+ ```
1801
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1802
+ ```
1803
+ or
1804
+ ```
1805
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1806
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1807
+ ```
1808
+
1809
+ 'parameters' can also be a list of strings and tuples like so:
1810
+ ```
1811
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1812
+ ```
1813
+ This is equivalent to:
1814
+ ```
1815
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1816
+ ```
1702
1817
 
1703
1818
  Parameters
1704
1819
  ----------
1705
- timeout : int
1706
- Time, in seconds before the task times out and fails. (Default: 3600)
1707
- poke_interval : int
1708
- Time in seconds that the job should wait in between each try. (Default: 60)
1709
- mode : str
1710
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1711
- exponential_backoff : bool
1712
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1713
- pool : str
1714
- the slot pool this task should run in,
1715
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1716
- soft_fail : bool
1717
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1718
- name : str
1719
- Name of the sensor on Airflow
1720
- description : str
1721
- Description of sensor in the Airflow UI
1722
- external_dag_id : str
1723
- The dag_id that contains the task you want to wait for.
1724
- external_task_ids : List[str]
1725
- The list of task_ids that you want to wait for.
1726
- If None (default value) the sensor waits for the DAG. (Default: None)
1727
- allowed_states : List[str]
1728
- Iterable of allowed states, (Default: ['success'])
1729
- failed_states : List[str]
1730
- Iterable of failed or dis-allowed states. (Default: None)
1731
- execution_delta : datetime.timedelta
1732
- time difference with the previous execution to look at,
1733
- the default is the same logical date as the current task or DAG. (Default: None)
1734
- check_existence: bool
1735
- Set to True to check if the external task exists or check if
1736
- the DAG to wait for exists. (Default: True)
1820
+ event : Union[str, Dict[str, Any]], optional, default None
1821
+ Event dependency for this flow.
1822
+ events : List[Union[str, Dict[str, Any]]], default []
1823
+ Events dependency for this flow.
1824
+ options : Dict[str, Any], default {}
1825
+ Backend-specific configuration for tuning eventing behavior.
1826
+
1827
+
1737
1828
  """
1738
1829
  ...
1739
1830
 
@@ -1755,97 +1846,6 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
1755
1846
  """
1756
1847
  ...
1757
1848
 
1758
- @typing.overload
1759
- 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]]:
1760
- """
1761
- Specifies the times when the flow should be run when running on a
1762
- production scheduler.
1763
-
1764
- Parameters
1765
- ----------
1766
- hourly : bool, default False
1767
- Run the workflow hourly.
1768
- daily : bool, default True
1769
- Run the workflow daily.
1770
- weekly : bool, default False
1771
- Run the workflow weekly.
1772
- cron : str, optional, default None
1773
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1774
- specified by this expression.
1775
- timezone : str, optional, default None
1776
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1777
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1778
- """
1779
- ...
1780
-
1781
- @typing.overload
1782
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1783
- ...
1784
-
1785
- 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):
1786
- """
1787
- Specifies the times when the flow should be run when running on a
1788
- production scheduler.
1789
-
1790
- Parameters
1791
- ----------
1792
- hourly : bool, default False
1793
- Run the workflow hourly.
1794
- daily : bool, default True
1795
- Run the workflow daily.
1796
- weekly : bool, default False
1797
- Run the workflow weekly.
1798
- cron : str, optional, default None
1799
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1800
- specified by this expression.
1801
- timezone : str, optional, default None
1802
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1803
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1804
- """
1805
- ...
1806
-
1807
- 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]]:
1808
- """
1809
- 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)
1810
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1811
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1812
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1813
- starts only after all sensors finish.
1814
-
1815
- Parameters
1816
- ----------
1817
- timeout : int
1818
- Time, in seconds before the task times out and fails. (Default: 3600)
1819
- poke_interval : int
1820
- Time in seconds that the job should wait in between each try. (Default: 60)
1821
- mode : str
1822
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1823
- exponential_backoff : bool
1824
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1825
- pool : str
1826
- the slot pool this task should run in,
1827
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1828
- soft_fail : bool
1829
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1830
- name : str
1831
- Name of the sensor on Airflow
1832
- description : str
1833
- Description of sensor in the Airflow UI
1834
- bucket_key : Union[str, List[str]]
1835
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1836
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1837
- bucket_name : str
1838
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1839
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1840
- wildcard_match : bool
1841
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1842
- aws_conn_id : str
1843
- a reference to the s3 connection on Airflow. (Default: None)
1844
- verify : bool
1845
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1846
- """
1847
- ...
1848
-
1849
1849
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1850
1850
  """
1851
1851
  Switch namespace to the one provided.