metaflow-stubs 2.12.2__py2.py3-none-any.whl → 2.12.3__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 (142) hide show
  1. metaflow-stubs/__init__.pyi +381 -381
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +5 -5
  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 +3 -3
  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 +2 -2
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +4 -2
  16. metaflow-stubs/metaflow_current.pyi +5 -5
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +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 +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  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 +4 -4
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
  37. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  39. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  45. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
  47. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +4 -4
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  56. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  57. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
  60. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  61. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  62. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  63. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  64. metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
  65. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  69. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  71. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  78. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  80. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
  81. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  82. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  83. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  84. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  85. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  86. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  87. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  88. metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
  89. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  90. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  91. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  92. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  93. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  94. metaflow-stubs/plugins/events_decorator.pyi +3 -3
  95. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  96. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  97. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
  99. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  101. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  102. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  106. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  107. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  108. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  109. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  110. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  111. metaflow-stubs/plugins/package_cli.pyi +2 -2
  112. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  114. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  116. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  117. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
  119. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  120. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  122. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  123. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  124. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  125. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  126. metaflow-stubs/plugins/tag_cli.pyi +5 -5
  127. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  128. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  129. metaflow-stubs/procpoll.pyi +2 -2
  130. metaflow-stubs/pylint_wrapper.pyi +2 -2
  131. metaflow-stubs/runner/__init__.pyi +2 -2
  132. metaflow-stubs/runner/metaflow_runner.pyi +5 -5
  133. metaflow-stubs/runner/nbrun.pyi +2 -2
  134. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  135. metaflow-stubs/tagging_util.pyi +2 -2
  136. metaflow-stubs/tuple_util.pyi +2 -2
  137. metaflow-stubs/version.pyi +2 -2
  138. {metaflow_stubs-2.12.2.dist-info → metaflow_stubs-2.12.3.dist-info}/METADATA +2 -2
  139. metaflow_stubs-2.12.3.dist-info/RECORD +142 -0
  140. metaflow_stubs-2.12.2.dist-info/RECORD +0 -142
  141. {metaflow_stubs-2.12.2.dist-info → metaflow_stubs-2.12.3.dist-info}/WHEEL +0 -0
  142. {metaflow_stubs-2.12.2.dist-info → metaflow_stubs-2.12.3.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.2 #
4
- # Generated on 2024-06-04T07:19:10.055768 #
3
+ # MF version: 2.12.3 #
4
+ # Generated on 2024-06-05T23:31:10.405226 #
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.parameters
12
+ import io
13
+ import metaflow.metaflow_current
11
14
  import metaflow.datastore.inputs
12
15
  import metaflow.plugins.datatools.s3.s3
13
- import metaflow._vendor.click.types
14
- import metaflow.metaflow_current
15
- import metaflow.runner.metaflow_runner
16
- import metaflow.parameters
17
- import metaflow.client.core
18
- import metaflow.events
19
16
  import datetime
20
- import io
21
17
  import typing
18
+ import metaflow.runner.metaflow_runner
19
+ import metaflow.events
20
+ import metaflow.client.core
21
+ import metaflow._vendor.click.types
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -726,183 +726,152 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
726
726
  """
727
727
  ...
728
728
 
729
- 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
- """
731
- Specifies that this step should execute on Kubernetes.
732
-
733
- Parameters
734
- ----------
735
- cpu : int, default 1
736
- Number of CPUs required for this step. If `@resources` is
737
- also present, the maximum value from all decorators is used.
738
- memory : int, default 4096
739
- Memory size (in MB) required for this step. If
740
- `@resources` is also present, the maximum value from all decorators is
741
- used.
742
- disk : int, default 10240
743
- Disk size (in MB) required for this step. If
744
- `@resources` is also present, the maximum value from all decorators is
745
- used.
746
- image : str, optional, default None
747
- Docker image to use when launching on Kubernetes. If not specified, and
748
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
749
- not, a default Docker image mapping to the current version of Python is used.
750
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
751
- If given, the imagePullPolicy to be applied to the Docker image of the step.
752
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
753
- Kubernetes service account to use when launching pod in Kubernetes.
754
- secrets : List[str], optional, default None
755
- Kubernetes secrets to use when launching pod in Kubernetes. These
756
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
757
- in Metaflow configuration.
758
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
759
- Kubernetes namespace to use when launching pod in Kubernetes.
760
- gpu : int, optional, default None
761
- Number of GPUs required for this step. A value of zero implies that
762
- the scheduled node should not have GPUs.
763
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
764
- The vendor of the GPUs to be used for this step.
765
- tolerations : List[str], default []
766
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
767
- Kubernetes tolerations to use when launching pod in Kubernetes.
768
- use_tmpfs : bool, default False
769
- This enables an explicit tmpfs mount for this step.
770
- tmpfs_tempdir : bool, default True
771
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
772
- tmpfs_size : int, optional, default: None
773
- The value for the size (in MiB) of the tmpfs mount for this step.
774
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
775
- memory allocated for this step.
776
- tmpfs_path : str, optional, default /metaflow_temp
777
- Path to tmpfs mount for this step.
778
- persistent_volume_claims : Dict[str, str], optional, default None
779
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
780
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
781
- shared_memory: int, optional
782
- Shared memory size (in MiB) required for this step
783
- port: int, optional
784
- Port number to specify in the Kubernetes job object
785
- """
786
- ...
787
-
788
729
  @typing.overload
789
- 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]]]:
730
+ 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]]]:
790
731
  """
791
- Specifies the Conda environment for the step.
732
+ Creates a human-readable report, a Metaflow Card, after this step completes.
792
733
 
793
- Information in this decorator will augment any
794
- attributes set in the `@conda_base` flow-level decorator. Hence,
795
- you can use `@conda_base` to set packages required by all
796
- steps and use `@conda` to specify step-specific overrides.
734
+ Note that you may add multiple `@card` decorators in a step with different parameters.
797
735
 
798
736
  Parameters
799
737
  ----------
800
- packages : Dict[str, str], default {}
801
- Packages to use for this step. The key is the name of the package
802
- and the value is the version to use.
803
- libraries : Dict[str, str], default {}
804
- Supported for backward compatibility. When used with packages, packages will take precedence.
805
- python : str, optional, default None
806
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
807
- that the version used will correspond to the version of the Python interpreter used to start the run.
808
- disabled : bool, default False
809
- If set to True, disables @conda.
738
+ type : str, default 'default'
739
+ Card type.
740
+ id : str, optional, default None
741
+ If multiple cards are present, use this id to identify this card.
742
+ options : Dict[str, Any], default {}
743
+ Options passed to the card. The contents depend on the card type.
744
+ timeout : int, default 45
745
+ Interrupt reporting if it takes more than this many seconds.
746
+
747
+
810
748
  """
811
749
  ...
812
750
 
813
751
  @typing.overload
814
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
752
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
815
753
  ...
816
754
 
817
755
  @typing.overload
818
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
756
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
819
757
  ...
820
758
 
821
- 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):
759
+ 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):
822
760
  """
823
- Specifies the Conda environment for the step.
761
+ Creates a human-readable report, a Metaflow Card, after this step completes.
824
762
 
825
- Information in this decorator will augment any
826
- attributes set in the `@conda_base` flow-level decorator. Hence,
827
- you can use `@conda_base` to set packages required by all
828
- steps and use `@conda` to specify step-specific overrides.
763
+ Note that you may add multiple `@card` decorators in a step with different parameters.
829
764
 
830
765
  Parameters
831
766
  ----------
832
- packages : Dict[str, str], default {}
833
- Packages to use for this step. The key is the name of the package
834
- and the value is the version to use.
835
- libraries : Dict[str, str], default {}
836
- Supported for backward compatibility. When used with packages, packages will take precedence.
837
- python : str, optional, default None
838
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
839
- that the version used will correspond to the version of the Python interpreter used to start the run.
840
- disabled : bool, default False
841
- If set to True, disables @conda.
767
+ type : str, default 'default'
768
+ Card type.
769
+ id : str, optional, default None
770
+ If multiple cards are present, use this id to identify this card.
771
+ options : Dict[str, Any], default {}
772
+ Options passed to the card. The contents depend on the card type.
773
+ timeout : int, default 45
774
+ Interrupt reporting if it takes more than this many seconds.
775
+
776
+
842
777
  """
843
778
  ...
844
779
 
845
780
  @typing.overload
846
- 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]]]:
781
+ 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]]]:
847
782
  """
848
- Specifies environment variables to be set prior to the execution of a step.
783
+ Specifies that the step will success under all circumstances.
784
+
785
+ The decorator will create an optional artifact, specified by `var`, which
786
+ contains the exception raised. You can use it to detect the presence
787
+ of errors, indicating that all happy-path artifacts produced by the step
788
+ are missing.
849
789
 
850
790
  Parameters
851
791
  ----------
852
- vars : Dict[str, str], default {}
853
- Dictionary of environment variables to set.
792
+ var : str, optional, default None
793
+ Name of the artifact in which to store the caught exception.
794
+ If not specified, the exception is not stored.
795
+ print_exception : bool, default True
796
+ Determines whether or not the exception is printed to
797
+ stdout when caught.
854
798
  """
855
799
  ...
856
800
 
857
801
  @typing.overload
858
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
802
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
859
803
  ...
860
804
 
861
805
  @typing.overload
862
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
806
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
863
807
  ...
864
808
 
865
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
809
+ 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):
866
810
  """
867
- Specifies environment variables to be set prior to the execution of a step.
811
+ Specifies that the step will success under all circumstances.
812
+
813
+ The decorator will create an optional artifact, specified by `var`, which
814
+ contains the exception raised. You can use it to detect the presence
815
+ of errors, indicating that all happy-path artifacts produced by the step
816
+ are missing.
868
817
 
869
818
  Parameters
870
819
  ----------
871
- vars : Dict[str, str], default {}
872
- Dictionary of environment variables to set.
820
+ var : str, optional, default None
821
+ Name of the artifact in which to store the caught exception.
822
+ If not specified, the exception is not stored.
823
+ print_exception : bool, default True
824
+ Determines whether or not the exception is printed to
825
+ stdout when caught.
873
826
  """
874
827
  ...
875
828
 
876
829
  @typing.overload
877
- 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]]]:
830
+ 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]]]:
878
831
  """
879
- Specifies secrets to be retrieved and injected as environment variables prior to
880
- the execution of a step.
832
+ Specifies the PyPI packages for the step.
833
+
834
+ Information in this decorator will augment any
835
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
836
+ you can use `@pypi_base` to set packages required by all
837
+ steps and use `@pypi` to specify step-specific overrides.
881
838
 
882
839
  Parameters
883
840
  ----------
884
- sources : List[Union[str, Dict[str, Any]]], default: []
885
- List of secret specs, defining how the secrets are to be retrieved
841
+ packages : Dict[str, str], default: {}
842
+ Packages to use for this step. The key is the name of the package
843
+ and the value is the version to use.
844
+ python : str, optional, default: None
845
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
846
+ that the version used will correspond to the version of the Python interpreter used to start the run.
886
847
  """
887
848
  ...
888
849
 
889
850
  @typing.overload
890
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
851
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
891
852
  ...
892
853
 
893
854
  @typing.overload
894
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
855
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
895
856
  ...
896
857
 
897
- 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]]] = []):
858
+ 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):
898
859
  """
899
- Specifies secrets to be retrieved and injected as environment variables prior to
900
- the execution of a step.
860
+ Specifies the PyPI packages for the step.
861
+
862
+ Information in this decorator will augment any
863
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
864
+ you can use `@pypi_base` to set packages required by all
865
+ steps and use `@pypi` to specify step-specific overrides.
901
866
 
902
867
  Parameters
903
868
  ----------
904
- sources : List[Union[str, Dict[str, Any]]], default: []
905
- List of secret specs, defining how the secrets are to be retrieved
869
+ packages : Dict[str, str], default: {}
870
+ Packages to use for this step. The key is the name of the package
871
+ and the value is the version to use.
872
+ python : str, optional, default: None
873
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
874
+ that the version used will correspond to the version of the Python interpreter used to start the run.
906
875
  """
907
876
  ...
908
877
 
@@ -1054,153 +1023,224 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1054
1023
  ...
1055
1024
 
1056
1025
  @typing.overload
1057
- 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]]]:
1026
+ 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]]]:
1058
1027
  """
1059
- Specifies that the step will success under all circumstances.
1028
+ Specifies the number of times the task corresponding
1029
+ to a step needs to be retried.
1060
1030
 
1061
- The decorator will create an optional artifact, specified by `var`, which
1062
- contains the exception raised. You can use it to detect the presence
1063
- of errors, indicating that all happy-path artifacts produced by the step
1064
- are missing.
1031
+ This decorator is useful for handling transient errors, such as networking issues.
1032
+ If your task contains operations that can't be retried safely, e.g. database updates,
1033
+ it is advisable to annotate it with `@retry(times=0)`.
1034
+
1035
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1036
+ decorator will execute a no-op task after all retries have been exhausted,
1037
+ ensuring that the flow execution can continue.
1065
1038
 
1066
1039
  Parameters
1067
1040
  ----------
1068
- var : str, optional, default None
1069
- Name of the artifact in which to store the caught exception.
1070
- If not specified, the exception is not stored.
1071
- print_exception : bool, default True
1072
- Determines whether or not the exception is printed to
1073
- stdout when caught.
1041
+ times : int, default 3
1042
+ Number of times to retry this task.
1043
+ minutes_between_retries : int, default 2
1044
+ Number of minutes between retries.
1074
1045
  """
1075
1046
  ...
1076
1047
 
1077
1048
  @typing.overload
1078
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1049
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1079
1050
  ...
1080
1051
 
1081
1052
  @typing.overload
1082
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1053
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1083
1054
  ...
1084
1055
 
1085
- 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):
1056
+ 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):
1086
1057
  """
1087
- Specifies that the step will success under all circumstances.
1058
+ Specifies the number of times the task corresponding
1059
+ to a step needs to be retried.
1088
1060
 
1089
- The decorator will create an optional artifact, specified by `var`, which
1090
- contains the exception raised. You can use it to detect the presence
1091
- of errors, indicating that all happy-path artifacts produced by the step
1092
- are missing.
1061
+ This decorator is useful for handling transient errors, such as networking issues.
1062
+ If your task contains operations that can't be retried safely, e.g. database updates,
1063
+ it is advisable to annotate it with `@retry(times=0)`.
1093
1064
 
1094
- Parameters
1065
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1066
+ decorator will execute a no-op task after all retries have been exhausted,
1067
+ ensuring that the flow execution can continue.
1068
+
1069
+ Parameters
1095
1070
  ----------
1096
- var : str, optional, default None
1097
- Name of the artifact in which to store the caught exception.
1098
- If not specified, the exception is not stored.
1099
- print_exception : bool, default True
1100
- Determines whether or not the exception is printed to
1101
- stdout when caught.
1071
+ times : int, default 3
1072
+ Number of times to retry this task.
1073
+ minutes_between_retries : int, default 2
1074
+ Number of minutes between retries.
1102
1075
  """
1103
1076
  ...
1104
1077
 
1105
1078
  @typing.overload
1106
- 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]]]:
1079
+ 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]]]:
1107
1080
  """
1108
- Specifies the PyPI packages for the step.
1081
+ Specifies the resources needed when executing this step.
1109
1082
 
1110
- Information in this decorator will augment any
1111
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1112
- you can use `@pypi_base` to set packages required by all
1113
- steps and use `@pypi` to specify step-specific overrides.
1083
+ Use `@resources` to specify the resource requirements
1084
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1085
+
1086
+ You can choose the compute layer on the command line by executing e.g.
1087
+ ```
1088
+ python myflow.py run --with batch
1089
+ ```
1090
+ or
1091
+ ```
1092
+ python myflow.py run --with kubernetes
1093
+ ```
1094
+ which executes the flow on the desired system using the
1095
+ requirements specified in `@resources`.
1114
1096
 
1115
1097
  Parameters
1116
1098
  ----------
1117
- packages : Dict[str, str], default: {}
1118
- Packages to use for this step. The key is the name of the package
1119
- and the value is the version to use.
1120
- python : str, optional, default: None
1121
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1122
- that the version used will correspond to the version of the Python interpreter used to start the run.
1099
+ cpu : int, default 1
1100
+ Number of CPUs required for this step.
1101
+ gpu : int, default 0
1102
+ Number of GPUs required for this step.
1103
+ disk : int, optional, default None
1104
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1105
+ memory : int, default 4096
1106
+ Memory size (in MB) required for this step.
1107
+ shared_memory : int, optional, default None
1108
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1109
+ This parameter maps to the `--shm-size` option in Docker.
1123
1110
  """
1124
1111
  ...
1125
1112
 
1126
1113
  @typing.overload
1127
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1114
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1128
1115
  ...
1129
1116
 
1130
1117
  @typing.overload
1131
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1118
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1132
1119
  ...
1133
1120
 
1134
- 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):
1121
+ 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):
1135
1122
  """
1136
- Specifies the PyPI packages for the step.
1123
+ Specifies the resources needed when executing this step.
1137
1124
 
1138
- Information in this decorator will augment any
1139
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1140
- you can use `@pypi_base` to set packages required by all
1141
- steps and use `@pypi` to specify step-specific overrides.
1125
+ Use `@resources` to specify the resource requirements
1126
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1127
+
1128
+ You can choose the compute layer on the command line by executing e.g.
1129
+ ```
1130
+ python myflow.py run --with batch
1131
+ ```
1132
+ or
1133
+ ```
1134
+ python myflow.py run --with kubernetes
1135
+ ```
1136
+ which executes the flow on the desired system using the
1137
+ requirements specified in `@resources`.
1142
1138
 
1143
1139
  Parameters
1144
1140
  ----------
1145
- packages : Dict[str, str], default: {}
1146
- Packages to use for this step. The key is the name of the package
1147
- and the value is the version to use.
1148
- python : str, optional, default: None
1149
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1150
- that the version used will correspond to the version of the Python interpreter used to start the run.
1141
+ cpu : int, default 1
1142
+ Number of CPUs required for this step.
1143
+ gpu : int, default 0
1144
+ Number of GPUs required for this step.
1145
+ disk : int, optional, default None
1146
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1147
+ memory : int, default 4096
1148
+ Memory size (in MB) required for this step.
1149
+ shared_memory : int, optional, default None
1150
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1151
+ This parameter maps to the `--shm-size` option in Docker.
1151
1152
  """
1152
1153
  ...
1153
1154
 
1154
- @typing.overload
1155
- 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]]]:
1155
+ 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]]]:
1156
1156
  """
1157
- Specifies the number of times the task corresponding
1158
- to a step needs to be retried.
1159
-
1160
- This decorator is useful for handling transient errors, such as networking issues.
1161
- If your task contains operations that can't be retried safely, e.g. database updates,
1162
- it is advisable to annotate it with `@retry(times=0)`.
1157
+ Specifies that this step should execute on Kubernetes.
1163
1158
 
1164
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1165
- decorator will execute a no-op task after all retries have been exhausted,
1166
- ensuring that the flow execution can continue.
1159
+ Parameters
1160
+ ----------
1161
+ cpu : int, default 1
1162
+ Number of CPUs required for this step. If `@resources` is
1163
+ also present, the maximum value from all decorators is used.
1164
+ memory : int, default 4096
1165
+ Memory size (in MB) required for this step. If
1166
+ `@resources` is also present, the maximum value from all decorators is
1167
+ used.
1168
+ disk : int, default 10240
1169
+ Disk size (in MB) required for this step. If
1170
+ `@resources` is also present, the maximum value from all decorators is
1171
+ used.
1172
+ image : str, optional, default None
1173
+ Docker image to use when launching on Kubernetes. If not specified, and
1174
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1175
+ not, a default Docker image mapping to the current version of Python is used.
1176
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1177
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
1178
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1179
+ Kubernetes service account to use when launching pod in Kubernetes.
1180
+ secrets : List[str], optional, default None
1181
+ Kubernetes secrets to use when launching pod in Kubernetes. These
1182
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1183
+ in Metaflow configuration.
1184
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1185
+ Kubernetes namespace to use when launching pod in Kubernetes.
1186
+ gpu : int, optional, default None
1187
+ Number of GPUs required for this step. A value of zero implies that
1188
+ the scheduled node should not have GPUs.
1189
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1190
+ The vendor of the GPUs to be used for this step.
1191
+ tolerations : List[str], default []
1192
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1193
+ Kubernetes tolerations to use when launching pod in Kubernetes.
1194
+ use_tmpfs : bool, default False
1195
+ This enables an explicit tmpfs mount for this step.
1196
+ tmpfs_tempdir : bool, default True
1197
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1198
+ tmpfs_size : int, optional, default: None
1199
+ The value for the size (in MiB) of the tmpfs mount for this step.
1200
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1201
+ memory allocated for this step.
1202
+ tmpfs_path : str, optional, default /metaflow_temp
1203
+ Path to tmpfs mount for this step.
1204
+ persistent_volume_claims : Dict[str, str], optional, default None
1205
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1206
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1207
+ shared_memory: int, optional
1208
+ Shared memory size (in MiB) required for this step
1209
+ port: int, optional
1210
+ Port number to specify in the Kubernetes job object
1211
+ """
1212
+ ...
1213
+
1214
+ @typing.overload
1215
+ 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]]]:
1216
+ """
1217
+ Specifies secrets to be retrieved and injected as environment variables prior to
1218
+ the execution of a step.
1167
1219
 
1168
1220
  Parameters
1169
1221
  ----------
1170
- times : int, default 3
1171
- Number of times to retry this task.
1172
- minutes_between_retries : int, default 2
1173
- Number of minutes between retries.
1222
+ sources : List[Union[str, Dict[str, Any]]], default: []
1223
+ List of secret specs, defining how the secrets are to be retrieved
1174
1224
  """
1175
1225
  ...
1176
1226
 
1177
1227
  @typing.overload
1178
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1228
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1179
1229
  ...
1180
1230
 
1181
1231
  @typing.overload
1182
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1232
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1183
1233
  ...
1184
1234
 
1185
- 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):
1235
+ 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]]] = []):
1186
1236
  """
1187
- Specifies the number of times the task corresponding
1188
- to a step needs to be retried.
1189
-
1190
- This decorator is useful for handling transient errors, such as networking issues.
1191
- If your task contains operations that can't be retried safely, e.g. database updates,
1192
- it is advisable to annotate it with `@retry(times=0)`.
1193
-
1194
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1195
- decorator will execute a no-op task after all retries have been exhausted,
1196
- ensuring that the flow execution can continue.
1237
+ Specifies secrets to be retrieved and injected as environment variables prior to
1238
+ the execution of a step.
1197
1239
 
1198
1240
  Parameters
1199
1241
  ----------
1200
- times : int, default 3
1201
- Number of times to retry this task.
1202
- minutes_between_retries : int, default 2
1203
- Number of minutes between retries.
1242
+ sources : List[Union[str, Dict[str, Any]]], default: []
1243
+ List of secret specs, defining how the secrets are to be retrieved
1204
1244
  """
1205
1245
  ...
1206
1246
 
@@ -1262,197 +1302,90 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
1262
1302
  ...
1263
1303
 
1264
1304
  @typing.overload
1265
- 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]]]:
1305
+ 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]]]:
1266
1306
  """
1267
- Creates a human-readable report, a Metaflow Card, after this step completes.
1307
+ Specifies the Conda environment for the step.
1268
1308
 
1269
- Note that you may add multiple `@card` decorators in a step with different parameters.
1309
+ Information in this decorator will augment any
1310
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1311
+ you can use `@conda_base` to set packages required by all
1312
+ steps and use `@conda` to specify step-specific overrides.
1270
1313
 
1271
1314
  Parameters
1272
1315
  ----------
1273
- type : str, default 'default'
1274
- Card type.
1275
- id : str, optional, default None
1276
- If multiple cards are present, use this id to identify this card.
1277
- options : Dict[str, Any], default {}
1278
- Options passed to the card. The contents depend on the card type.
1279
- timeout : int, default 45
1280
- Interrupt reporting if it takes more than this many seconds.
1281
-
1282
-
1316
+ packages : Dict[str, str], default {}
1317
+ Packages to use for this step. The key is the name of the package
1318
+ and the value is the version to use.
1319
+ libraries : Dict[str, str], default {}
1320
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1321
+ python : str, optional, default None
1322
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1323
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1324
+ disabled : bool, default False
1325
+ If set to True, disables @conda.
1283
1326
  """
1284
1327
  ...
1285
1328
 
1286
1329
  @typing.overload
1287
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1330
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1288
1331
  ...
1289
1332
 
1290
1333
  @typing.overload
1291
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1292
- ...
1293
-
1294
- 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):
1295
- """
1296
- Creates a human-readable report, a Metaflow Card, after this step completes.
1297
-
1298
- Note that you may add multiple `@card` decorators in a step with different parameters.
1299
-
1300
- Parameters
1301
- ----------
1302
- type : str, default 'default'
1303
- Card type.
1304
- id : str, optional, default None
1305
- If multiple cards are present, use this id to identify this card.
1306
- options : Dict[str, Any], default {}
1307
- Options passed to the card. The contents depend on the card type.
1308
- timeout : int, default 45
1309
- Interrupt reporting if it takes more than this many seconds.
1310
-
1311
-
1312
- """
1334
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1313
1335
  ...
1314
1336
 
1315
- @typing.overload
1316
- 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]]]:
1337
+ 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):
1317
1338
  """
1318
- Specifies the resources needed when executing this step.
1319
-
1320
- Use `@resources` to specify the resource requirements
1321
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1339
+ Specifies the Conda environment for the step.
1322
1340
 
1323
- You can choose the compute layer on the command line by executing e.g.
1324
- ```
1325
- python myflow.py run --with batch
1326
- ```
1327
- or
1328
- ```
1329
- python myflow.py run --with kubernetes
1330
- ```
1331
- which executes the flow on the desired system using the
1332
- requirements specified in `@resources`.
1341
+ Information in this decorator will augment any
1342
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1343
+ you can use `@conda_base` to set packages required by all
1344
+ steps and use `@conda` to specify step-specific overrides.
1333
1345
 
1334
1346
  Parameters
1335
1347
  ----------
1336
- cpu : int, default 1
1337
- Number of CPUs required for this step.
1338
- gpu : int, default 0
1339
- Number of GPUs required for this step.
1340
- disk : int, optional, default None
1341
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1342
- memory : int, default 4096
1343
- Memory size (in MB) required for this step.
1344
- shared_memory : int, optional, default None
1345
- The value for the size (in MiB) of the /dev/shm volume for this step.
1346
- This parameter maps to the `--shm-size` option in Docker.
1348
+ packages : Dict[str, str], default {}
1349
+ Packages to use for this step. The key is the name of the package
1350
+ and the value is the version to use.
1351
+ libraries : Dict[str, str], default {}
1352
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1353
+ python : str, optional, default None
1354
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1355
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1356
+ disabled : bool, default False
1357
+ If set to True, disables @conda.
1347
1358
  """
1348
1359
  ...
1349
1360
 
1350
1361
  @typing.overload
1351
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1352
- ...
1353
-
1354
- @typing.overload
1355
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1356
- ...
1357
-
1358
- 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):
1359
- """
1360
- Specifies the resources needed when executing this step.
1361
-
1362
- Use `@resources` to specify the resource requirements
1363
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1364
-
1365
- You can choose the compute layer on the command line by executing e.g.
1366
- ```
1367
- python myflow.py run --with batch
1368
- ```
1369
- or
1370
- ```
1371
- python myflow.py run --with kubernetes
1372
- ```
1373
- which executes the flow on the desired system using the
1374
- requirements specified in `@resources`.
1375
-
1376
- Parameters
1377
- ----------
1378
- cpu : int, default 1
1379
- Number of CPUs required for this step.
1380
- gpu : int, default 0
1381
- Number of GPUs required for this step.
1382
- disk : int, optional, default None
1383
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1384
- memory : int, default 4096
1385
- Memory size (in MB) required for this step.
1386
- shared_memory : int, optional, default None
1387
- The value for the size (in MiB) of the /dev/shm volume for this step.
1388
- This parameter maps to the `--shm-size` option in Docker.
1389
- """
1390
- ...
1391
-
1392
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1362
+ 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]]]:
1393
1363
  """
1394
- Specifies what flows belong to the same project.
1395
-
1396
- A project-specific namespace is created for all flows that
1397
- use the same `@project(name)`.
1364
+ Specifies environment variables to be set prior to the execution of a step.
1398
1365
 
1399
1366
  Parameters
1400
1367
  ----------
1401
- name : str
1402
- Project name. Make sure that the name is unique amongst all
1403
- projects that use the same production scheduler. The name may
1404
- contain only lowercase alphanumeric characters and underscores.
1405
-
1406
-
1368
+ vars : Dict[str, str], default {}
1369
+ Dictionary of environment variables to set.
1407
1370
  """
1408
1371
  ...
1409
1372
 
1410
1373
  @typing.overload
1411
- 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]]:
1412
- """
1413
- Specifies the times when the flow should be run when running on a
1414
- production scheduler.
1415
-
1416
- Parameters
1417
- ----------
1418
- hourly : bool, default False
1419
- Run the workflow hourly.
1420
- daily : bool, default True
1421
- Run the workflow daily.
1422
- weekly : bool, default False
1423
- Run the workflow weekly.
1424
- cron : str, optional, default None
1425
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1426
- specified by this expression.
1427
- timezone : str, optional, default None
1428
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1429
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1430
- """
1374
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1431
1375
  ...
1432
1376
 
1433
1377
  @typing.overload
1434
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1378
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1435
1379
  ...
1436
1380
 
1437
- 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):
1381
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1438
1382
  """
1439
- Specifies the times when the flow should be run when running on a
1440
- production scheduler.
1383
+ Specifies environment variables to be set prior to the execution of a step.
1441
1384
 
1442
1385
  Parameters
1443
1386
  ----------
1444
- hourly : bool, default False
1445
- Run the workflow hourly.
1446
- daily : bool, default True
1447
- Run the workflow daily.
1448
- weekly : bool, default False
1449
- Run the workflow weekly.
1450
- cron : str, optional, default None
1451
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1452
- specified by this expression.
1453
- timezone : str, optional, default None
1454
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1455
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1387
+ vars : Dict[str, str], default {}
1388
+ Dictionary of environment variables to set.
1456
1389
  """
1457
1390
  ...
1458
1391
 
@@ -1499,41 +1432,51 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1499
1432
  ...
1500
1433
 
1501
1434
  @typing.overload
1502
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1435
+ 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]]:
1503
1436
  """
1504
- Specifies the PyPI packages for all steps of the flow.
1437
+ Specifies the times when the flow should be run when running on a
1438
+ production scheduler.
1505
1439
 
1506
- Use `@pypi_base` to set common packages required by all
1507
- steps and use `@pypi` to specify step-specific overrides.
1508
1440
  Parameters
1509
1441
  ----------
1510
- packages : Dict[str, str], default: {}
1511
- Packages to use for this flow. The key is the name of the package
1512
- and the value is the version to use.
1513
- python : str, optional, default: None
1514
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1515
- that the version used will correspond to the version of the Python interpreter used to start the run.
1442
+ hourly : bool, default False
1443
+ Run the workflow hourly.
1444
+ daily : bool, default True
1445
+ Run the workflow daily.
1446
+ weekly : bool, default False
1447
+ Run the workflow weekly.
1448
+ cron : str, optional, default None
1449
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1450
+ specified by this expression.
1451
+ timezone : str, optional, default None
1452
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1453
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1516
1454
  """
1517
1455
  ...
1518
1456
 
1519
1457
  @typing.overload
1520
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1458
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1521
1459
  ...
1522
1460
 
1523
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1461
+ 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):
1524
1462
  """
1525
- Specifies the PyPI packages for all steps of the flow.
1463
+ Specifies the times when the flow should be run when running on a
1464
+ production scheduler.
1526
1465
 
1527
- Use `@pypi_base` to set common packages required by all
1528
- steps and use `@pypi` to specify step-specific overrides.
1529
1466
  Parameters
1530
1467
  ----------
1531
- packages : Dict[str, str], default: {}
1532
- Packages to use for this flow. The key is the name of the package
1533
- and the value is the version to use.
1534
- python : str, optional, default: None
1535
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1536
- that the version used will correspond to the version of the Python interpreter used to start the run.
1468
+ hourly : bool, default False
1469
+ Run the workflow hourly.
1470
+ daily : bool, default True
1471
+ Run the workflow daily.
1472
+ weekly : bool, default False
1473
+ Run the workflow weekly.
1474
+ cron : str, optional, default None
1475
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1476
+ specified by this expression.
1477
+ timezone : str, optional, default None
1478
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1479
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1537
1480
  """
1538
1481
  ...
1539
1482
 
@@ -1586,6 +1529,24 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1586
1529
  """
1587
1530
  ...
1588
1531
 
1532
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1533
+ """
1534
+ Specifies what flows belong to the same project.
1535
+
1536
+ A project-specific namespace is created for all flows that
1537
+ use the same `@project(name)`.
1538
+
1539
+ Parameters
1540
+ ----------
1541
+ name : str
1542
+ Project name. Make sure that the name is unique amongst all
1543
+ projects that use the same production scheduler. The name may
1544
+ contain only lowercase alphanumeric characters and underscores.
1545
+
1546
+
1547
+ """
1548
+ ...
1549
+
1589
1550
  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]]:
1590
1551
  """
1591
1552
  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.
@@ -1723,6 +1684,45 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1723
1684
  """
1724
1685
  ...
1725
1686
 
1687
+ @typing.overload
1688
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1689
+ """
1690
+ Specifies the PyPI packages for all steps of the flow.
1691
+
1692
+ Use `@pypi_base` to set common packages required by all
1693
+ steps and use `@pypi` to specify step-specific overrides.
1694
+ Parameters
1695
+ ----------
1696
+ packages : Dict[str, str], default: {}
1697
+ Packages to use for this flow. The key is the name of the package
1698
+ and the value is the version to use.
1699
+ python : str, optional, default: None
1700
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1701
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1702
+ """
1703
+ ...
1704
+
1705
+ @typing.overload
1706
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1707
+ ...
1708
+
1709
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1710
+ """
1711
+ Specifies the PyPI packages for all steps of the flow.
1712
+
1713
+ Use `@pypi_base` to set common packages required by all
1714
+ steps and use `@pypi` to specify step-specific overrides.
1715
+ Parameters
1716
+ ----------
1717
+ packages : Dict[str, str], default: {}
1718
+ Packages to use for this flow. The key is the name of the package
1719
+ and the value is the version to use.
1720
+ python : str, optional, default: None
1721
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1722
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1723
+ """
1724
+ ...
1725
+
1726
1726
  @typing.overload
1727
1727
  def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1728
1728
  """