ob-metaflow-stubs 6.0.3.102rc2__py2.py3-none-any.whl → 6.0.3.102rc4__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. metaflow-stubs/__init__.pyi +478 -478
  2. metaflow-stubs/cards.pyi +4 -4
  3. metaflow-stubs/cli.pyi +1 -1
  4. metaflow-stubs/client/__init__.pyi +2 -2
  5. metaflow-stubs/client/core.pyi +4 -4
  6. metaflow-stubs/client/filecache.pyi +1 -1
  7. metaflow-stubs/clone_util.pyi +1 -1
  8. metaflow-stubs/events.pyi +1 -1
  9. metaflow-stubs/exception.pyi +1 -1
  10. metaflow-stubs/flowspec.pyi +4 -4
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +3 -3
  13. metaflow-stubs/info_file.pyi +1 -1
  14. metaflow-stubs/metadata/metadata.pyi +1 -1
  15. metaflow-stubs/metadata/util.pyi +1 -1
  16. metaflow-stubs/metaflow_config.pyi +1 -1
  17. metaflow-stubs/metaflow_current.pyi +79 -79
  18. metaflow-stubs/mflog/mflog.pyi +1 -1
  19. metaflow-stubs/multicore_utils.pyi +1 -1
  20. metaflow-stubs/parameters.pyi +3 -3
  21. metaflow-stubs/plugins/__init__.pyi +1 -1
  22. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  24. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  29. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  30. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  31. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +7 -7
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  36. metaflow-stubs/plugins/aws/__init__.pyi +1 -1
  37. metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  52. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  59. metaflow-stubs/plugins/cards/__init__.pyi +1 -1
  60. metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
  61. metaflow-stubs/plugins/cards/card_client.pyi +1 -1
  62. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  74. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  75. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  76. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  77. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  82. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  83. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  84. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  85. metaflow-stubs/plugins/events_decorator.pyi +1 -1
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  88. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  101. metaflow-stubs/plugins/logs_cli.pyi +1 -1
  102. metaflow-stubs/plugins/package_cli.pyi +1 -1
  103. metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
  104. metaflow-stubs/plugins/perimeters.pyi +1 -1
  105. metaflow-stubs/plugins/project_decorator.pyi +1 -1
  106. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +1 -1
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  112. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  113. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  114. metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  117. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  118. metaflow-stubs/plugins/tag_cli.pyi +2 -2
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  120. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  121. metaflow-stubs/procpoll.pyi +1 -1
  122. metaflow-stubs/profilers/__init__.pyi +1 -1
  123. metaflow-stubs/pylint_wrapper.pyi +1 -1
  124. metaflow-stubs/runner/__init__.pyi +1 -1
  125. metaflow-stubs/runner/deployer.pyi +2 -2
  126. metaflow-stubs/runner/metaflow_runner.pyi +2 -2
  127. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  128. metaflow-stubs/runner/nbrun.pyi +1 -1
  129. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  130. metaflow-stubs/runner/utils.pyi +1 -1
  131. metaflow-stubs/system/__init__.pyi +2 -2
  132. metaflow-stubs/system/system_logger.pyi +1 -1
  133. metaflow-stubs/system/system_monitor.pyi +2 -2
  134. metaflow-stubs/tagging_util.pyi +1 -1
  135. metaflow-stubs/tuple_util.pyi +1 -1
  136. {ob_metaflow_stubs-6.0.3.102rc2.dist-info → ob_metaflow_stubs-6.0.3.102rc4.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.102rc4.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.102rc2.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.102rc2.dist-info → ob_metaflow_stubs-6.0.3.102rc4.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.102rc2.dist-info → ob_metaflow_stubs-6.0.3.102rc4.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.12.22.1+obcheckpoint(0.0.10);ob(v1) #
4
- # Generated on 2024-09-20T18:57:11.211223 #
4
+ # Generated on 2024-09-20T19:06:14.547638 #
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.runner.metaflow_runner
12
+ import metaflow.parameters
13
+ import metaflow.flowspec
12
14
  import metaflow.datastore.inputs
13
15
  import metaflow.events
14
- import metaflow.runner.metaflow_runner
15
16
  import metaflow.client.core
16
- import datetime
17
17
  import metaflow._vendor.click.types
18
- import metaflow.parameters
19
- import metaflow.flowspec
20
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
21
18
  import typing
19
+ import metaflow.metaflow_current
20
+ import datetime
21
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -484,202 +484,144 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
484
484
  ...
485
485
 
486
486
  @typing.overload
487
- 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]]]:
487
+ 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]]]:
488
488
  """
489
- Specifies the number of times the task corresponding
490
- to a step needs to be retried.
491
-
492
- This decorator is useful for handling transient errors, such as networking issues.
493
- If your task contains operations that can't be retried safely, e.g. database updates,
494
- it is advisable to annotate it with `@retry(times=0)`.
489
+ Enables loading / saving of models within a step.
495
490
 
496
- This can be used in conjunction with the `@catch` decorator. The `@catch`
497
- decorator will execute a no-op task after all retries have been exhausted,
498
- ensuring that the flow execution can continue.
499
491
 
500
492
  Parameters
501
493
  ----------
502
- times : int, default 3
503
- Number of times to retry this task.
504
- minutes_between_retries : int, default 2
505
- Number of minutes between retries.
494
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
495
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
496
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
497
+ - `current.checkpoint`
498
+ - `current.model`
499
+ - `current.huggingface_hub`
500
+
501
+ 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
502
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
503
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
504
+
505
+ temp_dir_root : str, default: None
506
+ The root directory under which `current.model.loaded` will store loaded models
507
+
508
+
509
+
506
510
  """
507
511
  ...
508
512
 
509
513
  @typing.overload
510
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
514
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
511
515
  ...
512
516
 
513
517
  @typing.overload
514
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
518
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
515
519
  ...
516
520
 
517
- 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):
521
+ 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):
518
522
  """
519
- Specifies the number of times the task corresponding
520
- to a step needs to be retried.
521
-
522
- This decorator is useful for handling transient errors, such as networking issues.
523
- If your task contains operations that can't be retried safely, e.g. database updates,
524
- it is advisable to annotate it with `@retry(times=0)`.
523
+ Enables loading / saving of models within a step.
525
524
 
526
- This can be used in conjunction with the `@catch` decorator. The `@catch`
527
- decorator will execute a no-op task after all retries have been exhausted,
528
- ensuring that the flow execution can continue.
529
525
 
530
526
  Parameters
531
527
  ----------
532
- times : int, default 3
533
- Number of times to retry this task.
534
- minutes_between_retries : int, default 2
535
- Number of minutes between retries.
536
- """
537
- ...
538
-
539
- @typing.overload
540
- 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]]]:
541
- """
542
- Specifies the Conda environment for the step.
528
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
529
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
530
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
531
+ - `current.checkpoint`
532
+ - `current.model`
533
+ - `current.huggingface_hub`
534
+
535
+ 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
536
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
537
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
538
+
539
+ temp_dir_root : str, default: None
540
+ The root directory under which `current.model.loaded` will store loaded models
541
+
543
542
 
544
- Information in this decorator will augment any
545
- attributes set in the `@conda_base` flow-level decorator. Hence,
546
- you can use `@conda_base` to set packages required by all
547
- steps and use `@conda` to specify step-specific overrides.
548
543
 
549
- Parameters
550
- ----------
551
- packages : Dict[str, str], default {}
552
- Packages to use for this step. The key is the name of the package
553
- and the value is the version to use.
554
- libraries : Dict[str, str], default {}
555
- Supported for backward compatibility. When used with packages, packages will take precedence.
556
- python : str, optional, default None
557
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
558
- that the version used will correspond to the version of the Python interpreter used to start the run.
559
- disabled : bool, default False
560
- If set to True, disables @conda.
561
544
  """
562
545
  ...
563
546
 
564
547
  @typing.overload
565
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
548
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
549
+ """
550
+ Internal decorator to support Fast bakery
551
+ """
566
552
  ...
567
553
 
568
554
  @typing.overload
569
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
555
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
570
556
  ...
571
557
 
572
- 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):
558
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
573
559
  """
574
- Specifies the Conda environment for the step.
575
-
576
- Information in this decorator will augment any
577
- attributes set in the `@conda_base` flow-level decorator. Hence,
578
- you can use `@conda_base` to set packages required by all
579
- steps and use `@conda` to specify step-specific overrides.
580
-
581
- Parameters
582
- ----------
583
- packages : Dict[str, str], default {}
584
- Packages to use for this step. The key is the name of the package
585
- and the value is the version to use.
586
- libraries : Dict[str, str], default {}
587
- Supported for backward compatibility. When used with packages, packages will take precedence.
588
- python : str, optional, default None
589
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
590
- that the version used will correspond to the version of the Python interpreter used to start the run.
591
- disabled : bool, default False
592
- If set to True, disables @conda.
560
+ Internal decorator to support Fast bakery
593
561
  """
594
562
  ...
595
563
 
596
564
  @typing.overload
597
- 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]]]:
565
+ 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]]]:
598
566
  """
599
- Specifies secrets to be retrieved and injected as environment variables prior to
600
- the execution of a step.
567
+ Specifies environment variables to be set prior to the execution of a step.
601
568
 
602
569
  Parameters
603
570
  ----------
604
- sources : List[Union[str, Dict[str, Any]]], default: []
605
- List of secret specs, defining how the secrets are to be retrieved
571
+ vars : Dict[str, str], default {}
572
+ Dictionary of environment variables to set.
606
573
  """
607
574
  ...
608
575
 
609
576
  @typing.overload
610
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
577
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
611
578
  ...
612
579
 
613
580
  @typing.overload
614
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
581
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
615
582
  ...
616
583
 
617
- 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]]] = []):
584
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
618
585
  """
619
- Specifies secrets to be retrieved and injected as environment variables prior to
620
- the execution of a step.
586
+ Specifies environment variables to be set prior to the execution of a step.
621
587
 
622
588
  Parameters
623
589
  ----------
624
- sources : List[Union[str, Dict[str, Any]]], default: []
625
- List of secret specs, defining how the secrets are to be retrieved
590
+ vars : Dict[str, str], default {}
591
+ Dictionary of environment variables to set.
626
592
  """
627
593
  ...
628
594
 
629
595
  @typing.overload
630
- def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
596
+ 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]]]:
631
597
  """
632
- Specifies a timeout for your step.
633
-
634
- This decorator is useful if this step may hang indefinitely.
635
-
636
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
637
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
638
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
639
-
640
- Note that all the values specified in parameters are added together so if you specify
641
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
598
+ Specifies secrets to be retrieved and injected as environment variables prior to
599
+ the execution of a step.
642
600
 
643
601
  Parameters
644
602
  ----------
645
- seconds : int, default 0
646
- Number of seconds to wait prior to timing out.
647
- minutes : int, default 0
648
- Number of minutes to wait prior to timing out.
649
- hours : int, default 0
650
- Number of hours to wait prior to timing out.
603
+ sources : List[Union[str, Dict[str, Any]]], default: []
604
+ List of secret specs, defining how the secrets are to be retrieved
651
605
  """
652
606
  ...
653
607
 
654
608
  @typing.overload
655
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
609
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
656
610
  ...
657
611
 
658
612
  @typing.overload
659
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
613
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
660
614
  ...
661
615
 
662
- def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
616
+ 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]]] = []):
663
617
  """
664
- Specifies a timeout for your step.
665
-
666
- This decorator is useful if this step may hang indefinitely.
667
-
668
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
669
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
670
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
671
-
672
- Note that all the values specified in parameters are added together so if you specify
673
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
618
+ Specifies secrets to be retrieved and injected as environment variables prior to
619
+ the execution of a step.
674
620
 
675
621
  Parameters
676
622
  ----------
677
- seconds : int, default 0
678
- Number of seconds to wait prior to timing out.
679
- minutes : int, default 0
680
- Number of minutes to wait prior to timing out.
681
- hours : int, default 0
682
- Number of hours to wait prior to timing out.
623
+ sources : List[Union[str, Dict[str, Any]]], default: []
624
+ List of secret specs, defining how the secrets are to be retrieved
683
625
  """
684
626
  ...
685
627
 
@@ -744,6 +686,55 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
744
686
  """
745
687
  ...
746
688
 
689
+ @typing.overload
690
+ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
691
+ """
692
+ Specifies that the step will success under all circumstances.
693
+
694
+ The decorator will create an optional artifact, specified by `var`, which
695
+ contains the exception raised. You can use it to detect the presence
696
+ of errors, indicating that all happy-path artifacts produced by the step
697
+ are missing.
698
+
699
+ Parameters
700
+ ----------
701
+ var : str, optional, default None
702
+ Name of the artifact in which to store the caught exception.
703
+ If not specified, the exception is not stored.
704
+ print_exception : bool, default True
705
+ Determines whether or not the exception is printed to
706
+ stdout when caught.
707
+ """
708
+ ...
709
+
710
+ @typing.overload
711
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
712
+ ...
713
+
714
+ @typing.overload
715
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
716
+ ...
717
+
718
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
719
+ """
720
+ Specifies that the step will success under all circumstances.
721
+
722
+ The decorator will create an optional artifact, specified by `var`, which
723
+ contains the exception raised. You can use it to detect the presence
724
+ of errors, indicating that all happy-path artifacts produced by the step
725
+ are missing.
726
+
727
+ Parameters
728
+ ----------
729
+ var : str, optional, default None
730
+ Name of the artifact in which to store the caught exception.
731
+ If not specified, the exception is not stored.
732
+ print_exception : bool, default True
733
+ Determines whether or not the exception is printed to
734
+ stdout when caught.
735
+ """
736
+ ...
737
+
747
738
  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]]]:
748
739
  """
749
740
  Specifies that this step should execute on Kubernetes.
@@ -830,129 +821,163 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
830
821
  ...
831
822
 
832
823
  @typing.overload
833
- 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]]]:
824
+ 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]]]:
834
825
  """
835
- Enables loading / saving of models within a step.
836
-
837
-
838
- Parameters
839
- ----------
840
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
841
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
842
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
843
- - `current.checkpoint`
844
- - `current.model`
845
- - `current.huggingface_hub`
846
-
847
- 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
848
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
849
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
850
-
851
- temp_dir_root : str, default: None
852
- The root directory under which `current.model.loaded` will store loaded models
853
-
826
+ Specifies the Conda environment for the step.
854
827
 
828
+ Information in this decorator will augment any
829
+ attributes set in the `@conda_base` flow-level decorator. Hence,
830
+ you can use `@conda_base` to set packages required by all
831
+ steps and use `@conda` to specify step-specific overrides.
855
832
 
833
+ Parameters
834
+ ----------
835
+ packages : Dict[str, str], default {}
836
+ Packages to use for this step. The key is the name of the package
837
+ and the value is the version to use.
838
+ libraries : Dict[str, str], default {}
839
+ Supported for backward compatibility. When used with packages, packages will take precedence.
840
+ python : str, optional, default None
841
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
842
+ that the version used will correspond to the version of the Python interpreter used to start the run.
843
+ disabled : bool, default False
844
+ If set to True, disables @conda.
856
845
  """
857
846
  ...
858
847
 
859
848
  @typing.overload
860
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
849
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
861
850
  ...
862
851
 
863
852
  @typing.overload
864
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
853
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
865
854
  ...
866
855
 
867
- 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):
856
+ 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):
868
857
  """
869
- Enables loading / saving of models within a step.
858
+ Specifies the Conda environment for the step.
870
859
 
860
+ Information in this decorator will augment any
861
+ attributes set in the `@conda_base` flow-level decorator. Hence,
862
+ you can use `@conda_base` to set packages required by all
863
+ steps and use `@conda` to specify step-specific overrides.
871
864
 
872
865
  Parameters
873
866
  ----------
874
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
875
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
876
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
877
- - `current.checkpoint`
878
- - `current.model`
879
- - `current.huggingface_hub`
880
-
881
- 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
882
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
883
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
884
-
885
- temp_dir_root : str, default: None
886
- The root directory under which `current.model.loaded` will store loaded models
887
-
888
-
889
-
867
+ packages : Dict[str, str], default {}
868
+ Packages to use for this step. The key is the name of the package
869
+ and the value is the version to use.
870
+ libraries : Dict[str, str], default {}
871
+ Supported for backward compatibility. When used with packages, packages will take precedence.
872
+ python : str, optional, default None
873
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
874
+ that the version used will correspond to the version of the Python interpreter used to start the run.
875
+ disabled : bool, default False
876
+ If set to True, disables @conda.
890
877
  """
891
878
  ...
892
879
 
893
880
  @typing.overload
894
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
881
+ 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]]]:
895
882
  """
896
- Specifies that the step will success under all circumstances.
883
+ Creates a human-readable report, a Metaflow Card, after this step completes.
897
884
 
898
- The decorator will create an optional artifact, specified by `var`, which
899
- contains the exception raised. You can use it to detect the presence
900
- of errors, indicating that all happy-path artifacts produced by the step
901
- are missing.
885
+ Note that you may add multiple `@card` decorators in a step with different parameters.
902
886
 
903
887
  Parameters
904
888
  ----------
905
- var : str, optional, default None
906
- Name of the artifact in which to store the caught exception.
907
- If not specified, the exception is not stored.
908
- print_exception : bool, default True
909
- Determines whether or not the exception is printed to
910
- stdout when caught.
889
+ type : str, default 'default'
890
+ Card type.
891
+ id : str, optional, default None
892
+ If multiple cards are present, use this id to identify this card.
893
+ options : Dict[str, Any], default {}
894
+ Options passed to the card. The contents depend on the card type.
895
+ timeout : int, default 45
896
+ Interrupt reporting if it takes more than this many seconds.
897
+
898
+
911
899
  """
912
900
  ...
913
901
 
914
902
  @typing.overload
915
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
903
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
916
904
  ...
917
905
 
918
906
  @typing.overload
919
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
907
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
920
908
  ...
921
909
 
922
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
910
+ 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):
923
911
  """
924
- Specifies that the step will success under all circumstances.
912
+ Creates a human-readable report, a Metaflow Card, after this step completes.
925
913
 
926
- The decorator will create an optional artifact, specified by `var`, which
927
- contains the exception raised. You can use it to detect the presence
928
- of errors, indicating that all happy-path artifacts produced by the step
929
- are missing.
914
+ Note that you may add multiple `@card` decorators in a step with different parameters.
930
915
 
931
916
  Parameters
932
917
  ----------
933
- var : str, optional, default None
934
- Name of the artifact in which to store the caught exception.
935
- If not specified, the exception is not stored.
936
- print_exception : bool, default True
937
- Determines whether or not the exception is printed to
938
- stdout when caught.
918
+ type : str, default 'default'
919
+ Card type.
920
+ id : str, optional, default None
921
+ If multiple cards are present, use this id to identify this card.
922
+ options : Dict[str, Any], default {}
923
+ Options passed to the card. The contents depend on the card type.
924
+ timeout : int, default 45
925
+ Interrupt reporting if it takes more than this many seconds.
926
+
927
+
939
928
  """
940
929
  ...
941
930
 
942
931
  @typing.overload
943
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
932
+ 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]]]:
944
933
  """
945
- Internal decorator to support Fast bakery
934
+ Specifies the number of times the task corresponding
935
+ to a step needs to be retried.
936
+
937
+ This decorator is useful for handling transient errors, such as networking issues.
938
+ If your task contains operations that can't be retried safely, e.g. database updates,
939
+ it is advisable to annotate it with `@retry(times=0)`.
940
+
941
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
942
+ decorator will execute a no-op task after all retries have been exhausted,
943
+ ensuring that the flow execution can continue.
944
+
945
+ Parameters
946
+ ----------
947
+ times : int, default 3
948
+ Number of times to retry this task.
949
+ minutes_between_retries : int, default 2
950
+ Number of minutes between retries.
946
951
  """
947
952
  ...
948
953
 
949
954
  @typing.overload
950
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
955
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
951
956
  ...
952
957
 
953
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
958
+ @typing.overload
959
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
960
+ ...
961
+
962
+ 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):
954
963
  """
955
- Internal decorator to support Fast bakery
964
+ Specifies the number of times the task corresponding
965
+ to a step needs to be retried.
966
+
967
+ This decorator is useful for handling transient errors, such as networking issues.
968
+ If your task contains operations that can't be retried safely, e.g. database updates,
969
+ it is advisable to annotate it with `@retry(times=0)`.
970
+
971
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
972
+ decorator will execute a no-op task after all retries have been exhausted,
973
+ ensuring that the flow execution can continue.
974
+
975
+ Parameters
976
+ ----------
977
+ times : int, default 3
978
+ Number of times to retry this task.
979
+ minutes_between_retries : int, default 2
980
+ Number of minutes between retries.
956
981
  """
957
982
  ...
958
983
 
@@ -1034,165 +1059,162 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
1034
1059
  ...
1035
1060
 
1036
1061
  @typing.overload
1037
- 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]]]:
1062
+ def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1038
1063
  """
1039
- Specifies environment variables to be set prior to the execution of a step.
1064
+ Specifies a timeout for your step.
1065
+
1066
+ This decorator is useful if this step may hang indefinitely.
1067
+
1068
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1069
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1070
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1071
+
1072
+ Note that all the values specified in parameters are added together so if you specify
1073
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1040
1074
 
1041
1075
  Parameters
1042
1076
  ----------
1043
- vars : Dict[str, str], default {}
1044
- Dictionary of environment variables to set.
1077
+ seconds : int, default 0
1078
+ Number of seconds to wait prior to timing out.
1079
+ minutes : int, default 0
1080
+ Number of minutes to wait prior to timing out.
1081
+ hours : int, default 0
1082
+ Number of hours to wait prior to timing out.
1045
1083
  """
1046
1084
  ...
1047
1085
 
1048
1086
  @typing.overload
1049
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1087
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1050
1088
  ...
1051
1089
 
1052
1090
  @typing.overload
1053
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1091
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1054
1092
  ...
1055
1093
 
1056
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1094
+ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
1057
1095
  """
1058
- Specifies environment variables to be set prior to the execution of a step.
1096
+ Specifies a timeout for your step.
1059
1097
 
1060
- Parameters
1061
- ----------
1062
- vars : Dict[str, str], default {}
1063
- Dictionary of environment variables to set.
1064
- """
1065
- ...
1066
-
1067
- @typing.overload
1068
- 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]]]:
1069
- """
1070
- Creates a human-readable report, a Metaflow Card, after this step completes.
1098
+ This decorator is useful if this step may hang indefinitely.
1071
1099
 
1072
- Note that you may add multiple `@card` decorators in a step with different parameters.
1100
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1101
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1102
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1103
+
1104
+ Note that all the values specified in parameters are added together so if you specify
1105
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1073
1106
 
1074
1107
  Parameters
1075
1108
  ----------
1076
- type : str, default 'default'
1077
- Card type.
1078
- id : str, optional, default None
1079
- If multiple cards are present, use this id to identify this card.
1080
- options : Dict[str, Any], default {}
1081
- Options passed to the card. The contents depend on the card type.
1082
- timeout : int, default 45
1083
- Interrupt reporting if it takes more than this many seconds.
1084
-
1085
-
1109
+ seconds : int, default 0
1110
+ Number of seconds to wait prior to timing out.
1111
+ minutes : int, default 0
1112
+ Number of minutes to wait prior to timing out.
1113
+ hours : int, default 0
1114
+ Number of hours to wait prior to timing out.
1086
1115
  """
1087
1116
  ...
1088
1117
 
1089
1118
  @typing.overload
1090
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1091
- ...
1092
-
1093
- @typing.overload
1094
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1095
- ...
1096
-
1097
- 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):
1119
+ def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1098
1120
  """
1099
- Creates a human-readable report, a Metaflow Card, after this step completes.
1121
+ Specifies the flow(s) that this flow depends on.
1100
1122
 
1101
- Note that you may add multiple `@card` decorators in a step with different parameters.
1123
+ ```
1124
+ @trigger_on_finish(flow='FooFlow')
1125
+ ```
1126
+ or
1127
+ ```
1128
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1129
+ ```
1130
+ This decorator respects the @project decorator and triggers the flow
1131
+ when upstream runs within the same namespace complete successfully
1102
1132
 
1103
- Parameters
1104
- ----------
1105
- type : str, default 'default'
1106
- Card type.
1107
- id : str, optional, default None
1108
- If multiple cards are present, use this id to identify this card.
1109
- options : Dict[str, Any], default {}
1110
- Options passed to the card. The contents depend on the card type.
1111
- timeout : int, default 45
1112
- Interrupt reporting if it takes more than this many seconds.
1133
+ Additionally, you can specify project aware upstream flow dependencies
1134
+ by specifying the fully qualified project_flow_name.
1135
+ ```
1136
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1137
+ ```
1138
+ or
1139
+ ```
1140
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1141
+ ```
1113
1142
 
1143
+ You can also specify just the project or project branch (other values will be
1144
+ inferred from the current project or project branch):
1145
+ ```
1146
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1147
+ ```
1114
1148
 
1115
- """
1116
- ...
1117
-
1118
- @typing.overload
1119
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1120
- """
1121
- Specifies the PyPI packages for all steps of the flow.
1149
+ Note that `branch` is typically one of:
1150
+ - `prod`
1151
+ - `user.bob`
1152
+ - `test.my_experiment`
1153
+ - `prod.staging`
1122
1154
 
1123
- Use `@pypi_base` to set common packages required by all
1124
- steps and use `@pypi` to specify step-specific overrides.
1125
1155
  Parameters
1126
1156
  ----------
1127
- packages : Dict[str, str], default: {}
1128
- Packages to use for this flow. The key is the name of the package
1129
- and the value is the version to use.
1130
- python : str, optional, default: None
1131
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1132
- that the version used will correspond to the version of the Python interpreter used to start the run.
1157
+ flow : Union[str, Dict[str, str]], optional, default None
1158
+ Upstream flow dependency for this flow.
1159
+ flows : List[Union[str, Dict[str, str]]], default []
1160
+ Upstream flow dependencies for this flow.
1161
+ options : Dict[str, Any], default {}
1162
+ Backend-specific configuration for tuning eventing behavior.
1163
+
1164
+
1133
1165
  """
1134
1166
  ...
1135
1167
 
1136
1168
  @typing.overload
1137
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1169
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1138
1170
  ...
1139
1171
 
1140
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1172
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1141
1173
  """
1142
- Specifies the PyPI packages for all steps of the flow.
1174
+ Specifies the flow(s) that this flow depends on.
1143
1175
 
1144
- Use `@pypi_base` to set common packages required by all
1145
- steps and use `@pypi` to specify step-specific overrides.
1146
- Parameters
1147
- ----------
1148
- packages : Dict[str, str], default: {}
1149
- Packages to use for this flow. The key is the name of the package
1150
- and the value is the version to use.
1151
- python : str, optional, default: None
1152
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1153
- that the version used will correspond to the version of the Python interpreter used to start the run.
1154
- """
1155
- ...
1156
-
1157
- 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]]:
1158
- """
1159
- 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.
1160
- 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.
1176
+ ```
1177
+ @trigger_on_finish(flow='FooFlow')
1178
+ ```
1179
+ or
1180
+ ```
1181
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1182
+ ```
1183
+ This decorator respects the @project decorator and triggers the flow
1184
+ when upstream runs within the same namespace complete successfully
1185
+
1186
+ Additionally, you can specify project aware upstream flow dependencies
1187
+ by specifying the fully qualified project_flow_name.
1188
+ ```
1189
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1190
+ ```
1191
+ or
1192
+ ```
1193
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1194
+ ```
1195
+
1196
+ You can also specify just the project or project branch (other values will be
1197
+ inferred from the current project or project branch):
1198
+ ```
1199
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1200
+ ```
1201
+
1202
+ Note that `branch` is typically one of:
1203
+ - `prod`
1204
+ - `user.bob`
1205
+ - `test.my_experiment`
1206
+ - `prod.staging`
1161
1207
 
1162
1208
  Parameters
1163
1209
  ----------
1164
- timeout : int
1165
- Time, in seconds before the task times out and fails. (Default: 3600)
1166
- poke_interval : int
1167
- Time in seconds that the job should wait in between each try. (Default: 60)
1168
- mode : str
1169
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1170
- exponential_backoff : bool
1171
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1172
- pool : str
1173
- the slot pool this task should run in,
1174
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1175
- soft_fail : bool
1176
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1177
- name : str
1178
- Name of the sensor on Airflow
1179
- description : str
1180
- Description of sensor in the Airflow UI
1181
- external_dag_id : str
1182
- The dag_id that contains the task you want to wait for.
1183
- external_task_ids : List[str]
1184
- The list of task_ids that you want to wait for.
1185
- If None (default value) the sensor waits for the DAG. (Default: None)
1186
- allowed_states : List[str]
1187
- Iterable of allowed states, (Default: ['success'])
1188
- failed_states : List[str]
1189
- Iterable of failed or dis-allowed states. (Default: None)
1190
- execution_delta : datetime.timedelta
1191
- time difference with the previous execution to look at,
1192
- the default is the same logical date as the current task or DAG. (Default: None)
1193
- check_existence: bool
1194
- Set to True to check if the external task exists or check if
1195
- the DAG to wait for exists. (Default: True)
1210
+ flow : Union[str, Dict[str, str]], optional, default None
1211
+ Upstream flow dependency for this flow.
1212
+ flows : List[Union[str, Dict[str, str]]], default []
1213
+ Upstream flow dependencies for this flow.
1214
+ options : Dict[str, Any], default {}
1215
+ Backend-specific configuration for tuning eventing behavior.
1216
+
1217
+
1196
1218
  """
1197
1219
  ...
1198
1220
 
@@ -1238,24 +1260,6 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1238
1260
  """
1239
1261
  ...
1240
1262
 
1241
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1242
- """
1243
- Specifies what flows belong to the same project.
1244
-
1245
- A project-specific namespace is created for all flows that
1246
- use the same `@project(name)`.
1247
-
1248
- Parameters
1249
- ----------
1250
- name : str
1251
- Project name. Make sure that the name is unique amongst all
1252
- projects that use the same production scheduler. The name may
1253
- contain only lowercase alphanumeric characters and underscores.
1254
-
1255
-
1256
- """
1257
- ...
1258
-
1259
1263
  @typing.overload
1260
1264
  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]]:
1261
1265
  """
@@ -1305,101 +1309,6 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1305
1309
  """
1306
1310
  ...
1307
1311
 
1308
- @typing.overload
1309
- 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]]:
1310
- """
1311
- Specifies the event(s) that this flow depends on.
1312
-
1313
- ```
1314
- @trigger(event='foo')
1315
- ```
1316
- or
1317
- ```
1318
- @trigger(events=['foo', 'bar'])
1319
- ```
1320
-
1321
- Additionally, you can specify the parameter mappings
1322
- to map event payload to Metaflow parameters for the flow.
1323
- ```
1324
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1325
- ```
1326
- or
1327
- ```
1328
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1329
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1330
- ```
1331
-
1332
- 'parameters' can also be a list of strings and tuples like so:
1333
- ```
1334
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1335
- ```
1336
- This is equivalent to:
1337
- ```
1338
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1339
- ```
1340
-
1341
- Parameters
1342
- ----------
1343
- event : Union[str, Dict[str, Any]], optional, default None
1344
- Event dependency for this flow.
1345
- events : List[Union[str, Dict[str, Any]]], default []
1346
- Events dependency for this flow.
1347
- options : Dict[str, Any], default {}
1348
- Backend-specific configuration for tuning eventing behavior.
1349
-
1350
-
1351
- """
1352
- ...
1353
-
1354
- @typing.overload
1355
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1356
- ...
1357
-
1358
- 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] = {}):
1359
- """
1360
- Specifies the event(s) that this flow depends on.
1361
-
1362
- ```
1363
- @trigger(event='foo')
1364
- ```
1365
- or
1366
- ```
1367
- @trigger(events=['foo', 'bar'])
1368
- ```
1369
-
1370
- Additionally, you can specify the parameter mappings
1371
- to map event payload to Metaflow parameters for the flow.
1372
- ```
1373
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1374
- ```
1375
- or
1376
- ```
1377
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1378
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1379
- ```
1380
-
1381
- 'parameters' can also be a list of strings and tuples like so:
1382
- ```
1383
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1384
- ```
1385
- This is equivalent to:
1386
- ```
1387
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1388
- ```
1389
-
1390
- Parameters
1391
- ----------
1392
- event : Union[str, Dict[str, Any]], optional, default None
1393
- Event dependency for this flow.
1394
- events : List[Union[str, Dict[str, Any]]], default []
1395
- Events dependency for this flow.
1396
- options : Dict[str, Any], default {}
1397
- Backend-specific configuration for tuning eventing behavior.
1398
-
1399
-
1400
- """
1401
- ...
1402
-
1403
1312
  @typing.overload
1404
1313
  def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1405
1314
  """
@@ -1481,48 +1390,143 @@ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[Fl
1481
1390
  ...
1482
1391
 
1483
1392
  @typing.overload
1484
- def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1393
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1485
1394
  """
1486
- Specifies the flow(s) that this flow depends on.
1395
+ Specifies the PyPI packages for all steps of the flow.
1396
+
1397
+ Use `@pypi_base` to set common packages required by all
1398
+ steps and use `@pypi` to specify step-specific overrides.
1399
+ Parameters
1400
+ ----------
1401
+ packages : Dict[str, str], default: {}
1402
+ Packages to use for this flow. The key is the name of the package
1403
+ and the value is the version to use.
1404
+ python : str, optional, default: None
1405
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1406
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1407
+ """
1408
+ ...
1409
+
1410
+ @typing.overload
1411
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1412
+ ...
1413
+
1414
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1415
+ """
1416
+ Specifies the PyPI packages for all steps of the flow.
1417
+
1418
+ Use `@pypi_base` to set common packages required by all
1419
+ steps and use `@pypi` to specify step-specific overrides.
1420
+ Parameters
1421
+ ----------
1422
+ packages : Dict[str, str], default: {}
1423
+ Packages to use for this flow. The key is the name of the package
1424
+ and the value is the version to use.
1425
+ python : str, optional, default: None
1426
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1427
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1428
+ """
1429
+ ...
1430
+
1431
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1432
+ """
1433
+ Specifies what flows belong to the same project.
1434
+
1435
+ A project-specific namespace is created for all flows that
1436
+ use the same `@project(name)`.
1437
+
1438
+ Parameters
1439
+ ----------
1440
+ name : str
1441
+ Project name. Make sure that the name is unique amongst all
1442
+ projects that use the same production scheduler. The name may
1443
+ contain only lowercase alphanumeric characters and underscores.
1444
+
1445
+
1446
+ """
1447
+ ...
1448
+
1449
+ 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]]:
1450
+ """
1451
+ 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.
1452
+ 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.
1453
+
1454
+ Parameters
1455
+ ----------
1456
+ timeout : int
1457
+ Time, in seconds before the task times out and fails. (Default: 3600)
1458
+ poke_interval : int
1459
+ Time in seconds that the job should wait in between each try. (Default: 60)
1460
+ mode : str
1461
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1462
+ exponential_backoff : bool
1463
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1464
+ pool : str
1465
+ the slot pool this task should run in,
1466
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1467
+ soft_fail : bool
1468
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1469
+ name : str
1470
+ Name of the sensor on Airflow
1471
+ description : str
1472
+ Description of sensor in the Airflow UI
1473
+ external_dag_id : str
1474
+ The dag_id that contains the task you want to wait for.
1475
+ external_task_ids : List[str]
1476
+ The list of task_ids that you want to wait for.
1477
+ If None (default value) the sensor waits for the DAG. (Default: None)
1478
+ allowed_states : List[str]
1479
+ Iterable of allowed states, (Default: ['success'])
1480
+ failed_states : List[str]
1481
+ Iterable of failed or dis-allowed states. (Default: None)
1482
+ execution_delta : datetime.timedelta
1483
+ time difference with the previous execution to look at,
1484
+ the default is the same logical date as the current task or DAG. (Default: None)
1485
+ check_existence: bool
1486
+ Set to True to check if the external task exists or check if
1487
+ the DAG to wait for exists. (Default: True)
1488
+ """
1489
+ ...
1490
+
1491
+ @typing.overload
1492
+ 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]]:
1493
+ """
1494
+ Specifies the event(s) that this flow depends on.
1487
1495
 
1488
1496
  ```
1489
- @trigger_on_finish(flow='FooFlow')
1497
+ @trigger(event='foo')
1490
1498
  ```
1491
1499
  or
1492
1500
  ```
1493
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1501
+ @trigger(events=['foo', 'bar'])
1494
1502
  ```
1495
- This decorator respects the @project decorator and triggers the flow
1496
- when upstream runs within the same namespace complete successfully
1497
1503
 
1498
- Additionally, you can specify project aware upstream flow dependencies
1499
- by specifying the fully qualified project_flow_name.
1504
+ Additionally, you can specify the parameter mappings
1505
+ to map event payload to Metaflow parameters for the flow.
1500
1506
  ```
1501
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1507
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1502
1508
  ```
1503
1509
  or
1504
1510
  ```
1505
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1511
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1512
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1506
1513
  ```
1507
1514
 
1508
- You can also specify just the project or project branch (other values will be
1509
- inferred from the current project or project branch):
1515
+ 'parameters' can also be a list of strings and tuples like so:
1510
1516
  ```
1511
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1517
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1518
+ ```
1519
+ This is equivalent to:
1520
+ ```
1521
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1512
1522
  ```
1513
-
1514
- Note that `branch` is typically one of:
1515
- - `prod`
1516
- - `user.bob`
1517
- - `test.my_experiment`
1518
- - `prod.staging`
1519
1523
 
1520
1524
  Parameters
1521
1525
  ----------
1522
- flow : Union[str, Dict[str, str]], optional, default None
1523
- Upstream flow dependency for this flow.
1524
- flows : List[Union[str, Dict[str, str]]], default []
1525
- Upstream flow dependencies for this flow.
1526
+ event : Union[str, Dict[str, Any]], optional, default None
1527
+ Event dependency for this flow.
1528
+ events : List[Union[str, Dict[str, Any]]], default []
1529
+ Events dependency for this flow.
1526
1530
  options : Dict[str, Any], default {}
1527
1531
  Backend-specific configuration for tuning eventing behavior.
1528
1532
 
@@ -1531,51 +1535,47 @@ def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] =
1531
1535
  ...
1532
1536
 
1533
1537
  @typing.overload
1534
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1538
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1535
1539
  ...
1536
1540
 
1537
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1541
+ 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] = {}):
1538
1542
  """
1539
- Specifies the flow(s) that this flow depends on.
1543
+ Specifies the event(s) that this flow depends on.
1540
1544
 
1541
1545
  ```
1542
- @trigger_on_finish(flow='FooFlow')
1546
+ @trigger(event='foo')
1543
1547
  ```
1544
1548
  or
1545
1549
  ```
1546
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1550
+ @trigger(events=['foo', 'bar'])
1547
1551
  ```
1548
- This decorator respects the @project decorator and triggers the flow
1549
- when upstream runs within the same namespace complete successfully
1550
1552
 
1551
- Additionally, you can specify project aware upstream flow dependencies
1552
- by specifying the fully qualified project_flow_name.
1553
+ Additionally, you can specify the parameter mappings
1554
+ to map event payload to Metaflow parameters for the flow.
1553
1555
  ```
1554
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1556
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1555
1557
  ```
1556
1558
  or
1557
1559
  ```
1558
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1560
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1561
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1559
1562
  ```
1560
1563
 
1561
- You can also specify just the project or project branch (other values will be
1562
- inferred from the current project or project branch):
1564
+ 'parameters' can also be a list of strings and tuples like so:
1563
1565
  ```
1564
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1566
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1567
+ ```
1568
+ This is equivalent to:
1569
+ ```
1570
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1565
1571
  ```
1566
-
1567
- Note that `branch` is typically one of:
1568
- - `prod`
1569
- - `user.bob`
1570
- - `test.my_experiment`
1571
- - `prod.staging`
1572
1572
 
1573
1573
  Parameters
1574
1574
  ----------
1575
- flow : Union[str, Dict[str, str]], optional, default None
1576
- Upstream flow dependency for this flow.
1577
- flows : List[Union[str, Dict[str, str]]], default []
1578
- Upstream flow dependencies for this flow.
1575
+ event : Union[str, Dict[str, Any]], optional, default None
1576
+ Event dependency for this flow.
1577
+ events : List[Union[str, Dict[str, Any]]], default []
1578
+ Events dependency for this flow.
1579
1579
  options : Dict[str, Any], default {}
1580
1580
  Backend-specific configuration for tuning eventing behavior.
1581
1581