ob-metaflow-stubs 6.0.3.109rc1__py2.py3-none-any.whl → 6.0.3.111__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. metaflow-stubs/__init__.pyi +579 -587
  2. metaflow-stubs/cards.pyi +4 -4
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +3 -3
  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/info_file.pyi +2 -2
  14. metaflow-stubs/metadata/metadata.pyi +2 -2
  15. metaflow-stubs/metadata/util.pyi +2 -2
  16. metaflow-stubs/metaflow_config.pyi +4 -2
  17. metaflow-stubs/metaflow_current.pyi +83 -83
  18. metaflow-stubs/mflog/mflog.pyi +2 -2
  19. metaflow-stubs/multicore_utils.pyi +2 -2
  20. metaflow-stubs/parameters.pyi +4 -4
  21. metaflow-stubs/plugins/__init__.pyi +5 -3
  22. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  24. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  31. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +5 -5
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +132 -4
  36. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  37. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +6 -3
  52. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  59. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  60. metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
  61. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  62. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
  74. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  75. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  76. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  77. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  82. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  83. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  84. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  85. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  88. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  101. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  102. metaflow-stubs/plugins/package_cli.pyi +2 -2
  103. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  104. metaflow-stubs/plugins/perimeters.pyi +2 -2
  105. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  106. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  112. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  118. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  120. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  121. metaflow-stubs/procpoll.pyi +2 -2
  122. metaflow-stubs/profilers/__init__.pyi +2 -2
  123. metaflow-stubs/pylint_wrapper.pyi +2 -2
  124. metaflow-stubs/runner/__init__.pyi +2 -2
  125. metaflow-stubs/runner/deployer.pyi +21 -5
  126. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  127. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  128. metaflow-stubs/runner/nbrun.pyi +2 -2
  129. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  130. metaflow-stubs/runner/utils.pyi +2 -2
  131. metaflow-stubs/system/__init__.pyi +4 -4
  132. metaflow-stubs/system/system_logger.pyi +3 -3
  133. metaflow-stubs/system/system_monitor.pyi +3 -3
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. {ob_metaflow_stubs-6.0.3.109rc1.dist-info → ob_metaflow_stubs-6.0.3.111.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.111.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.109rc1.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.109rc1.dist-info → ob_metaflow_stubs-6.0.3.111.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.109rc1.dist-info → ob_metaflow_stubs-6.0.3.111.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.25.1+obcheckpoint(0.0.13);ob(v1) #
4
- # Generated on 2024-10-10T01:39:58.507568 #
3
+ # MF version: 2.12.25.2+obcheckpoint(0.1.0);ob(v1) #
4
+ # Generated on 2024-10-21T17:14:28.436023 #
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.metaflow_current
11
+ import metaflow.flowspec
12
+ import metaflow.parameters
13
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
12
14
  import metaflow._vendor.click.types
13
15
  import metaflow.events
14
16
  import metaflow.datastore.inputs
15
- import metaflow.flowspec
16
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
17
- import datetime
17
+ import typing
18
+ import metaflow.metaflow_current
18
19
  import metaflow.client.core
20
+ import datetime
19
21
  import metaflow.runner.metaflow_runner
20
- import typing
21
- import metaflow.parameters
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -532,234 +532,247 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
532
532
  ...
533
533
 
534
534
  @typing.overload
535
- 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]]]:
535
+ def checkpoint(*, load_policy: str = "fresh", temp_dir_root: 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]]]:
536
536
  """
537
- Specifies environment variables to be set prior to the execution of a step.
537
+ Enables checkpointing for a step.
538
+
538
539
 
539
540
  Parameters
540
541
  ----------
541
- vars : Dict[str, str], default {}
542
- Dictionary of environment variables to set.
542
+ load_policy : str, default: "fresh"
543
+ The policy for loading the checkpoint. The following policies are supported:
544
+ - "eager": Loads the the latest available checkpoint within the namespace.
545
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
546
+ will be loaded at the start of the task.
547
+ - "none": Do not load any checkpoint
548
+ - "fresh": Loads the lastest checkpoint created within the running Task.
549
+ This mode helps loading checkpoints across various retry attempts of the same task.
550
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
551
+ created within the task will be loaded when the task is retries execution on failure.
552
+
553
+ temp_dir_root : str, default: None
554
+ The root directory under which `current.checkpoint.directory` will be created.
555
+
556
+
557
+
543
558
  """
544
559
  ...
545
560
 
546
561
  @typing.overload
547
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
562
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
548
563
  ...
549
564
 
550
565
  @typing.overload
551
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
566
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
552
567
  ...
553
568
 
554
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
569
+ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
555
570
  """
556
- Specifies environment variables to be set prior to the execution of a step.
571
+ Enables checkpointing for a step.
572
+
557
573
 
558
574
  Parameters
559
575
  ----------
560
- vars : Dict[str, str], default {}
561
- Dictionary of environment variables to set.
576
+ load_policy : str, default: "fresh"
577
+ The policy for loading the checkpoint. The following policies are supported:
578
+ - "eager": Loads the the latest available checkpoint within the namespace.
579
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
580
+ will be loaded at the start of the task.
581
+ - "none": Do not load any checkpoint
582
+ - "fresh": Loads the lastest checkpoint created within the running Task.
583
+ This mode helps loading checkpoints across various retry attempts of the same task.
584
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
585
+ created within the task will be loaded when the task is retries execution on failure.
586
+
587
+ temp_dir_root : str, default: None
588
+ The root directory under which `current.checkpoint.directory` will be created.
589
+
590
+
591
+
562
592
  """
563
593
  ...
564
594
 
565
595
  @typing.overload
566
- 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]]]:
596
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: 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]]]:
567
597
  """
568
- Specifies the PyPI packages for the step.
598
+ Enables loading / saving of models within a step.
569
599
 
570
- Information in this decorator will augment any
571
- attributes set in the `@pyi_base` flow-level decorator. Hence,
572
- you can use `@pypi_base` to set packages required by all
573
- steps and use `@pypi` to specify step-specific overrides.
574
600
 
575
601
  Parameters
576
602
  ----------
577
- packages : Dict[str, str], default: {}
578
- Packages to use for this step. The key is the name of the package
579
- and the value is the version to use.
580
- python : str, optional, default: None
581
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
582
- that the version used will correspond to the version of the Python interpreter used to start the run.
603
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
604
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
605
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
606
+ - `current.checkpoint`
607
+ - `current.model`
608
+ - `current.huggingface_hub`
609
+
610
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
611
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
612
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
613
+
614
+ temp_dir_root : str, default: None
615
+ The root directory under which `current.model.loaded` will store loaded models
616
+
617
+
618
+
583
619
  """
584
620
  ...
585
621
 
586
622
  @typing.overload
587
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
623
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
588
624
  ...
589
625
 
590
626
  @typing.overload
591
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
627
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
592
628
  ...
593
629
 
594
- 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):
630
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
595
631
  """
596
- Specifies the PyPI packages for the step.
632
+ Enables loading / saving of models within a step.
597
633
 
598
- Information in this decorator will augment any
599
- attributes set in the `@pyi_base` flow-level decorator. Hence,
600
- you can use `@pypi_base` to set packages required by all
601
- steps and use `@pypi` to specify step-specific overrides.
602
634
 
603
635
  Parameters
604
636
  ----------
605
- packages : Dict[str, str], default: {}
606
- Packages to use for this step. The key is the name of the package
607
- and the value is the version to use.
608
- python : str, optional, default: None
609
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
610
- that the version used will correspond to the version of the Python interpreter used to start the run.
637
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
638
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
639
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
640
+ - `current.checkpoint`
641
+ - `current.model`
642
+ - `current.huggingface_hub`
643
+
644
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
645
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
646
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
647
+
648
+ temp_dir_root : str, default: None
649
+ The root directory under which `current.model.loaded` will store loaded models
650
+
651
+
652
+
611
653
  """
612
654
  ...
613
655
 
614
- 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, node_selector: typing.Union[typing.Dict[str, str], str, None] = 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]]]:
656
+ def huggingface_hub(*, temp_dir_root: 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]]]:
615
657
  """
616
- Specifies that this step should execute on Kubernetes.
658
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
617
659
 
618
660
  Parameters
619
661
  ----------
620
- cpu : int, default 1
621
- Number of CPUs required for this step. If `@resources` is
622
- also present, the maximum value from all decorators is used.
623
- memory : int, default 4096
624
- Memory size (in MB) required for this step. If
625
- `@resources` is also present, the maximum value from all decorators is
626
- used.
627
- disk : int, default 10240
628
- Disk size (in MB) required for this step. If
629
- `@resources` is also present, the maximum value from all decorators is
630
- used.
631
- image : str, optional, default None
632
- Docker image to use when launching on Kubernetes. If not specified, and
633
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
634
- not, a default Docker image mapping to the current version of Python is used.
635
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
636
- If given, the imagePullPolicy to be applied to the Docker image of the step.
637
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
638
- Kubernetes service account to use when launching pod in Kubernetes.
639
- secrets : List[str], optional, default None
640
- Kubernetes secrets to use when launching pod in Kubernetes. These
641
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
642
- in Metaflow configuration.
643
- node_selector: Union[Dict[str,str], str], optional, default None
644
- Kubernetes node selector(s) to apply to the pod running the task.
645
- Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
646
- or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
647
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
648
- Kubernetes namespace to use when launching pod in Kubernetes.
649
- gpu : int, optional, default None
650
- Number of GPUs required for this step. A value of zero implies that
651
- the scheduled node should not have GPUs.
652
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
653
- The vendor of the GPUs to be used for this step.
654
- tolerations : List[str], default []
655
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
656
- Kubernetes tolerations to use when launching pod in Kubernetes.
657
- use_tmpfs : bool, default False
658
- This enables an explicit tmpfs mount for this step.
659
- tmpfs_tempdir : bool, default True
660
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
661
- tmpfs_size : int, optional, default: None
662
- The value for the size (in MiB) of the tmpfs mount for this step.
663
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
664
- memory allocated for this step.
665
- tmpfs_path : str, optional, default /metaflow_temp
666
- Path to tmpfs mount for this step.
667
- persistent_volume_claims : Dict[str, str], optional, default None
668
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
669
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
670
- shared_memory: int, optional
671
- Shared memory size (in MiB) required for this step
672
- port: int, optional
673
- Port number to specify in the Kubernetes job object
674
- compute_pool : str, optional, default None
675
- Compute pool to be used for for this step.
676
- If not specified, any accessible compute pool within the perimeter is used.
662
+ temp_dir_root : str, optional
663
+ The root directory that will hold the temporary directory where objects will be downloaded.
664
+
665
+
677
666
  """
678
667
  ...
679
668
 
680
669
  @typing.overload
681
- 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]]]:
670
+ 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]]]:
682
671
  """
683
- Specifies secrets to be retrieved and injected as environment variables prior to
684
- the execution of a step.
672
+ Specifies the resources needed when executing this step.
673
+
674
+ Use `@resources` to specify the resource requirements
675
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
676
+
677
+ You can choose the compute layer on the command line by executing e.g.
678
+ ```
679
+ python myflow.py run --with batch
680
+ ```
681
+ or
682
+ ```
683
+ python myflow.py run --with kubernetes
684
+ ```
685
+ which executes the flow on the desired system using the
686
+ requirements specified in `@resources`.
685
687
 
686
688
  Parameters
687
689
  ----------
688
- sources : List[Union[str, Dict[str, Any]]], default: []
689
- List of secret specs, defining how the secrets are to be retrieved
690
+ cpu : int, default 1
691
+ Number of CPUs required for this step.
692
+ gpu : int, default 0
693
+ Number of GPUs required for this step.
694
+ disk : int, optional, default None
695
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
696
+ memory : int, default 4096
697
+ Memory size (in MB) required for this step.
698
+ shared_memory : int, optional, default None
699
+ The value for the size (in MiB) of the /dev/shm volume for this step.
700
+ This parameter maps to the `--shm-size` option in Docker.
690
701
  """
691
702
  ...
692
703
 
693
704
  @typing.overload
694
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
705
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
695
706
  ...
696
707
 
697
708
  @typing.overload
698
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
709
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
699
710
  ...
700
711
 
701
- 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]]] = []):
712
+ 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):
702
713
  """
703
- Specifies secrets to be retrieved and injected as environment variables prior to
704
- the execution of a step.
714
+ Specifies the resources needed when executing this step.
715
+
716
+ Use `@resources` to specify the resource requirements
717
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
718
+
719
+ You can choose the compute layer on the command line by executing e.g.
720
+ ```
721
+ python myflow.py run --with batch
722
+ ```
723
+ or
724
+ ```
725
+ python myflow.py run --with kubernetes
726
+ ```
727
+ which executes the flow on the desired system using the
728
+ requirements specified in `@resources`.
705
729
 
706
730
  Parameters
707
731
  ----------
708
- sources : List[Union[str, Dict[str, Any]]], default: []
709
- List of secret specs, defining how the secrets are to be retrieved
732
+ cpu : int, default 1
733
+ Number of CPUs required for this step.
734
+ gpu : int, default 0
735
+ Number of GPUs required for this step.
736
+ disk : int, optional, default None
737
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
738
+ memory : int, default 4096
739
+ Memory size (in MB) required for this step.
740
+ shared_memory : int, optional, default None
741
+ The value for the size (in MiB) of the /dev/shm volume for this step.
742
+ This parameter maps to the `--shm-size` option in Docker.
710
743
  """
711
744
  ...
712
745
 
713
746
  @typing.overload
714
- 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]]]:
747
+ 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]]]:
715
748
  """
716
- Specifies the number of times the task corresponding
717
- to a step needs to be retried.
718
-
719
- This decorator is useful for handling transient errors, such as networking issues.
720
- If your task contains operations that can't be retried safely, e.g. database updates,
721
- it is advisable to annotate it with `@retry(times=0)`.
722
-
723
- This can be used in conjunction with the `@catch` decorator. The `@catch`
724
- decorator will execute a no-op task after all retries have been exhausted,
725
- ensuring that the flow execution can continue.
749
+ Specifies secrets to be retrieved and injected as environment variables prior to
750
+ the execution of a step.
726
751
 
727
752
  Parameters
728
753
  ----------
729
- times : int, default 3
730
- Number of times to retry this task.
731
- minutes_between_retries : int, default 2
732
- Number of minutes between retries.
754
+ sources : List[Union[str, Dict[str, Any]]], default: []
755
+ List of secret specs, defining how the secrets are to be retrieved
733
756
  """
734
757
  ...
735
758
 
736
759
  @typing.overload
737
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
760
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
738
761
  ...
739
762
 
740
763
  @typing.overload
741
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
764
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
742
765
  ...
743
766
 
744
- 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):
767
+ 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]]] = []):
745
768
  """
746
- Specifies the number of times the task corresponding
747
- to a step needs to be retried.
748
-
749
- This decorator is useful for handling transient errors, such as networking issues.
750
- If your task contains operations that can't be retried safely, e.g. database updates,
751
- it is advisable to annotate it with `@retry(times=0)`.
752
-
753
- This can be used in conjunction with the `@catch` decorator. The `@catch`
754
- decorator will execute a no-op task after all retries have been exhausted,
755
- ensuring that the flow execution can continue.
769
+ Specifies secrets to be retrieved and injected as environment variables prior to
770
+ the execution of a step.
756
771
 
757
772
  Parameters
758
773
  ----------
759
- times : int, default 3
760
- Number of times to retry this task.
761
- minutes_between_retries : int, default 2
762
- Number of minutes between retries.
774
+ sources : List[Union[str, Dict[str, Any]]], default: []
775
+ List of secret specs, defining how the secrets are to be retrieved
763
776
  """
764
777
  ...
765
778
 
@@ -821,218 +834,221 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
821
834
  ...
822
835
 
823
836
  @typing.overload
824
- def huggingface_hub(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
837
+ 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]]]:
825
838
  """
826
- Decorator that helps cache, version and store models/datasets from huggingface hub.
839
+ Creates a human-readable report, a Metaflow Card, after this step completes.
840
+
841
+ Note that you may add multiple `@card` decorators in a step with different parameters.
842
+
843
+ Parameters
844
+ ----------
845
+ type : str, default 'default'
846
+ Card type.
847
+ id : str, optional, default None
848
+ If multiple cards are present, use this id to identify this card.
849
+ options : Dict[str, Any], default {}
850
+ Options passed to the card. The contents depend on the card type.
851
+ timeout : int, default 45
852
+ Interrupt reporting if it takes more than this many seconds.
827
853
 
828
854
 
829
855
  """
830
856
  ...
831
857
 
832
858
  @typing.overload
833
- def huggingface_hub(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
859
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
834
860
  ...
835
861
 
836
- def huggingface_hub(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
837
- """
838
- Decorator that helps cache, version and store models/datasets from huggingface hub.
839
-
840
-
841
- """
862
+ @typing.overload
863
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
842
864
  ...
843
865
 
844
- @typing.overload
845
- def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: 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]]]:
866
+ 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):
846
867
  """
847
- Enables loading / saving of models within a step.
868
+ Creates a human-readable report, a Metaflow Card, after this step completes.
848
869
 
870
+ Note that you may add multiple `@card` decorators in a step with different parameters.
849
871
 
850
872
  Parameters
851
873
  ----------
852
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
853
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
854
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
855
- - `current.checkpoint`
856
- - `current.model`
857
- - `current.huggingface_hub`
858
-
859
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
860
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
861
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
862
-
863
- temp_dir_root : str, default: None
864
- The root directory under which `current.model.loaded` will store loaded models
865
-
874
+ type : str, default 'default'
875
+ Card type.
876
+ id : str, optional, default None
877
+ If multiple cards are present, use this id to identify this card.
878
+ options : Dict[str, Any], default {}
879
+ Options passed to the card. The contents depend on the card type.
880
+ timeout : int, default 45
881
+ Interrupt reporting if it takes more than this many seconds.
866
882
 
867
883
 
868
884
  """
869
885
  ...
870
886
 
871
- @typing.overload
872
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
873
- ...
874
-
875
- @typing.overload
876
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
877
- ...
878
-
879
- def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
887
+ 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, node_selector: typing.Union[typing.Dict[str, str], str, None] = 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]]]:
880
888
  """
881
- Enables loading / saving of models within a step.
882
-
889
+ Specifies that this step should execute on Kubernetes.
883
890
 
884
891
  Parameters
885
892
  ----------
886
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
887
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
888
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
889
- - `current.checkpoint`
890
- - `current.model`
891
- - `current.huggingface_hub`
892
-
893
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
894
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
895
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
896
-
897
- temp_dir_root : str, default: None
898
- The root directory under which `current.model.loaded` will store loaded models
899
-
900
-
901
-
893
+ cpu : int, default 1
894
+ Number of CPUs required for this step. If `@resources` is
895
+ also present, the maximum value from all decorators is used.
896
+ memory : int, default 4096
897
+ Memory size (in MB) required for this step. If
898
+ `@resources` is also present, the maximum value from all decorators is
899
+ used.
900
+ disk : int, default 10240
901
+ Disk size (in MB) required for this step. If
902
+ `@resources` is also present, the maximum value from all decorators is
903
+ used.
904
+ image : str, optional, default None
905
+ Docker image to use when launching on Kubernetes. If not specified, and
906
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
907
+ not, a default Docker image mapping to the current version of Python is used.
908
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
909
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
910
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
911
+ Kubernetes service account to use when launching pod in Kubernetes.
912
+ secrets : List[str], optional, default None
913
+ Kubernetes secrets to use when launching pod in Kubernetes. These
914
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
915
+ in Metaflow configuration.
916
+ node_selector: Union[Dict[str,str], str], optional, default None
917
+ Kubernetes node selector(s) to apply to the pod running the task.
918
+ Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
919
+ or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
920
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
921
+ Kubernetes namespace to use when launching pod in Kubernetes.
922
+ gpu : int, optional, default None
923
+ Number of GPUs required for this step. A value of zero implies that
924
+ the scheduled node should not have GPUs.
925
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
926
+ The vendor of the GPUs to be used for this step.
927
+ tolerations : List[str], default []
928
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
929
+ Kubernetes tolerations to use when launching pod in Kubernetes.
930
+ use_tmpfs : bool, default False
931
+ This enables an explicit tmpfs mount for this step.
932
+ tmpfs_tempdir : bool, default True
933
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
934
+ tmpfs_size : int, optional, default: None
935
+ The value for the size (in MiB) of the tmpfs mount for this step.
936
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
937
+ memory allocated for this step.
938
+ tmpfs_path : str, optional, default /metaflow_temp
939
+ Path to tmpfs mount for this step.
940
+ persistent_volume_claims : Dict[str, str], optional, default None
941
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
942
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
943
+ shared_memory: int, optional
944
+ Shared memory size (in MiB) required for this step
945
+ port: int, optional
946
+ Port number to specify in the Kubernetes job object
947
+ compute_pool : str, optional, default None
948
+ Compute pool to be used for for this step.
949
+ If not specified, any accessible compute pool within the perimeter is used.
902
950
  """
903
951
  ...
904
952
 
905
953
  @typing.overload
906
- 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]]]:
954
+ 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]]]:
907
955
  """
908
- Specifies the Conda environment for the step.
956
+ Specifies the PyPI packages for the step.
909
957
 
910
958
  Information in this decorator will augment any
911
- attributes set in the `@conda_base` flow-level decorator. Hence,
912
- you can use `@conda_base` to set packages required by all
913
- steps and use `@conda` to specify step-specific overrides.
959
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
960
+ you can use `@pypi_base` to set packages required by all
961
+ steps and use `@pypi` to specify step-specific overrides.
914
962
 
915
963
  Parameters
916
964
  ----------
917
- packages : Dict[str, str], default {}
965
+ packages : Dict[str, str], default: {}
918
966
  Packages to use for this step. The key is the name of the package
919
967
  and the value is the version to use.
920
- libraries : Dict[str, str], default {}
921
- Supported for backward compatibility. When used with packages, packages will take precedence.
922
- python : str, optional, default None
968
+ python : str, optional, default: None
923
969
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
924
970
  that the version used will correspond to the version of the Python interpreter used to start the run.
925
- disabled : bool, default False
926
- If set to True, disables @conda.
927
971
  """
928
972
  ...
929
973
 
930
974
  @typing.overload
931
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
975
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
932
976
  ...
933
977
 
934
978
  @typing.overload
935
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
979
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
936
980
  ...
937
981
 
938
- 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):
982
+ 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):
939
983
  """
940
- Specifies the Conda environment for the step.
984
+ Specifies the PyPI packages for the step.
941
985
 
942
986
  Information in this decorator will augment any
943
- attributes set in the `@conda_base` flow-level decorator. Hence,
944
- you can use `@conda_base` to set packages required by all
945
- steps and use `@conda` to specify step-specific overrides.
987
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
988
+ you can use `@pypi_base` to set packages required by all
989
+ steps and use `@pypi` to specify step-specific overrides.
946
990
 
947
991
  Parameters
948
992
  ----------
949
- packages : Dict[str, str], default {}
993
+ packages : Dict[str, str], default: {}
950
994
  Packages to use for this step. The key is the name of the package
951
995
  and the value is the version to use.
952
- libraries : Dict[str, str], default {}
953
- Supported for backward compatibility. When used with packages, packages will take precedence.
954
- python : str, optional, default None
996
+ python : str, optional, default: None
955
997
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
956
998
  that the version used will correspond to the version of the Python interpreter used to start the run.
957
- disabled : bool, default False
958
- If set to True, disables @conda.
959
999
  """
960
1000
  ...
961
1001
 
962
1002
  @typing.overload
963
- 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]]]:
1003
+ 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]]]:
964
1004
  """
965
- Specifies the resources needed when executing this step.
1005
+ Specifies the number of times the task corresponding
1006
+ to a step needs to be retried.
966
1007
 
967
- Use `@resources` to specify the resource requirements
968
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1008
+ This decorator is useful for handling transient errors, such as networking issues.
1009
+ If your task contains operations that can't be retried safely, e.g. database updates,
1010
+ it is advisable to annotate it with `@retry(times=0)`.
969
1011
 
970
- You can choose the compute layer on the command line by executing e.g.
971
- ```
972
- python myflow.py run --with batch
973
- ```
974
- or
975
- ```
976
- python myflow.py run --with kubernetes
977
- ```
978
- which executes the flow on the desired system using the
979
- requirements specified in `@resources`.
1012
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1013
+ decorator will execute a no-op task after all retries have been exhausted,
1014
+ ensuring that the flow execution can continue.
980
1015
 
981
1016
  Parameters
982
1017
  ----------
983
- cpu : int, default 1
984
- Number of CPUs required for this step.
985
- gpu : int, default 0
986
- Number of GPUs required for this step.
987
- disk : int, optional, default None
988
- Disk size (in MB) required for this step. Only applies on Kubernetes.
989
- memory : int, default 4096
990
- Memory size (in MB) required for this step.
991
- shared_memory : int, optional, default None
992
- The value for the size (in MiB) of the /dev/shm volume for this step.
993
- This parameter maps to the `--shm-size` option in Docker.
1018
+ times : int, default 3
1019
+ Number of times to retry this task.
1020
+ minutes_between_retries : int, default 2
1021
+ Number of minutes between retries.
994
1022
  """
995
1023
  ...
996
1024
 
997
1025
  @typing.overload
998
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1026
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
999
1027
  ...
1000
1028
 
1001
1029
  @typing.overload
1002
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1030
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1003
1031
  ...
1004
1032
 
1005
- 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):
1033
+ 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):
1006
1034
  """
1007
- Specifies the resources needed when executing this step.
1035
+ Specifies the number of times the task corresponding
1036
+ to a step needs to be retried.
1008
1037
 
1009
- Use `@resources` to specify the resource requirements
1010
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1038
+ This decorator is useful for handling transient errors, such as networking issues.
1039
+ If your task contains operations that can't be retried safely, e.g. database updates,
1040
+ it is advisable to annotate it with `@retry(times=0)`.
1011
1041
 
1012
- You can choose the compute layer on the command line by executing e.g.
1013
- ```
1014
- python myflow.py run --with batch
1015
- ```
1016
- or
1017
- ```
1018
- python myflow.py run --with kubernetes
1019
- ```
1020
- which executes the flow on the desired system using the
1021
- requirements specified in `@resources`.
1042
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1043
+ decorator will execute a no-op task after all retries have been exhausted,
1044
+ ensuring that the flow execution can continue.
1022
1045
 
1023
1046
  Parameters
1024
1047
  ----------
1025
- cpu : int, default 1
1026
- Number of CPUs required for this step.
1027
- gpu : int, default 0
1028
- Number of GPUs required for this step.
1029
- disk : int, optional, default None
1030
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1031
- memory : int, default 4096
1032
- Memory size (in MB) required for this step.
1033
- shared_memory : int, optional, default None
1034
- The value for the size (in MiB) of the /dev/shm volume for this step.
1035
- This parameter maps to the `--shm-size` option in Docker.
1048
+ times : int, default 3
1049
+ Number of times to retry this task.
1050
+ minutes_between_retries : int, default 2
1051
+ Number of minutes between retries.
1036
1052
  """
1037
1053
  ...
1038
1054
 
@@ -1086,328 +1102,195 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1086
1102
  ...
1087
1103
 
1088
1104
  @typing.overload
1089
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1105
+ 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]]]:
1090
1106
  """
1091
- Internal decorator to support Fast bakery
1107
+ Specifies environment variables to be set prior to the execution of a step.
1108
+
1109
+ Parameters
1110
+ ----------
1111
+ vars : Dict[str, str], default {}
1112
+ Dictionary of environment variables to set.
1092
1113
  """
1093
1114
  ...
1094
1115
 
1095
1116
  @typing.overload
1096
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1117
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1097
1118
  ...
1098
1119
 
1099
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1100
- """
1101
- Internal decorator to support Fast bakery
1102
- """
1120
+ @typing.overload
1121
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1103
1122
  ...
1104
1123
 
1105
- @typing.overload
1106
- def checkpoint(*, load_policy: str = "fresh", temp_dir_root: 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]]]:
1124
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1107
1125
  """
1108
- Enables checkpointing for a step.
1109
-
1126
+ Specifies environment variables to be set prior to the execution of a step.
1110
1127
 
1111
1128
  Parameters
1112
1129
  ----------
1113
- load_policy : str, default: "fresh"
1114
- The policy for loading the checkpoint. The following policies are supported:
1115
- - "eager": Loads the the latest available checkpoint within the namespace.
1116
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1117
- will be loaded at the start of the task.
1118
- - "none": Do not load any checkpoint
1119
- - "fresh": Loads the lastest checkpoint created within the running Task.
1120
- This mode helps loading checkpoints across various retry attempts of the same task.
1121
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1122
- created within the task will be loaded when the task is retries execution on failure.
1123
-
1124
- temp_dir_root : str, default: None
1125
- The root directory under which `current.checkpoint.directory` will be created.
1126
-
1127
-
1128
-
1130
+ vars : Dict[str, str], default {}
1131
+ Dictionary of environment variables to set.
1129
1132
  """
1130
1133
  ...
1131
1134
 
1132
1135
  @typing.overload
1133
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1136
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1137
+ """
1138
+ Internal decorator to support Fast bakery
1139
+ """
1134
1140
  ...
1135
1141
 
1136
1142
  @typing.overload
1137
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1143
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1138
1144
  ...
1139
1145
 
1140
- def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
1146
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1141
1147
  """
1142
- Enables checkpointing for a step.
1143
-
1144
-
1145
- Parameters
1146
- ----------
1147
- load_policy : str, default: "fresh"
1148
- The policy for loading the checkpoint. The following policies are supported:
1149
- - "eager": Loads the the latest available checkpoint within the namespace.
1150
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1151
- will be loaded at the start of the task.
1152
- - "none": Do not load any checkpoint
1153
- - "fresh": Loads the lastest checkpoint created within the running Task.
1154
- This mode helps loading checkpoints across various retry attempts of the same task.
1155
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1156
- created within the task will be loaded when the task is retries execution on failure.
1157
-
1158
- temp_dir_root : str, default: None
1159
- The root directory under which `current.checkpoint.directory` will be created.
1160
-
1161
-
1162
-
1148
+ Internal decorator to support Fast bakery
1163
1149
  """
1164
1150
  ...
1165
1151
 
1166
1152
  @typing.overload
1167
- 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]]]:
1153
+ 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]]]:
1168
1154
  """
1169
- Creates a human-readable report, a Metaflow Card, after this step completes.
1155
+ Specifies the Conda environment for the step.
1170
1156
 
1171
- Note that you may add multiple `@card` decorators in a step with different parameters.
1157
+ Information in this decorator will augment any
1158
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1159
+ you can use `@conda_base` to set packages required by all
1160
+ steps and use `@conda` to specify step-specific overrides.
1172
1161
 
1173
1162
  Parameters
1174
1163
  ----------
1175
- type : str, default 'default'
1176
- Card type.
1177
- id : str, optional, default None
1178
- If multiple cards are present, use this id to identify this card.
1179
- options : Dict[str, Any], default {}
1180
- Options passed to the card. The contents depend on the card type.
1181
- timeout : int, default 45
1182
- Interrupt reporting if it takes more than this many seconds.
1183
-
1184
-
1164
+ packages : Dict[str, str], default {}
1165
+ Packages to use for this step. The key is the name of the package
1166
+ and the value is the version to use.
1167
+ libraries : Dict[str, str], default {}
1168
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1169
+ python : str, optional, default None
1170
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1171
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1172
+ disabled : bool, default False
1173
+ If set to True, disables @conda.
1185
1174
  """
1186
1175
  ...
1187
1176
 
1188
1177
  @typing.overload
1189
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1178
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1190
1179
  ...
1191
1180
 
1192
1181
  @typing.overload
1193
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1182
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1194
1183
  ...
1195
1184
 
1196
- 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):
1185
+ 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):
1197
1186
  """
1198
- Creates a human-readable report, a Metaflow Card, after this step completes.
1187
+ Specifies the Conda environment for the step.
1199
1188
 
1200
- Note that you may add multiple `@card` decorators in a step with different parameters.
1189
+ Information in this decorator will augment any
1190
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1191
+ you can use `@conda_base` to set packages required by all
1192
+ steps and use `@conda` to specify step-specific overrides.
1201
1193
 
1202
1194
  Parameters
1203
1195
  ----------
1204
- type : str, default 'default'
1205
- Card type.
1206
- id : str, optional, default None
1207
- If multiple cards are present, use this id to identify this card.
1208
- options : Dict[str, Any], default {}
1209
- Options passed to the card. The contents depend on the card type.
1210
- timeout : int, default 45
1211
- Interrupt reporting if it takes more than this many seconds.
1212
-
1213
-
1196
+ packages : Dict[str, str], default {}
1197
+ Packages to use for this step. The key is the name of the package
1198
+ and the value is the version to use.
1199
+ libraries : Dict[str, str], default {}
1200
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1201
+ python : str, optional, default None
1202
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1203
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1204
+ disabled : bool, default False
1205
+ If set to True, disables @conda.
1214
1206
  """
1215
1207
  ...
1216
1208
 
1217
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1209
+ @typing.overload
1210
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1218
1211
  """
1219
- Specifies what flows belong to the same project.
1220
-
1221
- A project-specific namespace is created for all flows that
1222
- use the same `@project(name)`.
1212
+ Specifies the PyPI packages for all steps of the flow.
1223
1213
 
1214
+ Use `@pypi_base` to set common packages required by all
1215
+ steps and use `@pypi` to specify step-specific overrides.
1224
1216
  Parameters
1225
1217
  ----------
1226
- name : str
1227
- Project name. Make sure that the name is unique amongst all
1228
- projects that use the same production scheduler. The name may
1229
- contain only lowercase alphanumeric characters and underscores.
1230
-
1231
-
1218
+ packages : Dict[str, str], default: {}
1219
+ Packages to use for this flow. The key is the name of the package
1220
+ and the value is the version to use.
1221
+ python : str, optional, default: None
1222
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1223
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1232
1224
  """
1233
1225
  ...
1234
1226
 
1235
- 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]]:
1236
- """
1237
- 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)
1238
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1239
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1240
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1241
- starts only after all sensors finish.
1242
-
1243
- Parameters
1244
- ----------
1245
- timeout : int
1246
- Time, in seconds before the task times out and fails. (Default: 3600)
1247
- poke_interval : int
1248
- Time in seconds that the job should wait in between each try. (Default: 60)
1249
- mode : str
1250
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1251
- exponential_backoff : bool
1252
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1253
- pool : str
1254
- the slot pool this task should run in,
1255
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1256
- soft_fail : bool
1257
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1258
- name : str
1259
- Name of the sensor on Airflow
1260
- description : str
1261
- Description of sensor in the Airflow UI
1262
- bucket_key : Union[str, List[str]]
1263
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1264
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1265
- bucket_name : str
1266
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1267
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1268
- wildcard_match : bool
1269
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1270
- aws_conn_id : str
1271
- a reference to the s3 connection on Airflow. (Default: None)
1272
- verify : bool
1273
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1274
- """
1227
+ @typing.overload
1228
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1275
1229
  ...
1276
1230
 
1277
- @typing.overload
1278
- 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]]:
1231
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1279
1232
  """
1280
- Specifies the event(s) that this flow depends on.
1281
-
1282
- ```
1283
- @trigger(event='foo')
1284
- ```
1285
- or
1286
- ```
1287
- @trigger(events=['foo', 'bar'])
1288
- ```
1289
-
1290
- Additionally, you can specify the parameter mappings
1291
- to map event payload to Metaflow parameters for the flow.
1292
- ```
1293
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1294
- ```
1295
- or
1296
- ```
1297
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1298
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1299
- ```
1300
-
1301
- 'parameters' can also be a list of strings and tuples like so:
1302
- ```
1303
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1304
- ```
1305
- This is equivalent to:
1306
- ```
1307
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1308
- ```
1233
+ Specifies the PyPI packages for all steps of the flow.
1309
1234
 
1235
+ Use `@pypi_base` to set common packages required by all
1236
+ steps and use `@pypi` to specify step-specific overrides.
1310
1237
  Parameters
1311
1238
  ----------
1312
- event : Union[str, Dict[str, Any]], optional, default None
1313
- Event dependency for this flow.
1314
- events : List[Union[str, Dict[str, Any]]], default []
1315
- Events dependency for this flow.
1316
- options : Dict[str, Any], default {}
1317
- Backend-specific configuration for tuning eventing behavior.
1318
-
1319
-
1239
+ packages : Dict[str, str], default: {}
1240
+ Packages to use for this flow. The key is the name of the package
1241
+ and the value is the version to use.
1242
+ python : str, optional, default: None
1243
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1244
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1320
1245
  """
1321
1246
  ...
1322
1247
 
1323
1248
  @typing.overload
1324
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1325
- ...
1326
-
1327
- 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] = {}):
1249
+ 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]]:
1328
1250
  """
1329
- Specifies the event(s) that this flow depends on.
1330
-
1331
- ```
1332
- @trigger(event='foo')
1333
- ```
1334
- or
1335
- ```
1336
- @trigger(events=['foo', 'bar'])
1337
- ```
1338
-
1339
- Additionally, you can specify the parameter mappings
1340
- to map event payload to Metaflow parameters for the flow.
1341
- ```
1342
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1343
- ```
1344
- or
1345
- ```
1346
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1347
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1348
- ```
1349
-
1350
- 'parameters' can also be a list of strings and tuples like so:
1351
- ```
1352
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1353
- ```
1354
- This is equivalent to:
1355
- ```
1356
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1357
- ```
1251
+ Specifies the times when the flow should be run when running on a
1252
+ production scheduler.
1358
1253
 
1359
1254
  Parameters
1360
1255
  ----------
1361
- event : Union[str, Dict[str, Any]], optional, default None
1362
- Event dependency for this flow.
1363
- events : List[Union[str, Dict[str, Any]]], default []
1364
- Events dependency for this flow.
1365
- options : Dict[str, Any], default {}
1366
- Backend-specific configuration for tuning eventing behavior.
1367
-
1368
-
1256
+ hourly : bool, default False
1257
+ Run the workflow hourly.
1258
+ daily : bool, default True
1259
+ Run the workflow daily.
1260
+ weekly : bool, default False
1261
+ Run the workflow weekly.
1262
+ cron : str, optional, default None
1263
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1264
+ specified by this expression.
1265
+ timezone : str, optional, default None
1266
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1267
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1369
1268
  """
1370
1269
  ...
1371
1270
 
1372
- 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]]:
1373
- """
1374
- 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.
1375
- 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.
1376
-
1377
- Parameters
1378
- ----------
1379
- timeout : int
1380
- Time, in seconds before the task times out and fails. (Default: 3600)
1381
- poke_interval : int
1382
- Time in seconds that the job should wait in between each try. (Default: 60)
1383
- mode : str
1384
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1385
- exponential_backoff : bool
1386
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1387
- pool : str
1388
- the slot pool this task should run in,
1389
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1390
- soft_fail : bool
1391
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1392
- name : str
1393
- Name of the sensor on Airflow
1394
- description : str
1395
- Description of sensor in the Airflow UI
1396
- external_dag_id : str
1397
- The dag_id that contains the task you want to wait for.
1398
- external_task_ids : List[str]
1399
- The list of task_ids that you want to wait for.
1400
- If None (default value) the sensor waits for the DAG. (Default: None)
1401
- allowed_states : List[str]
1402
- Iterable of allowed states, (Default: ['success'])
1403
- failed_states : List[str]
1404
- Iterable of failed or dis-allowed states. (Default: None)
1405
- execution_delta : datetime.timedelta
1406
- time difference with the previous execution to look at,
1407
- the default is the same logical date as the current task or DAG. (Default: None)
1408
- check_existence: bool
1409
- Set to True to check if the external task exists or check if
1410
- the DAG to wait for exists. (Default: True)
1271
+ @typing.overload
1272
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1273
+ ...
1274
+
1275
+ 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):
1276
+ """
1277
+ Specifies the times when the flow should be run when running on a
1278
+ production scheduler.
1279
+
1280
+ Parameters
1281
+ ----------
1282
+ hourly : bool, default False
1283
+ Run the workflow hourly.
1284
+ daily : bool, default True
1285
+ Run the workflow daily.
1286
+ weekly : bool, default False
1287
+ Run the workflow weekly.
1288
+ cron : str, optional, default None
1289
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1290
+ specified by this expression.
1291
+ timezone : str, optional, default None
1292
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1293
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1411
1294
  """
1412
1295
  ...
1413
1296
 
@@ -1491,52 +1374,21 @@ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[Fl
1491
1374
  """
1492
1375
  ...
1493
1376
 
1494
- @typing.overload
1495
- 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]]:
1377
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1496
1378
  """
1497
- Specifies the times when the flow should be run when running on a
1498
- production scheduler.
1379
+ Specifies what flows belong to the same project.
1499
1380
 
1500
- Parameters
1501
- ----------
1502
- hourly : bool, default False
1503
- Run the workflow hourly.
1504
- daily : bool, default True
1505
- Run the workflow daily.
1506
- weekly : bool, default False
1507
- Run the workflow weekly.
1508
- cron : str, optional, default None
1509
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1510
- specified by this expression.
1511
- timezone : str, optional, default None
1512
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1513
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1514
- """
1515
- ...
1516
-
1517
- @typing.overload
1518
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1519
- ...
1520
-
1521
- 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):
1522
- """
1523
- Specifies the times when the flow should be run when running on a
1524
- production scheduler.
1381
+ A project-specific namespace is created for all flows that
1382
+ use the same `@project(name)`.
1525
1383
 
1526
1384
  Parameters
1527
1385
  ----------
1528
- hourly : bool, default False
1529
- Run the workflow hourly.
1530
- daily : bool, default True
1531
- Run the workflow daily.
1532
- weekly : bool, default False
1533
- Run the workflow weekly.
1534
- cron : str, optional, default None
1535
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1536
- specified by this expression.
1537
- timezone : str, optional, default None
1538
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1539
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1386
+ name : str
1387
+ Project name. Make sure that the name is unique amongst all
1388
+ projects that use the same production scheduler. The name may
1389
+ contain only lowercase alphanumeric characters and underscores.
1390
+
1391
+
1540
1392
  """
1541
1393
  ...
1542
1394
 
@@ -1643,42 +1495,182 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1643
1495
  """
1644
1496
  ...
1645
1497
 
1498
+ 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]]:
1499
+ """
1500
+ 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.
1501
+ 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.
1502
+
1503
+ Parameters
1504
+ ----------
1505
+ timeout : int
1506
+ Time, in seconds before the task times out and fails. (Default: 3600)
1507
+ poke_interval : int
1508
+ Time in seconds that the job should wait in between each try. (Default: 60)
1509
+ mode : str
1510
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1511
+ exponential_backoff : bool
1512
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1513
+ pool : str
1514
+ the slot pool this task should run in,
1515
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1516
+ soft_fail : bool
1517
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1518
+ name : str
1519
+ Name of the sensor on Airflow
1520
+ description : str
1521
+ Description of sensor in the Airflow UI
1522
+ external_dag_id : str
1523
+ The dag_id that contains the task you want to wait for.
1524
+ external_task_ids : List[str]
1525
+ The list of task_ids that you want to wait for.
1526
+ If None (default value) the sensor waits for the DAG. (Default: None)
1527
+ allowed_states : List[str]
1528
+ Iterable of allowed states, (Default: ['success'])
1529
+ failed_states : List[str]
1530
+ Iterable of failed or dis-allowed states. (Default: None)
1531
+ execution_delta : datetime.timedelta
1532
+ time difference with the previous execution to look at,
1533
+ the default is the same logical date as the current task or DAG. (Default: None)
1534
+ check_existence: bool
1535
+ Set to True to check if the external task exists or check if
1536
+ the DAG to wait for exists. (Default: True)
1537
+ """
1538
+ ...
1539
+
1540
+ 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]]:
1541
+ """
1542
+ 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)
1543
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1544
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1545
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1546
+ starts only after all sensors finish.
1547
+
1548
+ Parameters
1549
+ ----------
1550
+ timeout : int
1551
+ Time, in seconds before the task times out and fails. (Default: 3600)
1552
+ poke_interval : int
1553
+ Time in seconds that the job should wait in between each try. (Default: 60)
1554
+ mode : str
1555
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1556
+ exponential_backoff : bool
1557
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1558
+ pool : str
1559
+ the slot pool this task should run in,
1560
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1561
+ soft_fail : bool
1562
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1563
+ name : str
1564
+ Name of the sensor on Airflow
1565
+ description : str
1566
+ Description of sensor in the Airflow UI
1567
+ bucket_key : Union[str, List[str]]
1568
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1569
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1570
+ bucket_name : str
1571
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1572
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1573
+ wildcard_match : bool
1574
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1575
+ aws_conn_id : str
1576
+ a reference to the s3 connection on Airflow. (Default: None)
1577
+ verify : bool
1578
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1579
+ """
1580
+ ...
1581
+
1646
1582
  @typing.overload
1647
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1583
+ 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]]:
1648
1584
  """
1649
- Specifies the PyPI packages for all steps of the flow.
1585
+ Specifies the event(s) that this flow depends on.
1586
+
1587
+ ```
1588
+ @trigger(event='foo')
1589
+ ```
1590
+ or
1591
+ ```
1592
+ @trigger(events=['foo', 'bar'])
1593
+ ```
1594
+
1595
+ Additionally, you can specify the parameter mappings
1596
+ to map event payload to Metaflow parameters for the flow.
1597
+ ```
1598
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1599
+ ```
1600
+ or
1601
+ ```
1602
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1603
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1604
+ ```
1605
+
1606
+ 'parameters' can also be a list of strings and tuples like so:
1607
+ ```
1608
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1609
+ ```
1610
+ This is equivalent to:
1611
+ ```
1612
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1613
+ ```
1650
1614
 
1651
- Use `@pypi_base` to set common packages required by all
1652
- steps and use `@pypi` to specify step-specific overrides.
1653
1615
  Parameters
1654
1616
  ----------
1655
- packages : Dict[str, str], default: {}
1656
- Packages to use for this flow. The key is the name of the package
1657
- and the value is the version to use.
1658
- python : str, optional, default: None
1659
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1660
- that the version used will correspond to the version of the Python interpreter used to start the run.
1617
+ event : Union[str, Dict[str, Any]], optional, default None
1618
+ Event dependency for this flow.
1619
+ events : List[Union[str, Dict[str, Any]]], default []
1620
+ Events dependency for this flow.
1621
+ options : Dict[str, Any], default {}
1622
+ Backend-specific configuration for tuning eventing behavior.
1623
+
1624
+
1661
1625
  """
1662
1626
  ...
1663
1627
 
1664
1628
  @typing.overload
1665
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1629
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1666
1630
  ...
1667
1631
 
1668
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1632
+ 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] = {}):
1669
1633
  """
1670
- Specifies the PyPI packages for all steps of the flow.
1634
+ Specifies the event(s) that this flow depends on.
1635
+
1636
+ ```
1637
+ @trigger(event='foo')
1638
+ ```
1639
+ or
1640
+ ```
1641
+ @trigger(events=['foo', 'bar'])
1642
+ ```
1643
+
1644
+ Additionally, you can specify the parameter mappings
1645
+ to map event payload to Metaflow parameters for the flow.
1646
+ ```
1647
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1648
+ ```
1649
+ or
1650
+ ```
1651
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1652
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1653
+ ```
1654
+
1655
+ 'parameters' can also be a list of strings and tuples like so:
1656
+ ```
1657
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1658
+ ```
1659
+ This is equivalent to:
1660
+ ```
1661
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1662
+ ```
1671
1663
 
1672
- Use `@pypi_base` to set common packages required by all
1673
- steps and use `@pypi` to specify step-specific overrides.
1674
1664
  Parameters
1675
1665
  ----------
1676
- packages : Dict[str, str], default: {}
1677
- Packages to use for this flow. The key is the name of the package
1678
- and the value is the version to use.
1679
- python : str, optional, default: None
1680
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1681
- that the version used will correspond to the version of the Python interpreter used to start the run.
1666
+ event : Union[str, Dict[str, Any]], optional, default None
1667
+ Event dependency for this flow.
1668
+ events : List[Union[str, Dict[str, Any]]], default []
1669
+ Events dependency for this flow.
1670
+ options : Dict[str, Any], default {}
1671
+ Backend-specific configuration for tuning eventing behavior.
1672
+
1673
+
1682
1674
  """
1683
1675
  ...
1684
1676