metaflow-stubs 2.12.13__py2.py3-none-any.whl → 2.12.14__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 +517 -517
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +4 -4
  5. metaflow-stubs/client/core.pyi +6 -6
  6. metaflow-stubs/client/filecache.pyi +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 +4 -4
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  13. metaflow-stubs/metadata/metadata.pyi +3 -3
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +2 -2
  16. metaflow-stubs/metaflow_current.pyi +6 -6
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +4 -4
  20. metaflow-stubs/plugins/__init__.pyi +3 -3
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
  23. metaflow-stubs/plugins/airflow/airflow_cli.pyi +2 -2
  24. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  31. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  35. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
  37. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +19 -4
  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 +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  48. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +2 -2
  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 +20 -5
  58. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  61. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  62. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  63. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  64. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  65. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
  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 +3 -3
  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 +2 -2
  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 +2 -2
  87. metaflow-stubs/plugins/datatools/__init__.pyi +4 -4
  88. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  89. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  90. metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
  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 +2 -2
  99. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  101. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  102. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  103. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  104. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  106. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +6 -2
  107. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  108. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  109. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  111. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  112. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  113. metaflow-stubs/plugins/package_cli.pyi +2 -2
  114. metaflow-stubs/plugins/parallel_decorator.pyi +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 +6 -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 +3 -3
  129. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  130. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  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 +21 -6
  135. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  136. metaflow-stubs/runner/nbdeploy.pyi +4 -4
  137. metaflow-stubs/runner/nbrun.pyi +4 -4
  138. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  139. metaflow-stubs/runner/utils.pyi +2 -2
  140. metaflow-stubs/system/__init__.pyi +3 -3
  141. metaflow-stubs/system/system_logger.pyi +3 -3
  142. metaflow-stubs/system/system_monitor.pyi +2 -2
  143. metaflow-stubs/tagging_util.pyi +2 -2
  144. metaflow-stubs/tuple_util.pyi +2 -2
  145. metaflow-stubs/version.pyi +2 -2
  146. {metaflow_stubs-2.12.13.dist-info → metaflow_stubs-2.12.14.dist-info}/METADATA +2 -2
  147. metaflow_stubs-2.12.14.dist-info/RECORD +150 -0
  148. metaflow_stubs-2.12.13.dist-info/RECORD +0 -150
  149. {metaflow_stubs-2.12.13.dist-info → metaflow_stubs-2.12.14.dist-info}/WHEEL +0 -0
  150. {metaflow_stubs-2.12.13.dist-info → metaflow_stubs-2.12.14.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.13 #
4
- # Generated on 2024-08-21T05:55:53.002542 #
3
+ # MF version: 2.12.14 #
4
+ # Generated on 2024-08-22T15:17:51.800458 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import typing
12
- import metaflow.client.core
13
- import metaflow.parameters
14
- import io
15
11
  import metaflow.metaflow_current
16
- import metaflow.flowspec
17
- import datetime
18
12
  import metaflow.events
19
- import metaflow.datastore.inputs
20
13
  import metaflow.plugins.datatools.s3.s3
21
- import metaflow.runner.metaflow_runner
14
+ import metaflow.parameters
15
+ import io
22
16
  import metaflow._vendor.click.types
17
+ import datetime
18
+ import metaflow.flowspec
19
+ import metaflow.runner.metaflow_runner
20
+ import metaflow.datastore.inputs
21
+ import metaflow.client.core
22
+ import typing
23
23
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
24
24
  StepFlag = typing.NewType("StepFlag", bool)
25
25
 
@@ -728,51 +728,79 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
728
728
  ...
729
729
 
730
730
  @typing.overload
731
- 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]]]:
731
+ 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]]]:
732
732
  """
733
- Specifies the PyPI packages for the step.
733
+ Specifies the resources needed when executing this step.
734
734
 
735
- Information in this decorator will augment any
736
- attributes set in the `@pyi_base` flow-level decorator. Hence,
737
- you can use `@pypi_base` to set packages required by all
738
- steps and use `@pypi` to specify step-specific overrides.
735
+ Use `@resources` to specify the resource requirements
736
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
737
+
738
+ You can choose the compute layer on the command line by executing e.g.
739
+ ```
740
+ python myflow.py run --with batch
741
+ ```
742
+ or
743
+ ```
744
+ python myflow.py run --with kubernetes
745
+ ```
746
+ which executes the flow on the desired system using the
747
+ requirements specified in `@resources`.
739
748
 
740
749
  Parameters
741
750
  ----------
742
- packages : Dict[str, str], default: {}
743
- Packages to use for this step. The key is the name of the package
744
- and the value is the version to use.
745
- python : str, optional, default: None
746
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
747
- that the version used will correspond to the version of the Python interpreter used to start the run.
751
+ cpu : int, default 1
752
+ Number of CPUs required for this step.
753
+ gpu : int, default 0
754
+ Number of GPUs required for this step.
755
+ disk : int, optional, default None
756
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
757
+ memory : int, default 4096
758
+ Memory size (in MB) required for this step.
759
+ shared_memory : int, optional, default None
760
+ The value for the size (in MiB) of the /dev/shm volume for this step.
761
+ This parameter maps to the `--shm-size` option in Docker.
748
762
  """
749
763
  ...
750
764
 
751
765
  @typing.overload
752
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
766
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
753
767
  ...
754
768
 
755
769
  @typing.overload
756
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
770
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
757
771
  ...
758
772
 
759
- 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):
773
+ 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):
760
774
  """
761
- Specifies the PyPI packages for the step.
775
+ Specifies the resources needed when executing this step.
762
776
 
763
- Information in this decorator will augment any
764
- attributes set in the `@pyi_base` flow-level decorator. Hence,
765
- you can use `@pypi_base` to set packages required by all
766
- steps and use `@pypi` to specify step-specific overrides.
777
+ Use `@resources` to specify the resource requirements
778
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
779
+
780
+ You can choose the compute layer on the command line by executing e.g.
781
+ ```
782
+ python myflow.py run --with batch
783
+ ```
784
+ or
785
+ ```
786
+ python myflow.py run --with kubernetes
787
+ ```
788
+ which executes the flow on the desired system using the
789
+ requirements specified in `@resources`.
767
790
 
768
791
  Parameters
769
792
  ----------
770
- packages : Dict[str, str], default: {}
771
- Packages to use for this step. The key is the name of the package
772
- and the value is the version to use.
773
- python : str, optional, default: None
774
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
775
- that the version used will correspond to the version of the Python interpreter used to start the run.
793
+ cpu : int, default 1
794
+ Number of CPUs required for this step.
795
+ gpu : int, default 0
796
+ Number of GPUs required for this step.
797
+ disk : int, optional, default None
798
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
799
+ memory : int, default 4096
800
+ Memory size (in MB) required for this step.
801
+ shared_memory : int, optional, default None
802
+ The value for the size (in MiB) of the /dev/shm volume for this step.
803
+ This parameter maps to the `--shm-size` option in Docker.
776
804
  """
777
805
  ...
778
806
 
@@ -833,118 +861,54 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
833
861
  """
834
862
  ...
835
863
 
836
- 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, compute_pool: 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]]]:
837
- """
838
- Specifies that this step should execute on Kubernetes.
839
-
840
- Parameters
841
- ----------
842
- cpu : int, default 1
843
- Number of CPUs required for this step. If `@resources` is
844
- also present, the maximum value from all decorators is used.
845
- memory : int, default 4096
846
- Memory size (in MB) required for this step. If
847
- `@resources` is also present, the maximum value from all decorators is
848
- used.
849
- disk : int, default 10240
850
- Disk size (in MB) required for this step. If
851
- `@resources` is also present, the maximum value from all decorators is
852
- used.
853
- image : str, optional, default None
854
- Docker image to use when launching on Kubernetes. If not specified, and
855
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
856
- not, a default Docker image mapping to the current version of Python is used.
857
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
858
- If given, the imagePullPolicy to be applied to the Docker image of the step.
859
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
860
- Kubernetes service account to use when launching pod in Kubernetes.
861
- secrets : List[str], optional, default None
862
- Kubernetes secrets to use when launching pod in Kubernetes. These
863
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
864
- in Metaflow configuration.
865
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
866
- Kubernetes namespace to use when launching pod in Kubernetes.
867
- gpu : int, optional, default None
868
- Number of GPUs required for this step. A value of zero implies that
869
- the scheduled node should not have GPUs.
870
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
871
- The vendor of the GPUs to be used for this step.
872
- tolerations : List[str], default []
873
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
874
- Kubernetes tolerations to use when launching pod in Kubernetes.
875
- use_tmpfs : bool, default False
876
- This enables an explicit tmpfs mount for this step.
877
- tmpfs_tempdir : bool, default True
878
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
879
- tmpfs_size : int, optional, default: None
880
- The value for the size (in MiB) of the tmpfs mount for this step.
881
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
882
- memory allocated for this step.
883
- tmpfs_path : str, optional, default /metaflow_temp
884
- Path to tmpfs mount for this step.
885
- persistent_volume_claims : Dict[str, str], optional, default None
886
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
887
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
888
- shared_memory: int, optional
889
- Shared memory size (in MiB) required for this step
890
- port: int, optional
891
- Port number to specify in the Kubernetes job object
892
- compute_pool : str, optional, default None
893
- Compute pool to be used for for this step.
894
- If not specified, any accessible compute pool within the perimeter is used.
895
- """
896
- ...
897
-
898
864
  @typing.overload
899
- 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]]]:
865
+ 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]]]:
900
866
  """
901
- Specifies the number of times the task corresponding
902
- to a step needs to be retried.
903
-
904
- This decorator is useful for handling transient errors, such as networking issues.
905
- If your task contains operations that can't be retried safely, e.g. database updates,
906
- it is advisable to annotate it with `@retry(times=0)`.
867
+ Creates a human-readable report, a Metaflow Card, after this step completes.
907
868
 
908
- This can be used in conjunction with the `@catch` decorator. The `@catch`
909
- decorator will execute a no-op task after all retries have been exhausted,
910
- ensuring that the flow execution can continue.
869
+ Note that you may add multiple `@card` decorators in a step with different parameters.
911
870
 
912
871
  Parameters
913
872
  ----------
914
- times : int, default 3
915
- Number of times to retry this task.
916
- minutes_between_retries : int, default 2
917
- Number of minutes between retries.
873
+ type : str, default 'default'
874
+ Card type.
875
+ id : str, optional, default None
876
+ If multiple cards are present, use this id to identify this card.
877
+ options : Dict[str, Any], default {}
878
+ Options passed to the card. The contents depend on the card type.
879
+ timeout : int, default 45
880
+ Interrupt reporting if it takes more than this many seconds.
881
+
882
+
918
883
  """
919
884
  ...
920
885
 
921
886
  @typing.overload
922
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
887
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
923
888
  ...
924
889
 
925
890
  @typing.overload
926
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
891
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
927
892
  ...
928
893
 
929
- 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):
894
+ 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):
930
895
  """
931
- Specifies the number of times the task corresponding
932
- to a step needs to be retried.
933
-
934
- This decorator is useful for handling transient errors, such as networking issues.
935
- If your task contains operations that can't be retried safely, e.g. database updates,
936
- it is advisable to annotate it with `@retry(times=0)`.
896
+ Creates a human-readable report, a Metaflow Card, after this step completes.
937
897
 
938
- This can be used in conjunction with the `@catch` decorator. The `@catch`
939
- decorator will execute a no-op task after all retries have been exhausted,
940
- ensuring that the flow execution can continue.
898
+ Note that you may add multiple `@card` decorators in a step with different parameters.
941
899
 
942
900
  Parameters
943
901
  ----------
944
- times : int, default 3
945
- Number of times to retry this task.
946
- minutes_between_retries : int, default 2
947
- Number of minutes between retries.
902
+ type : str, default 'default'
903
+ Card type.
904
+ id : str, optional, default None
905
+ If multiple cards are present, use this id to identify this card.
906
+ options : Dict[str, Any], default {}
907
+ Options passed to the card. The contents depend on the card type.
908
+ timeout : int, default 45
909
+ Interrupt reporting if it takes more than this many seconds.
910
+
911
+
948
912
  """
949
913
  ...
950
914
 
@@ -1006,210 +970,18 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
1006
970
  ...
1007
971
 
1008
972
  @typing.overload
1009
- 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]]]:
973
+ def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1010
974
  """
1011
- Specifies the resources needed when executing this step.
1012
-
1013
- Use `@resources` to specify the resource requirements
1014
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1015
-
1016
- You can choose the compute layer on the command line by executing e.g.
1017
- ```
1018
- python myflow.py run --with batch
1019
- ```
1020
- or
1021
- ```
1022
- python myflow.py run --with kubernetes
1023
- ```
1024
- which executes the flow on the desired system using the
1025
- requirements specified in `@resources`.
975
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1026
976
 
1027
977
  Parameters
1028
978
  ----------
1029
979
  cpu : int, default 1
1030
- Number of CPUs required for this step.
980
+ Number of CPUs required for this step. If `@resources` is
981
+ also present, the maximum value from all decorators is used.
1031
982
  gpu : int, default 0
1032
- Number of GPUs required for this step.
1033
- disk : int, optional, default None
1034
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1035
- memory : int, default 4096
1036
- Memory size (in MB) required for this step.
1037
- shared_memory : int, optional, default None
1038
- The value for the size (in MiB) of the /dev/shm volume for this step.
1039
- This parameter maps to the `--shm-size` option in Docker.
1040
- """
1041
- ...
1042
-
1043
- @typing.overload
1044
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1045
- ...
1046
-
1047
- @typing.overload
1048
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1049
- ...
1050
-
1051
- 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):
1052
- """
1053
- Specifies the resources needed when executing this step.
1054
-
1055
- Use `@resources` to specify the resource requirements
1056
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1057
-
1058
- You can choose the compute layer on the command line by executing e.g.
1059
- ```
1060
- python myflow.py run --with batch
1061
- ```
1062
- or
1063
- ```
1064
- python myflow.py run --with kubernetes
1065
- ```
1066
- which executes the flow on the desired system using the
1067
- requirements specified in `@resources`.
1068
-
1069
- Parameters
1070
- ----------
1071
- cpu : int, default 1
1072
- Number of CPUs required for this step.
1073
- gpu : int, default 0
1074
- Number of GPUs required for this step.
1075
- disk : int, optional, default None
1076
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1077
- memory : int, default 4096
1078
- Memory size (in MB) required for this step.
1079
- shared_memory : int, optional, default None
1080
- The value for the size (in MiB) of the /dev/shm volume for this step.
1081
- This parameter maps to the `--shm-size` option in Docker.
1082
- """
1083
- ...
1084
-
1085
- @typing.overload
1086
- 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
- """
1088
- Specifies secrets to be retrieved and injected as environment variables prior to
1089
- the execution of a step.
1090
-
1091
- Parameters
1092
- ----------
1093
- sources : List[Union[str, Dict[str, Any]]], default: []
1094
- List of secret specs, defining how the secrets are to be retrieved
1095
- """
1096
- ...
1097
-
1098
- @typing.overload
1099
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1100
- ...
1101
-
1102
- @typing.overload
1103
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1104
- ...
1105
-
1106
- 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]]] = []):
1107
- """
1108
- Specifies secrets to be retrieved and injected as environment variables prior to
1109
- the execution of a step.
1110
-
1111
- Parameters
1112
- ----------
1113
- sources : List[Union[str, Dict[str, Any]]], default: []
1114
- List of secret specs, defining how the secrets are to be retrieved
1115
- """
1116
- ...
1117
-
1118
- @typing.overload
1119
- 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]]]:
1120
- """
1121
- Creates a human-readable report, a Metaflow Card, after this step completes.
1122
-
1123
- Note that you may add multiple `@card` decorators in a step with different parameters.
1124
-
1125
- Parameters
1126
- ----------
1127
- type : str, default 'default'
1128
- Card type.
1129
- id : str, optional, default None
1130
- If multiple cards are present, use this id to identify this card.
1131
- options : Dict[str, Any], default {}
1132
- Options passed to the card. The contents depend on the card type.
1133
- timeout : int, default 45
1134
- Interrupt reporting if it takes more than this many seconds.
1135
-
1136
-
1137
- """
1138
- ...
1139
-
1140
- @typing.overload
1141
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1142
- ...
1143
-
1144
- @typing.overload
1145
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1146
- ...
1147
-
1148
- 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):
1149
- """
1150
- Creates a human-readable report, a Metaflow Card, after this step completes.
1151
-
1152
- Note that you may add multiple `@card` decorators in a step with different parameters.
1153
-
1154
- Parameters
1155
- ----------
1156
- type : str, default 'default'
1157
- Card type.
1158
- id : str, optional, default None
1159
- If multiple cards are present, use this id to identify this card.
1160
- options : Dict[str, Any], default {}
1161
- Options passed to the card. The contents depend on the card type.
1162
- timeout : int, default 45
1163
- Interrupt reporting if it takes more than this many seconds.
1164
-
1165
-
1166
- """
1167
- ...
1168
-
1169
- @typing.overload
1170
- 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]]]:
1171
- """
1172
- Specifies environment variables to be set prior to the execution of a step.
1173
-
1174
- Parameters
1175
- ----------
1176
- vars : Dict[str, str], default {}
1177
- Dictionary of environment variables to set.
1178
- """
1179
- ...
1180
-
1181
- @typing.overload
1182
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1183
- ...
1184
-
1185
- @typing.overload
1186
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1187
- ...
1188
-
1189
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1190
- """
1191
- Specifies environment variables to be set prior to the execution of a step.
1192
-
1193
- Parameters
1194
- ----------
1195
- vars : Dict[str, str], default {}
1196
- Dictionary of environment variables to set.
1197
- """
1198
- ...
1199
-
1200
- @typing.overload
1201
- def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1202
- """
1203
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1204
-
1205
- Parameters
1206
- ----------
1207
- cpu : int, default 1
1208
- Number of CPUs required for this step. If `@resources` is
1209
- also present, the maximum value from all decorators is used.
1210
- gpu : int, default 0
1211
- Number of GPUs required for this step. If `@resources` is
1212
- also present, the maximum value from all decorators is used.
983
+ Number of GPUs required for this step. If `@resources` is
984
+ also present, the maximum value from all decorators is used.
1213
985
  memory : int, default 4096
1214
986
  Memory size (in MB) required for this step. If
1215
987
  `@resources` is also present, the maximum value from all decorators is
@@ -1345,21 +1117,168 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1345
1117
  ...
1346
1118
 
1347
1119
  @typing.overload
1348
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1120
+ 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]]]:
1349
1121
  """
1350
- Decorator prototype for all step decorators. This function gets specialized
1351
- and imported for all decorators types by _import_plugin_decorators().
1122
+ Specifies secrets to be retrieved and injected as environment variables prior to
1123
+ the execution of a step.
1124
+
1125
+ Parameters
1126
+ ----------
1127
+ sources : List[Union[str, Dict[str, Any]]], default: []
1128
+ List of secret specs, defining how the secrets are to be retrieved
1352
1129
  """
1353
1130
  ...
1354
1131
 
1355
1132
  @typing.overload
1356
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1133
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1357
1134
  ...
1358
1135
 
1359
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1136
+ @typing.overload
1137
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1138
+ ...
1139
+
1140
+ 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]]] = []):
1360
1141
  """
1361
- Decorator prototype for all step decorators. This function gets specialized
1362
- and imported for all decorators types by _import_plugin_decorators().
1142
+ Specifies secrets to be retrieved and injected as environment variables prior to
1143
+ the execution of a step.
1144
+
1145
+ Parameters
1146
+ ----------
1147
+ sources : List[Union[str, Dict[str, Any]]], default: []
1148
+ List of secret specs, defining how the secrets are to be retrieved
1149
+ """
1150
+ ...
1151
+
1152
+ @typing.overload
1153
+ 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]]]:
1154
+ """
1155
+ Specifies the number of times the task corresponding
1156
+ to a step needs to be retried.
1157
+
1158
+ This decorator is useful for handling transient errors, such as networking issues.
1159
+ If your task contains operations that can't be retried safely, e.g. database updates,
1160
+ it is advisable to annotate it with `@retry(times=0)`.
1161
+
1162
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1163
+ decorator will execute a no-op task after all retries have been exhausted,
1164
+ ensuring that the flow execution can continue.
1165
+
1166
+ Parameters
1167
+ ----------
1168
+ times : int, default 3
1169
+ Number of times to retry this task.
1170
+ minutes_between_retries : int, default 2
1171
+ Number of minutes between retries.
1172
+ """
1173
+ ...
1174
+
1175
+ @typing.overload
1176
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1177
+ ...
1178
+
1179
+ @typing.overload
1180
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1181
+ ...
1182
+
1183
+ 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):
1184
+ """
1185
+ Specifies the number of times the task corresponding
1186
+ to a step needs to be retried.
1187
+
1188
+ This decorator is useful for handling transient errors, such as networking issues.
1189
+ If your task contains operations that can't be retried safely, e.g. database updates,
1190
+ it is advisable to annotate it with `@retry(times=0)`.
1191
+
1192
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1193
+ decorator will execute a no-op task after all retries have been exhausted,
1194
+ ensuring that the flow execution can continue.
1195
+
1196
+ Parameters
1197
+ ----------
1198
+ times : int, default 3
1199
+ Number of times to retry this task.
1200
+ minutes_between_retries : int, default 2
1201
+ Number of minutes between retries.
1202
+ """
1203
+ ...
1204
+
1205
+ @typing.overload
1206
+ 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]]]:
1207
+ """
1208
+ Specifies environment variables to be set prior to the execution of a step.
1209
+
1210
+ Parameters
1211
+ ----------
1212
+ vars : Dict[str, str], default {}
1213
+ Dictionary of environment variables to set.
1214
+ """
1215
+ ...
1216
+
1217
+ @typing.overload
1218
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1219
+ ...
1220
+
1221
+ @typing.overload
1222
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1223
+ ...
1224
+
1225
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1226
+ """
1227
+ Specifies environment variables to be set prior to the execution of a step.
1228
+
1229
+ Parameters
1230
+ ----------
1231
+ vars : Dict[str, str], default {}
1232
+ Dictionary of environment variables to set.
1233
+ """
1234
+ ...
1235
+
1236
+ @typing.overload
1237
+ 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]]]:
1238
+ """
1239
+ Specifies the PyPI packages for the step.
1240
+
1241
+ Information in this decorator will augment any
1242
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1243
+ you can use `@pypi_base` to set packages required by all
1244
+ steps and use `@pypi` to specify step-specific overrides.
1245
+
1246
+ Parameters
1247
+ ----------
1248
+ packages : Dict[str, str], default: {}
1249
+ Packages to use for this step. The key is the name of the package
1250
+ and the value is the version to use.
1251
+ python : str, optional, default: None
1252
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1253
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1254
+ """
1255
+ ...
1256
+
1257
+ @typing.overload
1258
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1259
+ ...
1260
+
1261
+ @typing.overload
1262
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1263
+ ...
1264
+
1265
+ 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):
1266
+ """
1267
+ Specifies the PyPI packages for the step.
1268
+
1269
+ Information in this decorator will augment any
1270
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1271
+ you can use `@pypi_base` to set packages required by all
1272
+ steps and use `@pypi` to specify step-specific overrides.
1273
+
1274
+ Parameters
1275
+ ----------
1276
+ packages : Dict[str, str], default: {}
1277
+ Packages to use for this step. The key is the name of the package
1278
+ and the value is the version to use.
1279
+ python : str, optional, default: None
1280
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1281
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1363
1282
  """
1364
1283
  ...
1365
1284
 
@@ -1412,88 +1331,168 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1412
1331
  """
1413
1332
  ...
1414
1333
 
1415
- @typing.overload
1416
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1334
+ 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, compute_pool: 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]]]:
1417
1335
  """
1418
- Specifies the PyPI packages for all steps of the flow.
1336
+ Specifies that this step should execute on Kubernetes.
1419
1337
 
1420
- Use `@pypi_base` to set common packages required by all
1421
- steps and use `@pypi` to specify step-specific overrides.
1422
1338
  Parameters
1423
1339
  ----------
1424
- packages : Dict[str, str], default: {}
1425
- Packages to use for this flow. The key is the name of the package
1426
- and the value is the version to use.
1427
- python : str, optional, default: None
1428
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1429
- that the version used will correspond to the version of the Python interpreter used to start the run.
1340
+ cpu : int, default 1
1341
+ Number of CPUs required for this step. If `@resources` is
1342
+ also present, the maximum value from all decorators is used.
1343
+ memory : int, default 4096
1344
+ Memory size (in MB) required for this step. If
1345
+ `@resources` is also present, the maximum value from all decorators is
1346
+ used.
1347
+ disk : int, default 10240
1348
+ Disk size (in MB) required for this step. If
1349
+ `@resources` is also present, the maximum value from all decorators is
1350
+ used.
1351
+ image : str, optional, default None
1352
+ Docker image to use when launching on Kubernetes. If not specified, and
1353
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1354
+ not, a default Docker image mapping to the current version of Python is used.
1355
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1356
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
1357
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1358
+ Kubernetes service account to use when launching pod in Kubernetes.
1359
+ secrets : List[str], optional, default None
1360
+ Kubernetes secrets to use when launching pod in Kubernetes. These
1361
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1362
+ in Metaflow configuration.
1363
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1364
+ Kubernetes namespace to use when launching pod in Kubernetes.
1365
+ gpu : int, optional, default None
1366
+ Number of GPUs required for this step. A value of zero implies that
1367
+ the scheduled node should not have GPUs.
1368
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1369
+ The vendor of the GPUs to be used for this step.
1370
+ tolerations : List[str], default []
1371
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1372
+ Kubernetes tolerations to use when launching pod in Kubernetes.
1373
+ use_tmpfs : bool, default False
1374
+ This enables an explicit tmpfs mount for this step.
1375
+ tmpfs_tempdir : bool, default True
1376
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1377
+ tmpfs_size : int, optional, default: None
1378
+ The value for the size (in MiB) of the tmpfs mount for this step.
1379
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1380
+ memory allocated for this step.
1381
+ tmpfs_path : str, optional, default /metaflow_temp
1382
+ Path to tmpfs mount for this step.
1383
+ persistent_volume_claims : Dict[str, str], optional, default None
1384
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1385
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1386
+ shared_memory: int, optional
1387
+ Shared memory size (in MiB) required for this step
1388
+ port: int, optional
1389
+ Port number to specify in the Kubernetes job object
1390
+ compute_pool : str, optional, default None
1391
+ Compute pool to be used for for this step.
1392
+ If not specified, any accessible compute pool within the perimeter is used.
1430
1393
  """
1431
1394
  ...
1432
1395
 
1433
1396
  @typing.overload
1434
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1397
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1398
+ """
1399
+ Decorator prototype for all step decorators. This function gets specialized
1400
+ and imported for all decorators types by _import_plugin_decorators().
1401
+ """
1435
1402
  ...
1436
1403
 
1437
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1404
+ @typing.overload
1405
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1406
+ ...
1407
+
1408
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1438
1409
  """
1439
- Specifies the PyPI packages for all steps of the flow.
1410
+ Decorator prototype for all step decorators. This function gets specialized
1411
+ and imported for all decorators types by _import_plugin_decorators().
1412
+ """
1413
+ ...
1414
+
1415
+ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1416
+ """
1417
+ The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1418
+ This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1440
1419
 
1441
- Use `@pypi_base` to set common packages required by all
1442
- steps and use `@pypi` to specify step-specific overrides.
1443
1420
  Parameters
1444
1421
  ----------
1445
- packages : Dict[str, str], default: {}
1446
- Packages to use for this flow. The key is the name of the package
1447
- and the value is the version to use.
1448
- python : str, optional, default: None
1449
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1450
- that the version used will correspond to the version of the Python interpreter used to start the run.
1422
+ timeout : int
1423
+ Time, in seconds before the task times out and fails. (Default: 3600)
1424
+ poke_interval : int
1425
+ Time in seconds that the job should wait in between each try. (Default: 60)
1426
+ mode : str
1427
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1428
+ exponential_backoff : bool
1429
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1430
+ pool : str
1431
+ the slot pool this task should run in,
1432
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1433
+ soft_fail : bool
1434
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1435
+ name : str
1436
+ Name of the sensor on Airflow
1437
+ description : str
1438
+ Description of sensor in the Airflow UI
1439
+ external_dag_id : str
1440
+ The dag_id that contains the task you want to wait for.
1441
+ external_task_ids : List[str]
1442
+ The list of task_ids that you want to wait for.
1443
+ If None (default value) the sensor waits for the DAG. (Default: None)
1444
+ allowed_states : List[str]
1445
+ Iterable of allowed states, (Default: ['success'])
1446
+ failed_states : List[str]
1447
+ Iterable of failed or dis-allowed states. (Default: None)
1448
+ execution_delta : datetime.timedelta
1449
+ time difference with the previous execution to look at,
1450
+ the default is the same logical date as the current task or DAG. (Default: None)
1451
+ check_existence: bool
1452
+ Set to True to check if the external task exists or check if
1453
+ the DAG to wait for exists. (Default: True)
1451
1454
  """
1452
1455
  ...
1453
1456
 
1454
1457
  @typing.overload
1455
- 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]]:
1458
+ 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]]:
1456
1459
  """
1457
- Specifies the flow(s) that this flow depends on.
1460
+ Specifies the event(s) that this flow depends on.
1458
1461
 
1459
1462
  ```
1460
- @trigger_on_finish(flow='FooFlow')
1463
+ @trigger(event='foo')
1461
1464
  ```
1462
1465
  or
1463
1466
  ```
1464
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1467
+ @trigger(events=['foo', 'bar'])
1465
1468
  ```
1466
- This decorator respects the @project decorator and triggers the flow
1467
- when upstream runs within the same namespace complete successfully
1468
1469
 
1469
- Additionally, you can specify project aware upstream flow dependencies
1470
- by specifying the fully qualified project_flow_name.
1470
+ Additionally, you can specify the parameter mappings
1471
+ to map event payload to Metaflow parameters for the flow.
1471
1472
  ```
1472
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1473
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1473
1474
  ```
1474
1475
  or
1475
1476
  ```
1476
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1477
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1478
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1477
1479
  ```
1478
1480
 
1479
- You can also specify just the project or project branch (other values will be
1480
- inferred from the current project or project branch):
1481
+ 'parameters' can also be a list of strings and tuples like so:
1481
1482
  ```
1482
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1483
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1484
+ ```
1485
+ This is equivalent to:
1486
+ ```
1487
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1483
1488
  ```
1484
-
1485
- Note that `branch` is typically one of:
1486
- - `prod`
1487
- - `user.bob`
1488
- - `test.my_experiment`
1489
- - `prod.staging`
1490
1489
 
1491
1490
  Parameters
1492
1491
  ----------
1493
- flow : Union[str, Dict[str, str]], optional, default None
1494
- Upstream flow dependency for this flow.
1495
- flows : List[Union[str, Dict[str, str]]], default []
1496
- Upstream flow dependencies for this flow.
1492
+ event : Union[str, Dict[str, Any]], optional, default None
1493
+ Event dependency for this flow.
1494
+ events : List[Union[str, Dict[str, Any]]], default []
1495
+ Events dependency for this flow.
1497
1496
  options : Dict[str, Any], default {}
1498
1497
  Backend-specific configuration for tuning eventing behavior.
1499
1498
 
@@ -1502,51 +1501,47 @@ def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] =
1502
1501
  ...
1503
1502
 
1504
1503
  @typing.overload
1505
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1504
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1506
1505
  ...
1507
1506
 
1508
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1507
+ 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] = {}):
1509
1508
  """
1510
- Specifies the flow(s) that this flow depends on.
1509
+ Specifies the event(s) that this flow depends on.
1511
1510
 
1512
1511
  ```
1513
- @trigger_on_finish(flow='FooFlow')
1512
+ @trigger(event='foo')
1514
1513
  ```
1515
1514
  or
1516
1515
  ```
1517
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1516
+ @trigger(events=['foo', 'bar'])
1518
1517
  ```
1519
- This decorator respects the @project decorator and triggers the flow
1520
- when upstream runs within the same namespace complete successfully
1521
-
1522
- Additionally, you can specify project aware upstream flow dependencies
1523
- by specifying the fully qualified project_flow_name.
1518
+
1519
+ Additionally, you can specify the parameter mappings
1520
+ to map event payload to Metaflow parameters for the flow.
1524
1521
  ```
1525
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1522
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1526
1523
  ```
1527
1524
  or
1528
1525
  ```
1529
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1526
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1527
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1530
1528
  ```
1531
1529
 
1532
- You can also specify just the project or project branch (other values will be
1533
- inferred from the current project or project branch):
1530
+ 'parameters' can also be a list of strings and tuples like so:
1534
1531
  ```
1535
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1532
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1533
+ ```
1534
+ This is equivalent to:
1535
+ ```
1536
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1536
1537
  ```
1537
-
1538
- Note that `branch` is typically one of:
1539
- - `prod`
1540
- - `user.bob`
1541
- - `test.my_experiment`
1542
- - `prod.staging`
1543
1538
 
1544
1539
  Parameters
1545
1540
  ----------
1546
- flow : Union[str, Dict[str, str]], optional, default None
1547
- Upstream flow dependency for this flow.
1548
- flows : List[Union[str, Dict[str, str]]], default []
1549
- Upstream flow dependencies for this flow.
1541
+ event : Union[str, Dict[str, Any]], optional, default None
1542
+ Event dependency for this flow.
1543
+ events : List[Union[str, Dict[str, Any]]], default []
1544
+ Events dependency for this flow.
1550
1545
  options : Dict[str, Any], default {}
1551
1546
  Backend-specific configuration for tuning eventing behavior.
1552
1547
 
@@ -1603,10 +1598,31 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1603
1598
  """
1604
1599
  ...
1605
1600
 
1606
- 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]]:
1601
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1607
1602
  """
1608
- 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.
1609
- 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.
1603
+ Specifies what flows belong to the same project.
1604
+
1605
+ A project-specific namespace is created for all flows that
1606
+ use the same `@project(name)`.
1607
+
1608
+ Parameters
1609
+ ----------
1610
+ name : str
1611
+ Project name. Make sure that the name is unique amongst all
1612
+ projects that use the same production scheduler. The name may
1613
+ contain only lowercase alphanumeric characters and underscores.
1614
+
1615
+
1616
+ """
1617
+ ...
1618
+
1619
+ 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]]:
1620
+ """
1621
+ 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)
1622
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1623
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1624
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1625
+ starts only after all sensors finish.
1610
1626
 
1611
1627
  Parameters
1612
1628
  ----------
@@ -1627,39 +1643,18 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1627
1643
  Name of the sensor on Airflow
1628
1644
  description : str
1629
1645
  Description of sensor in the Airflow UI
1630
- external_dag_id : str
1631
- The dag_id that contains the task you want to wait for.
1632
- external_task_ids : List[str]
1633
- The list of task_ids that you want to wait for.
1634
- If None (default value) the sensor waits for the DAG. (Default: None)
1635
- allowed_states : List[str]
1636
- Iterable of allowed states, (Default: ['success'])
1637
- failed_states : List[str]
1638
- Iterable of failed or dis-allowed states. (Default: None)
1639
- execution_delta : datetime.timedelta
1640
- time difference with the previous execution to look at,
1641
- the default is the same logical date as the current task or DAG. (Default: None)
1642
- check_existence: bool
1643
- Set to True to check if the external task exists or check if
1644
- the DAG to wait for exists. (Default: True)
1645
- """
1646
- ...
1647
-
1648
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1649
- """
1650
- Specifies what flows belong to the same project.
1651
-
1652
- A project-specific namespace is created for all flows that
1653
- use the same `@project(name)`.
1654
-
1655
- Parameters
1656
- ----------
1657
- name : str
1658
- Project name. Make sure that the name is unique amongst all
1659
- projects that use the same production scheduler. The name may
1660
- contain only lowercase alphanumeric characters and underscores.
1661
-
1662
-
1646
+ bucket_key : Union[str, List[str]]
1647
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1648
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1649
+ bucket_name : str
1650
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1651
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1652
+ wildcard_match : bool
1653
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1654
+ aws_conn_id : str
1655
+ a reference to the s3 connection on Airflow. (Default: None)
1656
+ verify : bool
1657
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1663
1658
  """
1664
1659
  ...
1665
1660
 
@@ -1713,44 +1708,48 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1713
1708
  ...
1714
1709
 
1715
1710
  @typing.overload
1716
- 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]]:
1711
+ 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]]:
1717
1712
  """
1718
- Specifies the event(s) that this flow depends on.
1713
+ Specifies the flow(s) that this flow depends on.
1719
1714
 
1720
1715
  ```
1721
- @trigger(event='foo')
1716
+ @trigger_on_finish(flow='FooFlow')
1722
1717
  ```
1723
1718
  or
1724
1719
  ```
1725
- @trigger(events=['foo', 'bar'])
1720
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1726
1721
  ```
1722
+ This decorator respects the @project decorator and triggers the flow
1723
+ when upstream runs within the same namespace complete successfully
1727
1724
 
1728
- Additionally, you can specify the parameter mappings
1729
- to map event payload to Metaflow parameters for the flow.
1725
+ Additionally, you can specify project aware upstream flow dependencies
1726
+ by specifying the fully qualified project_flow_name.
1730
1727
  ```
1731
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1728
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1732
1729
  ```
1733
1730
  or
1734
1731
  ```
1735
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1736
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1732
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1737
1733
  ```
1738
1734
 
1739
- 'parameters' can also be a list of strings and tuples like so:
1740
- ```
1741
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1742
- ```
1743
- This is equivalent to:
1735
+ You can also specify just the project or project branch (other values will be
1736
+ inferred from the current project or project branch):
1744
1737
  ```
1745
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1738
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1746
1739
  ```
1747
1740
 
1741
+ Note that `branch` is typically one of:
1742
+ - `prod`
1743
+ - `user.bob`
1744
+ - `test.my_experiment`
1745
+ - `prod.staging`
1746
+
1748
1747
  Parameters
1749
1748
  ----------
1750
- event : Union[str, Dict[str, Any]], optional, default None
1751
- Event dependency for this flow.
1752
- events : List[Union[str, Dict[str, Any]]], default []
1753
- Events dependency for this flow.
1749
+ flow : Union[str, Dict[str, str]], optional, default None
1750
+ Upstream flow dependency for this flow.
1751
+ flows : List[Union[str, Dict[str, str]]], default []
1752
+ Upstream flow dependencies for this flow.
1754
1753
  options : Dict[str, Any], default {}
1755
1754
  Backend-specific configuration for tuning eventing behavior.
1756
1755
 
@@ -1759,47 +1758,51 @@ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = No
1759
1758
  ...
1760
1759
 
1761
1760
  @typing.overload
1762
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1761
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1763
1762
  ...
1764
1763
 
1765
- 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] = {}):
1764
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1766
1765
  """
1767
- Specifies the event(s) that this flow depends on.
1766
+ Specifies the flow(s) that this flow depends on.
1768
1767
 
1769
1768
  ```
1770
- @trigger(event='foo')
1769
+ @trigger_on_finish(flow='FooFlow')
1771
1770
  ```
1772
1771
  or
1773
1772
  ```
1774
- @trigger(events=['foo', 'bar'])
1773
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1775
1774
  ```
1775
+ This decorator respects the @project decorator and triggers the flow
1776
+ when upstream runs within the same namespace complete successfully
1776
1777
 
1777
- Additionally, you can specify the parameter mappings
1778
- to map event payload to Metaflow parameters for the flow.
1778
+ Additionally, you can specify project aware upstream flow dependencies
1779
+ by specifying the fully qualified project_flow_name.
1779
1780
  ```
1780
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1781
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1781
1782
  ```
1782
1783
  or
1783
1784
  ```
1784
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1785
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1785
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1786
1786
  ```
1787
1787
 
1788
- 'parameters' can also be a list of strings and tuples like so:
1789
- ```
1790
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1791
- ```
1792
- This is equivalent to:
1788
+ You can also specify just the project or project branch (other values will be
1789
+ inferred from the current project or project branch):
1793
1790
  ```
1794
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1791
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1795
1792
  ```
1796
1793
 
1794
+ Note that `branch` is typically one of:
1795
+ - `prod`
1796
+ - `user.bob`
1797
+ - `test.my_experiment`
1798
+ - `prod.staging`
1799
+
1797
1800
  Parameters
1798
1801
  ----------
1799
- event : Union[str, Dict[str, Any]], optional, default None
1800
- Event dependency for this flow.
1801
- events : List[Union[str, Dict[str, Any]]], default []
1802
- Events dependency for this flow.
1802
+ flow : Union[str, Dict[str, str]], optional, default None
1803
+ Upstream flow dependency for this flow.
1804
+ flows : List[Union[str, Dict[str, str]]], default []
1805
+ Upstream flow dependencies for this flow.
1803
1806
  options : Dict[str, Any], default {}
1804
1807
  Backend-specific configuration for tuning eventing behavior.
1805
1808
 
@@ -1807,45 +1810,42 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1807
1810
  """
1808
1811
  ...
1809
1812
 
1810
- 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]]:
1813
+ @typing.overload
1814
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1811
1815
  """
1812
- 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)
1813
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1814
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1815
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1816
- starts only after all sensors finish.
1816
+ Specifies the PyPI packages for all steps of the flow.
1817
1817
 
1818
+ Use `@pypi_base` to set common packages required by all
1819
+ steps and use `@pypi` to specify step-specific overrides.
1818
1820
  Parameters
1819
1821
  ----------
1820
- timeout : int
1821
- Time, in seconds before the task times out and fails. (Default: 3600)
1822
- poke_interval : int
1823
- Time in seconds that the job should wait in between each try. (Default: 60)
1824
- mode : str
1825
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1826
- exponential_backoff : bool
1827
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1828
- pool : str
1829
- the slot pool this task should run in,
1830
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1831
- soft_fail : bool
1832
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1833
- name : str
1834
- Name of the sensor on Airflow
1835
- description : str
1836
- Description of sensor in the Airflow UI
1837
- bucket_key : Union[str, List[str]]
1838
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1839
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1840
- bucket_name : str
1841
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1842
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1843
- wildcard_match : bool
1844
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1845
- aws_conn_id : str
1846
- a reference to the s3 connection on Airflow. (Default: None)
1847
- verify : bool
1848
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1822
+ packages : Dict[str, str], default: {}
1823
+ Packages to use for this flow. The key is the name of the package
1824
+ and the value is the version to use.
1825
+ python : str, optional, default: None
1826
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1827
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1828
+ """
1829
+ ...
1830
+
1831
+ @typing.overload
1832
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1833
+ ...
1834
+
1835
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1836
+ """
1837
+ Specifies the PyPI packages for all steps of the flow.
1838
+
1839
+ Use `@pypi_base` to set common packages required by all
1840
+ steps and use `@pypi` to specify step-specific overrides.
1841
+ Parameters
1842
+ ----------
1843
+ packages : Dict[str, str], default: {}
1844
+ Packages to use for this flow. The key is the name of the package
1845
+ and the value is the version to use.
1846
+ python : str, optional, default: None
1847
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1848
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1849
1849
  """
1850
1850
  ...
1851
1851
 
@@ -2800,7 +2800,7 @@ class DataArtifact(metaflow.client.core.MetaflowObject, metaclass=type):
2800
2800
  ...
2801
2801
 
2802
2802
  class Runner(object, metaclass=type):
2803
- def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, **kwargs):
2803
+ def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
2804
2804
  ...
2805
2805
  def __enter__(self) -> metaflow.runner.metaflow_runner.Runner:
2806
2806
  ...
@@ -2892,7 +2892,7 @@ class Runner(object, metaclass=type):
2892
2892
  ...
2893
2893
 
2894
2894
  class NBRunner(object, metaclass=type):
2895
- def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", **kwargs):
2895
+ def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", file_read_timeout: int = 3600, **kwargs):
2896
2896
  ...
2897
2897
  def nbrun(self, **kwargs):
2898
2898
  """
@@ -2998,7 +2998,7 @@ class NBRunner(object, metaclass=type):
2998
2998
  ...
2999
2999
 
3000
3000
  class Deployer(object, metaclass=type):
3001
- def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, **kwargs):
3001
+ def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
3002
3002
  ...
3003
3003
  def _Deployer__make_function(self, deployer_class):
3004
3004
  """
@@ -3018,7 +3018,7 @@ class Deployer(object, metaclass=type):
3018
3018
  ...
3019
3019
 
3020
3020
  class NBDeployer(object, metaclass=type):
3021
- def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", **kwargs):
3021
+ def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", file_read_timeout: int = 3600, **kwargs):
3022
3022
  ...
3023
3023
  def cleanup(self):
3024
3024
  """