ob-metaflow-stubs 6.0.3.108__py2.py3-none-any.whl → 6.0.3.109rc1__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 +585 -550
  2. metaflow-stubs/cards.pyi +6 -6
  3. metaflow-stubs/cli.pyi +3 -3
  4. metaflow-stubs/client/__init__.pyi +3 -3
  5. metaflow-stubs/client/core.pyi +8 -8
  6. metaflow-stubs/client/filecache.pyi +3 -3
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +3 -3
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +5 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +3 -3
  13. metaflow-stubs/info_file.pyi +2 -2
  14. metaflow-stubs/metadata/metadata.pyi +3 -3
  15. metaflow-stubs/metadata/util.pyi +2 -2
  16. metaflow-stubs/metaflow_config.pyi +2 -2
  17. metaflow-stubs/metaflow_current.pyi +81 -47
  18. metaflow-stubs/mflog/mflog.pyi +2 -2
  19. metaflow-stubs/multicore_utils.pyi +2 -2
  20. metaflow-stubs/parameters.pyi +3 -3
  21. metaflow-stubs/plugins/__init__.pyi +3 -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 +4 -4
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  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 +4 -4
  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 +2 -2
  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 +4 -4
  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 +3 -3
  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 +3 -3
  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 +4 -4
  76. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  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 +6 -6
  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 +3 -3
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +4 -4
  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 +3 -3
  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 +4 -4
  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 +3 -3
  104. metaflow-stubs/plugins/perimeters.pyi +2 -2
  105. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  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 +4 -4
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
  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 +5 -5
  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 +3 -3
  126. metaflow-stubs/runner/metaflow_runner.pyi +5 -5
  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 +3 -3
  132. metaflow-stubs/system/system_logger.pyi +3 -3
  133. metaflow-stubs/system/system_monitor.pyi +2 -2
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. {ob_metaflow_stubs-6.0.3.108.dist-info → ob_metaflow_stubs-6.0.3.109rc1.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.109rc1.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.108.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.108.dist-info → ob_metaflow_stubs-6.0.3.109rc1.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.108.dist-info → ob_metaflow_stubs-6.0.3.109rc1.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.11);ob(v1) #
4
- # Generated on 2024-10-08T12:29:45.085886 #
3
+ # MF version: 2.12.25.1+obcheckpoint(0.0.13);ob(v1) #
4
+ # Generated on 2024-10-10T01:39:58.507568 #
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._vendor.click.types
12
11
  import metaflow.metaflow_current
12
+ import metaflow._vendor.click.types
13
+ import metaflow.events
13
14
  import metaflow.datastore.inputs
14
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
15
- import typing
16
15
  import metaflow.flowspec
16
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
17
17
  import datetime
18
+ import metaflow.client.core
18
19
  import metaflow.runner.metaflow_runner
20
+ import typing
19
21
  import metaflow.parameters
20
- import metaflow.events
21
- import metaflow.client.core
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -513,59 +513,101 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
513
513
  ...
514
514
 
515
515
  @typing.overload
516
- 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]]]:
516
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
517
517
  """
518
- Specifies a timeout for your step.
518
+ Decorator prototype for all step decorators. This function gets specialized
519
+ and imported for all decorators types by _import_plugin_decorators().
520
+ """
521
+ ...
522
+
523
+ @typing.overload
524
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
525
+ ...
526
+
527
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
528
+ """
529
+ Decorator prototype for all step decorators. This function gets specialized
530
+ and imported for all decorators types by _import_plugin_decorators().
531
+ """
532
+ ...
533
+
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]]]:
536
+ """
537
+ Specifies environment variables to be set prior to the execution of a step.
519
538
 
520
- This decorator is useful if this step may hang indefinitely.
539
+ Parameters
540
+ ----------
541
+ vars : Dict[str, str], default {}
542
+ Dictionary of environment variables to set.
543
+ """
544
+ ...
545
+
546
+ @typing.overload
547
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
548
+ ...
549
+
550
+ @typing.overload
551
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
552
+ ...
553
+
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] = {}):
555
+ """
556
+ Specifies environment variables to be set prior to the execution of a step.
521
557
 
522
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
523
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
524
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
558
+ Parameters
559
+ ----------
560
+ vars : Dict[str, str], default {}
561
+ Dictionary of environment variables to set.
562
+ """
563
+ ...
564
+
565
+ @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]]]:
567
+ """
568
+ Specifies the PyPI packages for the step.
525
569
 
526
- Note that all the values specified in parameters are added together so if you specify
527
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
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.
528
574
 
529
575
  Parameters
530
576
  ----------
531
- seconds : int, default 0
532
- Number of seconds to wait prior to timing out.
533
- minutes : int, default 0
534
- Number of minutes to wait prior to timing out.
535
- hours : int, default 0
536
- Number of hours to wait prior to timing out.
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.
537
583
  """
538
584
  ...
539
585
 
540
586
  @typing.overload
541
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
587
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
542
588
  ...
543
589
 
544
590
  @typing.overload
545
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
591
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
546
592
  ...
547
593
 
548
- 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):
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):
549
595
  """
550
- Specifies a timeout for your step.
551
-
552
- This decorator is useful if this step may hang indefinitely.
553
-
554
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
555
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
556
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
596
+ Specifies the PyPI packages for the step.
557
597
 
558
- Note that all the values specified in parameters are added together so if you specify
559
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
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.
560
602
 
561
603
  Parameters
562
604
  ----------
563
- seconds : int, default 0
564
- Number of seconds to wait prior to timing out.
565
- minutes : int, default 0
566
- Number of minutes to wait prior to timing out.
567
- hours : int, default 0
568
- Number of hours to wait prior to timing out.
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.
569
611
  """
570
612
  ...
571
613
 
@@ -636,177 +678,166 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
636
678
  ...
637
679
 
638
680
  @typing.overload
639
- 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]]]:
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]]]:
640
682
  """
641
- Specifies that the step will success under all circumstances.
642
-
643
- The decorator will create an optional artifact, specified by `var`, which
644
- contains the exception raised. You can use it to detect the presence
645
- of errors, indicating that all happy-path artifacts produced by the step
646
- are missing.
683
+ Specifies secrets to be retrieved and injected as environment variables prior to
684
+ the execution of a step.
647
685
 
648
686
  Parameters
649
687
  ----------
650
- var : str, optional, default None
651
- Name of the artifact in which to store the caught exception.
652
- If not specified, the exception is not stored.
653
- print_exception : bool, default True
654
- Determines whether or not the exception is printed to
655
- stdout when caught.
688
+ sources : List[Union[str, Dict[str, Any]]], default: []
689
+ List of secret specs, defining how the secrets are to be retrieved
656
690
  """
657
691
  ...
658
692
 
659
693
  @typing.overload
660
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
694
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
661
695
  ...
662
696
 
663
697
  @typing.overload
664
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
698
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
665
699
  ...
666
700
 
667
- 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):
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]]] = []):
668
702
  """
669
- Specifies that the step will success under all circumstances.
670
-
671
- The decorator will create an optional artifact, specified by `var`, which
672
- contains the exception raised. You can use it to detect the presence
673
- of errors, indicating that all happy-path artifacts produced by the step
674
- are missing.
703
+ Specifies secrets to be retrieved and injected as environment variables prior to
704
+ the execution of a step.
675
705
 
676
706
  Parameters
677
707
  ----------
678
- var : str, optional, default None
679
- Name of the artifact in which to store the caught exception.
680
- If not specified, the exception is not stored.
681
- print_exception : bool, default True
682
- Determines whether or not the exception is printed to
683
- stdout when caught.
708
+ sources : List[Union[str, Dict[str, Any]]], default: []
709
+ List of secret specs, defining how the secrets are to be retrieved
684
710
  """
685
711
  ...
686
712
 
687
713
  @typing.overload
688
- 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]]]:
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]]]:
689
715
  """
690
- Specifies the PyPI packages for the step.
716
+ Specifies the number of times the task corresponding
717
+ to a step needs to be retried.
691
718
 
692
- Information in this decorator will augment any
693
- attributes set in the `@pyi_base` flow-level decorator. Hence,
694
- you can use `@pypi_base` to set packages required by all
695
- steps and use `@pypi` to specify step-specific overrides.
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.
696
726
 
697
727
  Parameters
698
728
  ----------
699
- packages : Dict[str, str], default: {}
700
- Packages to use for this step. The key is the name of the package
701
- and the value is the version to use.
702
- python : str, optional, default: None
703
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
704
- that the version used will correspond to the version of the Python interpreter used to start the run.
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.
705
733
  """
706
734
  ...
707
735
 
708
736
  @typing.overload
709
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
737
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
710
738
  ...
711
739
 
712
740
  @typing.overload
713
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
741
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
714
742
  ...
715
743
 
716
- 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):
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):
717
745
  """
718
- Specifies the PyPI packages for the step.
746
+ Specifies the number of times the task corresponding
747
+ to a step needs to be retried.
719
748
 
720
- Information in this decorator will augment any
721
- attributes set in the `@pyi_base` flow-level decorator. Hence,
722
- you can use `@pypi_base` to set packages required by all
723
- steps and use `@pypi` to specify step-specific overrides.
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.
724
756
 
725
757
  Parameters
726
758
  ----------
727
- packages : Dict[str, str], default: {}
728
- Packages to use for this step. The key is the name of the package
729
- and the value is the version to use.
730
- python : str, optional, default: None
731
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
732
- that the version used will correspond to the version of the Python interpreter used to start the run.
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.
733
763
  """
734
764
  ...
735
765
 
736
766
  @typing.overload
737
- 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]]]:
767
+ 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]]]:
738
768
  """
739
- Specifies the resources needed when executing this step.
769
+ Specifies a timeout for your step.
740
770
 
741
- Use `@resources` to specify the resource requirements
742
- independently of the specific compute layer (`@batch`, `@kubernetes`).
771
+ This decorator is useful if this step may hang indefinitely.
743
772
 
744
- You can choose the compute layer on the command line by executing e.g.
745
- ```
746
- python myflow.py run --with batch
747
- ```
748
- or
749
- ```
750
- python myflow.py run --with kubernetes
751
- ```
752
- which executes the flow on the desired system using the
753
- requirements specified in `@resources`.
773
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
774
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
775
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
776
+
777
+ Note that all the values specified in parameters are added together so if you specify
778
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
754
779
 
755
780
  Parameters
756
781
  ----------
757
- cpu : int, default 1
758
- Number of CPUs required for this step.
759
- gpu : int, default 0
760
- Number of GPUs required for this step.
761
- disk : int, optional, default None
762
- Disk size (in MB) required for this step. Only applies on Kubernetes.
763
- memory : int, default 4096
764
- Memory size (in MB) required for this step.
765
- shared_memory : int, optional, default None
766
- The value for the size (in MiB) of the /dev/shm volume for this step.
767
- This parameter maps to the `--shm-size` option in Docker.
782
+ seconds : int, default 0
783
+ Number of seconds to wait prior to timing out.
784
+ minutes : int, default 0
785
+ Number of minutes to wait prior to timing out.
786
+ hours : int, default 0
787
+ Number of hours to wait prior to timing out.
768
788
  """
769
789
  ...
770
790
 
771
791
  @typing.overload
772
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
792
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
773
793
  ...
774
794
 
775
795
  @typing.overload
776
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
796
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
777
797
  ...
778
798
 
779
- 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):
799
+ 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):
780
800
  """
781
- Specifies the resources needed when executing this step.
801
+ Specifies a timeout for your step.
782
802
 
783
- Use `@resources` to specify the resource requirements
784
- independently of the specific compute layer (`@batch`, `@kubernetes`).
803
+ This decorator is useful if this step may hang indefinitely.
785
804
 
786
- You can choose the compute layer on the command line by executing e.g.
787
- ```
788
- python myflow.py run --with batch
789
- ```
790
- or
791
- ```
792
- python myflow.py run --with kubernetes
793
- ```
794
- which executes the flow on the desired system using the
795
- requirements specified in `@resources`.
805
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
806
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
807
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
808
+
809
+ Note that all the values specified in parameters are added together so if you specify
810
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
796
811
 
797
812
  Parameters
798
813
  ----------
799
- cpu : int, default 1
800
- Number of CPUs required for this step.
801
- gpu : int, default 0
802
- Number of GPUs required for this step.
803
- disk : int, optional, default None
804
- Disk size (in MB) required for this step. Only applies on Kubernetes.
805
- memory : int, default 4096
806
- Memory size (in MB) required for this step.
807
- shared_memory : int, optional, default None
808
- The value for the size (in MiB) of the /dev/shm volume for this step.
809
- This parameter maps to the `--shm-size` option in Docker.
814
+ seconds : int, default 0
815
+ Number of seconds to wait prior to timing out.
816
+ minutes : int, default 0
817
+ Number of minutes to wait prior to timing out.
818
+ hours : int, default 0
819
+ Number of hours to wait prior to timing out.
820
+ """
821
+ ...
822
+
823
+ @typing.overload
824
+ def huggingface_hub(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
825
+ """
826
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
827
+
828
+
829
+ """
830
+ ...
831
+
832
+ @typing.overload
833
+ def huggingface_hub(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
834
+ ...
835
+
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
+
810
841
  """
811
842
  ...
812
843
 
@@ -871,75 +902,6 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
871
902
  """
872
903
  ...
873
904
 
874
- @typing.overload
875
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
876
- """
877
- Internal decorator to support Fast bakery
878
- """
879
- ...
880
-
881
- @typing.overload
882
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
883
- ...
884
-
885
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
886
- """
887
- Internal decorator to support Fast bakery
888
- """
889
- ...
890
-
891
- @typing.overload
892
- 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]]]:
893
- """
894
- Specifies secrets to be retrieved and injected as environment variables prior to
895
- the execution of a step.
896
-
897
- Parameters
898
- ----------
899
- sources : List[Union[str, Dict[str, Any]]], default: []
900
- List of secret specs, defining how the secrets are to be retrieved
901
- """
902
- ...
903
-
904
- @typing.overload
905
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
906
- ...
907
-
908
- @typing.overload
909
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
910
- ...
911
-
912
- 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]]] = []):
913
- """
914
- Specifies secrets to be retrieved and injected as environment variables prior to
915
- the execution of a step.
916
-
917
- Parameters
918
- ----------
919
- sources : List[Union[str, Dict[str, Any]]], default: []
920
- List of secret specs, defining how the secrets are to be retrieved
921
- """
922
- ...
923
-
924
- @typing.overload
925
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
926
- """
927
- Decorator prototype for all step decorators. This function gets specialized
928
- and imported for all decorators types by _import_plugin_decorators().
929
- """
930
- ...
931
-
932
- @typing.overload
933
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
934
- ...
935
-
936
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
937
- """
938
- Decorator prototype for all step decorators. This function gets specialized
939
- and imported for all decorators types by _import_plugin_decorators().
940
- """
941
- ...
942
-
943
905
  @typing.overload
944
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]]]:
945
907
  """
@@ -998,147 +960,206 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
998
960
  ...
999
961
 
1000
962
  @typing.overload
1001
- 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]]]:
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]]]:
1002
964
  """
1003
- Specifies environment variables to be set prior to the execution of a step.
965
+ Specifies the resources needed when executing this step.
966
+
967
+ Use `@resources` to specify the resource requirements
968
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
969
+
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`.
1004
980
 
1005
981
  Parameters
1006
982
  ----------
1007
- vars : Dict[str, str], default {}
1008
- Dictionary of environment variables to set.
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.
1009
994
  """
1010
995
  ...
1011
996
 
1012
997
  @typing.overload
1013
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
998
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1014
999
  ...
1015
1000
 
1016
1001
  @typing.overload
1017
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1002
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1018
1003
  ...
1019
1004
 
1020
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
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):
1021
1006
  """
1022
- Specifies environment variables to be set prior to the execution of a step.
1007
+ Specifies the resources needed when executing this step.
1008
+
1009
+ Use `@resources` to specify the resource requirements
1010
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1011
+
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`.
1023
1022
 
1024
1023
  Parameters
1025
1024
  ----------
1026
- vars : Dict[str, str], default {}
1027
- Dictionary of environment variables to set.
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.
1028
1036
  """
1029
1037
  ...
1030
1038
 
1031
1039
  @typing.overload
1032
- 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]]]:
1040
+ 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]]]:
1033
1041
  """
1034
- Enables checkpointing for a step.
1042
+ Specifies that the step will success under all circumstances.
1035
1043
 
1044
+ The decorator will create an optional artifact, specified by `var`, which
1045
+ contains the exception raised. You can use it to detect the presence
1046
+ of errors, indicating that all happy-path artifacts produced by the step
1047
+ are missing.
1036
1048
 
1037
1049
  Parameters
1038
1050
  ----------
1039
- load_policy : str, default: "fresh"
1040
- The policy for loading the checkpoint. The following policies are supported:
1041
- - "eager": Loads the the latest available checkpoint within the namespace.
1042
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1043
- will be loaded at the start of the task.
1044
- - "none": Do not load any checkpoint
1045
- - "fresh": Loads the lastest checkpoint created within the running Task.
1046
- This mode helps loading checkpoints across various retry attempts of the same task.
1047
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1048
- created within the task will be loaded when the task is retries execution on failure.
1049
-
1050
- temp_dir_root : str, default: None
1051
- The root directory under which `current.checkpoint.directory` will be created.
1052
-
1053
-
1054
-
1051
+ var : str, optional, default None
1052
+ Name of the artifact in which to store the caught exception.
1053
+ If not specified, the exception is not stored.
1054
+ print_exception : bool, default True
1055
+ Determines whether or not the exception is printed to
1056
+ stdout when caught.
1055
1057
  """
1056
1058
  ...
1057
1059
 
1058
1060
  @typing.overload
1059
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1061
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1060
1062
  ...
1061
1063
 
1062
1064
  @typing.overload
1063
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1065
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1064
1066
  ...
1065
1067
 
1066
- 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):
1068
+ 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):
1067
1069
  """
1068
- Enables checkpointing for a step.
1070
+ Specifies that the step will success under all circumstances.
1069
1071
 
1072
+ The decorator will create an optional artifact, specified by `var`, which
1073
+ contains the exception raised. You can use it to detect the presence
1074
+ of errors, indicating that all happy-path artifacts produced by the step
1075
+ are missing.
1070
1076
 
1071
1077
  Parameters
1072
1078
  ----------
1073
- load_policy : str, default: "fresh"
1074
- The policy for loading the checkpoint. The following policies are supported:
1075
- - "eager": Loads the the latest available checkpoint within the namespace.
1076
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1077
- will be loaded at the start of the task.
1078
- - "none": Do not load any checkpoint
1079
- - "fresh": Loads the lastest checkpoint created within the running Task.
1080
- This mode helps loading checkpoints across various retry attempts of the same task.
1081
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1082
- created within the task will be loaded when the task is retries execution on failure.
1083
-
1084
- temp_dir_root : str, default: None
1085
- The root directory under which `current.checkpoint.directory` will be created.
1086
-
1087
-
1088
-
1079
+ var : str, optional, default None
1080
+ Name of the artifact in which to store the caught exception.
1081
+ If not specified, the exception is not stored.
1082
+ print_exception : bool, default True
1083
+ Determines whether or not the exception is printed to
1084
+ stdout when caught.
1089
1085
  """
1090
1086
  ...
1091
1087
 
1092
1088
  @typing.overload
1093
- 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]]]:
1089
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1094
1090
  """
1095
- Specifies the number of times the task corresponding
1096
- to a step needs to be retried.
1097
-
1098
- This decorator is useful for handling transient errors, such as networking issues.
1099
- If your task contains operations that can't be retried safely, e.g. database updates,
1100
- it is advisable to annotate it with `@retry(times=0)`.
1091
+ Internal decorator to support Fast bakery
1092
+ """
1093
+ ...
1094
+
1095
+ @typing.overload
1096
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1097
+ ...
1098
+
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
+ """
1103
+ ...
1104
+
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]]]:
1107
+ """
1108
+ Enables checkpointing for a step.
1101
1109
 
1102
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1103
- decorator will execute a no-op task after all retries have been exhausted,
1104
- ensuring that the flow execution can continue.
1105
1110
 
1106
1111
  Parameters
1107
1112
  ----------
1108
- times : int, default 3
1109
- Number of times to retry this task.
1110
- minutes_between_retries : int, default 2
1111
- Number of minutes between retries.
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
+
1112
1129
  """
1113
1130
  ...
1114
1131
 
1115
1132
  @typing.overload
1116
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1133
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1117
1134
  ...
1118
1135
 
1119
1136
  @typing.overload
1120
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1137
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1121
1138
  ...
1122
1139
 
1123
- 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):
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):
1124
1141
  """
1125
- Specifies the number of times the task corresponding
1126
- to a step needs to be retried.
1142
+ Enables checkpointing for a step.
1127
1143
 
1128
- This decorator is useful for handling transient errors, such as networking issues.
1129
- If your task contains operations that can't be retried safely, e.g. database updates,
1130
- it is advisable to annotate it with `@retry(times=0)`.
1131
-
1132
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1133
- decorator will execute a no-op task after all retries have been exhausted,
1134
- ensuring that the flow execution can continue.
1135
1144
 
1136
1145
  Parameters
1137
1146
  ----------
1138
- times : int, default 3
1139
- Number of times to retry this task.
1140
- minutes_between_retries : int, default 2
1141
- Number of minutes between retries.
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
+
1142
1163
  """
1143
1164
  ...
1144
1165
 
@@ -1193,141 +1214,105 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
1193
1214
  """
1194
1215
  ...
1195
1216
 
1196
- @typing.overload
1197
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1217
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1198
1218
  """
1199
- Specifies the PyPI packages for all steps of the flow.
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)`.
1200
1223
 
1201
- Use `@pypi_base` to set common packages required by all
1202
- steps and use `@pypi` to specify step-specific overrides.
1203
1224
  Parameters
1204
1225
  ----------
1205
- packages : Dict[str, str], default: {}
1206
- Packages to use for this flow. The key is the name of the package
1207
- and the value is the version to use.
1208
- python : str, optional, default: None
1209
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1210
- that the version used will correspond to the version of the Python interpreter used to start the run.
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
+
1211
1232
  """
1212
1233
  ...
1213
1234
 
1214
- @typing.overload
1215
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1216
- ...
1217
-
1218
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
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]]:
1219
1236
  """
1220
- Specifies the PyPI packages for all steps of the flow.
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.
1221
1242
 
1222
- Use `@pypi_base` to set common packages required by all
1223
- steps and use `@pypi` to specify step-specific overrides.
1224
1243
  Parameters
1225
1244
  ----------
1226
- packages : Dict[str, str], default: {}
1227
- Packages to use for this flow. The key is the name of the package
1228
- and the value is the version to use.
1229
- python : str, optional, default: None
1230
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1231
- that the version used will correspond to the version of the Python interpreter used to start the run.
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)
1232
1274
  """
1233
1275
  ...
1234
1276
 
1235
1277
  @typing.overload
1236
- 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]]:
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]]:
1237
1279
  """
1238
- Specifies the flow(s) that this flow depends on.
1239
-
1240
- ```
1241
- @trigger_on_finish(flow='FooFlow')
1242
- ```
1243
- or
1244
- ```
1245
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1246
- ```
1247
- This decorator respects the @project decorator and triggers the flow
1248
- when upstream runs within the same namespace complete successfully
1280
+ Specifies the event(s) that this flow depends on.
1249
1281
 
1250
- Additionally, you can specify project aware upstream flow dependencies
1251
- by specifying the fully qualified project_flow_name.
1252
1282
  ```
1253
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1283
+ @trigger(event='foo')
1254
1284
  ```
1255
1285
  or
1256
1286
  ```
1257
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1258
- ```
1259
-
1260
- You can also specify just the project or project branch (other values will be
1261
- inferred from the current project or project branch):
1262
- ```
1263
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1287
+ @trigger(events=['foo', 'bar'])
1264
1288
  ```
1265
1289
 
1266
- Note that `branch` is typically one of:
1267
- - `prod`
1268
- - `user.bob`
1269
- - `test.my_experiment`
1270
- - `prod.staging`
1271
-
1272
- Parameters
1273
- ----------
1274
- flow : Union[str, Dict[str, str]], optional, default None
1275
- Upstream flow dependency for this flow.
1276
- flows : List[Union[str, Dict[str, str]]], default []
1277
- Upstream flow dependencies for this flow.
1278
- options : Dict[str, Any], default {}
1279
- Backend-specific configuration for tuning eventing behavior.
1280
-
1281
-
1282
- """
1283
- ...
1284
-
1285
- @typing.overload
1286
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1287
- ...
1288
-
1289
- 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] = {}):
1290
- """
1291
- Specifies the flow(s) that this flow depends on.
1292
-
1290
+ Additionally, you can specify the parameter mappings
1291
+ to map event payload to Metaflow parameters for the flow.
1293
1292
  ```
1294
- @trigger_on_finish(flow='FooFlow')
1293
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1295
1294
  ```
1296
1295
  or
1297
1296
  ```
1298
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1297
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1298
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1299
1299
  ```
1300
- This decorator respects the @project decorator and triggers the flow
1301
- when upstream runs within the same namespace complete successfully
1302
1300
 
1303
- Additionally, you can specify project aware upstream flow dependencies
1304
- by specifying the fully qualified project_flow_name.
1305
- ```
1306
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1307
- ```
1308
- or
1301
+ 'parameters' can also be a list of strings and tuples like so:
1309
1302
  ```
1310
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1303
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1311
1304
  ```
1312
-
1313
- You can also specify just the project or project branch (other values will be
1314
- inferred from the current project or project branch):
1305
+ This is equivalent to:
1315
1306
  ```
1316
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1307
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1317
1308
  ```
1318
1309
 
1319
- Note that `branch` is typically one of:
1320
- - `prod`
1321
- - `user.bob`
1322
- - `test.my_experiment`
1323
- - `prod.staging`
1324
-
1325
1310
  Parameters
1326
1311
  ----------
1327
- flow : Union[str, Dict[str, str]], optional, default None
1328
- Upstream flow dependency for this flow.
1329
- flows : List[Union[str, Dict[str, str]]], default []
1330
- Upstream flow dependencies for this flow.
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.
1331
1316
  options : Dict[str, Any], default {}
1332
1317
  Backend-specific configuration for tuning eventing behavior.
1333
1318
 
@@ -1336,7 +1321,10 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1336
1321
  ...
1337
1322
 
1338
1323
  @typing.overload
1339
- 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]]:
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] = {}):
1340
1328
  """
1341
1329
  Specifies the event(s) that this flow depends on.
1342
1330
 
@@ -1381,52 +1369,94 @@ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = No
1381
1369
  """
1382
1370
  ...
1383
1371
 
1384
- @typing.overload
1385
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
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)
1411
+ """
1386
1412
  ...
1387
1413
 
1388
- 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] = {}):
1414
+ @typing.overload
1415
+ 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]]:
1389
1416
  """
1390
- Specifies the event(s) that this flow depends on.
1417
+ Specifies the Conda environment for all steps of the flow.
1391
1418
 
1392
- ```
1393
- @trigger(event='foo')
1394
- ```
1395
- or
1396
- ```
1397
- @trigger(events=['foo', 'bar'])
1398
- ```
1419
+ Use `@conda_base` to set common libraries required by all
1420
+ steps and use `@conda` to specify step-specific additions.
1399
1421
 
1400
- Additionally, you can specify the parameter mappings
1401
- to map event payload to Metaflow parameters for the flow.
1402
- ```
1403
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1404
- ```
1405
- or
1406
- ```
1407
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1408
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1409
- ```
1422
+ Parameters
1423
+ ----------
1424
+ packages : Dict[str, str], default {}
1425
+ Packages to use for this flow. The key is the name of the package
1426
+ and the value is the version to use.
1427
+ libraries : Dict[str, str], default {}
1428
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1429
+ python : str, optional, default None
1430
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1431
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1432
+ disabled : bool, default False
1433
+ If set to True, disables Conda.
1434
+ """
1435
+ ...
1436
+
1437
+ @typing.overload
1438
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1439
+ ...
1440
+
1441
+ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1442
+ """
1443
+ Specifies the Conda environment for all steps of the flow.
1410
1444
 
1411
- 'parameters' can also be a list of strings and tuples like so:
1412
- ```
1413
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1414
- ```
1415
- This is equivalent to:
1416
- ```
1417
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1418
- ```
1445
+ Use `@conda_base` to set common libraries required by all
1446
+ steps and use `@conda` to specify step-specific additions.
1419
1447
 
1420
1448
  Parameters
1421
1449
  ----------
1422
- event : Union[str, Dict[str, Any]], optional, default None
1423
- Event dependency for this flow.
1424
- events : List[Union[str, Dict[str, Any]]], default []
1425
- Events dependency for this flow.
1426
- options : Dict[str, Any], default {}
1427
- Backend-specific configuration for tuning eventing behavior.
1428
-
1429
-
1450
+ packages : Dict[str, str], default {}
1451
+ Packages to use for this flow. The key is the name of the package
1452
+ and the value is the version to use.
1453
+ libraries : Dict[str, str], default {}
1454
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1455
+ python : str, optional, default None
1456
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1457
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1458
+ disabled : bool, default False
1459
+ If set to True, disables Conda.
1430
1460
  """
1431
1461
  ...
1432
1462
 
@@ -1461,24 +1491,6 @@ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[Fl
1461
1491
  """
1462
1492
  ...
1463
1493
 
1464
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1465
- """
1466
- Specifies what flows belong to the same project.
1467
-
1468
- A project-specific namespace is created for all flows that
1469
- use the same `@project(name)`.
1470
-
1471
- Parameters
1472
- ----------
1473
- name : str
1474
- Project name. Make sure that the name is unique amongst all
1475
- projects that use the same production scheduler. The name may
1476
- contain only lowercase alphanumeric characters and underscores.
1477
-
1478
-
1479
- """
1480
- ...
1481
-
1482
1494
  @typing.overload
1483
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]]:
1484
1496
  """
@@ -1528,136 +1540,145 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1528
1540
  """
1529
1541
  ...
1530
1542
 
1531
- 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]]:
1543
+ @typing.overload
1544
+ 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]]:
1532
1545
  """
1533
- 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.
1534
- 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.
1546
+ Specifies the flow(s) that this flow depends on.
1547
+
1548
+ ```
1549
+ @trigger_on_finish(flow='FooFlow')
1550
+ ```
1551
+ or
1552
+ ```
1553
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1554
+ ```
1555
+ This decorator respects the @project decorator and triggers the flow
1556
+ when upstream runs within the same namespace complete successfully
1557
+
1558
+ Additionally, you can specify project aware upstream flow dependencies
1559
+ by specifying the fully qualified project_flow_name.
1560
+ ```
1561
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1562
+ ```
1563
+ or
1564
+ ```
1565
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1566
+ ```
1567
+
1568
+ You can also specify just the project or project branch (other values will be
1569
+ inferred from the current project or project branch):
1570
+ ```
1571
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1572
+ ```
1573
+
1574
+ Note that `branch` is typically one of:
1575
+ - `prod`
1576
+ - `user.bob`
1577
+ - `test.my_experiment`
1578
+ - `prod.staging`
1535
1579
 
1536
1580
  Parameters
1537
1581
  ----------
1538
- timeout : int
1539
- Time, in seconds before the task times out and fails. (Default: 3600)
1540
- poke_interval : int
1541
- Time in seconds that the job should wait in between each try. (Default: 60)
1542
- mode : str
1543
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1544
- exponential_backoff : bool
1545
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1546
- pool : str
1547
- the slot pool this task should run in,
1548
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1549
- soft_fail : bool
1550
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1551
- name : str
1552
- Name of the sensor on Airflow
1553
- description : str
1554
- Description of sensor in the Airflow UI
1555
- external_dag_id : str
1556
- The dag_id that contains the task you want to wait for.
1557
- external_task_ids : List[str]
1558
- The list of task_ids that you want to wait for.
1559
- If None (default value) the sensor waits for the DAG. (Default: None)
1560
- allowed_states : List[str]
1561
- Iterable of allowed states, (Default: ['success'])
1562
- failed_states : List[str]
1563
- Iterable of failed or dis-allowed states. (Default: None)
1564
- execution_delta : datetime.timedelta
1565
- time difference with the previous execution to look at,
1566
- the default is the same logical date as the current task or DAG. (Default: None)
1567
- check_existence: bool
1568
- Set to True to check if the external task exists or check if
1569
- the DAG to wait for exists. (Default: True)
1582
+ flow : Union[str, Dict[str, str]], optional, default None
1583
+ Upstream flow dependency for this flow.
1584
+ flows : List[Union[str, Dict[str, str]]], default []
1585
+ Upstream flow dependencies for this flow.
1586
+ options : Dict[str, Any], default {}
1587
+ Backend-specific configuration for tuning eventing behavior.
1588
+
1589
+
1570
1590
  """
1571
1591
  ...
1572
1592
 
1573
- 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]]:
1593
+ @typing.overload
1594
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1595
+ ...
1596
+
1597
+ 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] = {}):
1574
1598
  """
1575
- 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)
1576
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1577
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1578
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1579
- starts only after all sensors finish.
1599
+ Specifies the flow(s) that this flow depends on.
1600
+
1601
+ ```
1602
+ @trigger_on_finish(flow='FooFlow')
1603
+ ```
1604
+ or
1605
+ ```
1606
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1607
+ ```
1608
+ This decorator respects the @project decorator and triggers the flow
1609
+ when upstream runs within the same namespace complete successfully
1610
+
1611
+ Additionally, you can specify project aware upstream flow dependencies
1612
+ by specifying the fully qualified project_flow_name.
1613
+ ```
1614
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1615
+ ```
1616
+ or
1617
+ ```
1618
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1619
+ ```
1620
+
1621
+ You can also specify just the project or project branch (other values will be
1622
+ inferred from the current project or project branch):
1623
+ ```
1624
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1625
+ ```
1626
+
1627
+ Note that `branch` is typically one of:
1628
+ - `prod`
1629
+ - `user.bob`
1630
+ - `test.my_experiment`
1631
+ - `prod.staging`
1580
1632
 
1581
1633
  Parameters
1582
1634
  ----------
1583
- timeout : int
1584
- Time, in seconds before the task times out and fails. (Default: 3600)
1585
- poke_interval : int
1586
- Time in seconds that the job should wait in between each try. (Default: 60)
1587
- mode : str
1588
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1589
- exponential_backoff : bool
1590
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1591
- pool : str
1592
- the slot pool this task should run in,
1593
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1594
- soft_fail : bool
1595
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1596
- name : str
1597
- Name of the sensor on Airflow
1598
- description : str
1599
- Description of sensor in the Airflow UI
1600
- bucket_key : Union[str, List[str]]
1601
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1602
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1603
- bucket_name : str
1604
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1605
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1606
- wildcard_match : bool
1607
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1608
- aws_conn_id : str
1609
- a reference to the s3 connection on Airflow. (Default: None)
1610
- verify : bool
1611
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1635
+ flow : Union[str, Dict[str, str]], optional, default None
1636
+ Upstream flow dependency for this flow.
1637
+ flows : List[Union[str, Dict[str, str]]], default []
1638
+ Upstream flow dependencies for this flow.
1639
+ options : Dict[str, Any], default {}
1640
+ Backend-specific configuration for tuning eventing behavior.
1641
+
1642
+
1612
1643
  """
1613
1644
  ...
1614
1645
 
1615
1646
  @typing.overload
1616
- 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]]:
1647
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1617
1648
  """
1618
- Specifies the Conda environment for all steps of the flow.
1619
-
1620
- Use `@conda_base` to set common libraries required by all
1621
- steps and use `@conda` to specify step-specific additions.
1649
+ Specifies the PyPI packages for all steps of the flow.
1622
1650
 
1651
+ Use `@pypi_base` to set common packages required by all
1652
+ steps and use `@pypi` to specify step-specific overrides.
1623
1653
  Parameters
1624
1654
  ----------
1625
- packages : Dict[str, str], default {}
1655
+ packages : Dict[str, str], default: {}
1626
1656
  Packages to use for this flow. The key is the name of the package
1627
1657
  and the value is the version to use.
1628
- libraries : Dict[str, str], default {}
1629
- Supported for backward compatibility. When used with packages, packages will take precedence.
1630
- python : str, optional, default None
1658
+ python : str, optional, default: None
1631
1659
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1632
1660
  that the version used will correspond to the version of the Python interpreter used to start the run.
1633
- disabled : bool, default False
1634
- If set to True, disables Conda.
1635
1661
  """
1636
1662
  ...
1637
1663
 
1638
1664
  @typing.overload
1639
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1665
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1640
1666
  ...
1641
1667
 
1642
- def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1668
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1643
1669
  """
1644
- Specifies the Conda environment for all steps of the flow.
1645
-
1646
- Use `@conda_base` to set common libraries required by all
1647
- steps and use `@conda` to specify step-specific additions.
1670
+ Specifies the PyPI packages for all steps of the flow.
1648
1671
 
1672
+ Use `@pypi_base` to set common packages required by all
1673
+ steps and use `@pypi` to specify step-specific overrides.
1649
1674
  Parameters
1650
1675
  ----------
1651
- packages : Dict[str, str], default {}
1676
+ packages : Dict[str, str], default: {}
1652
1677
  Packages to use for this flow. The key is the name of the package
1653
1678
  and the value is the version to use.
1654
- libraries : Dict[str, str], default {}
1655
- Supported for backward compatibility. When used with packages, packages will take precedence.
1656
- python : str, optional, default None
1679
+ python : str, optional, default: None
1657
1680
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1658
1681
  that the version used will correspond to the version of the Python interpreter used to start the run.
1659
- disabled : bool, default False
1660
- If set to True, disables Conda.
1661
1682
  """
1662
1683
  ...
1663
1684
 
@@ -3107,20 +3128,35 @@ class Checkpoint(object, metaclass=type):
3107
3128
  @property
3108
3129
  def directory(self):
3109
3130
  ...
3110
- def save(self, path = None, metadata = None, latest = True, name = "mfchckpt"):
3131
+ def save(self, path = None, metadata = None, latest = True, name = "mfchckpt", storage_format = "files"):
3111
3132
  """
3112
- saves the checkpoint to the datastore (resemble's a create op)
3133
+ Saves the checkpoint to the datastore
3113
3134
 
3114
3135
  Parameters
3115
3136
  ----------
3137
+ path : Optional[Union[str, os.PathLike]], default: None
3138
+ The path to save the checkpoint. Accepts a file path or a directory path.
3139
+ - If a directory path is provided, all the contents within that directory will be saved.
3140
+ When a checkpoint is reloaded during task retries, `the current.checkpoint.directory` will
3141
+ contain the contents of this directory.
3142
+ - If a file path is provided, the file will be directly saved to the datastore (with the same filename).
3143
+ When the checkpoint is reloaded during task retries, the file with the same name will be available in the
3144
+ `current.checkpoint.directory`.
3145
+ - If no path is provided then the `Checkpoint.directory` will be saved as the checkpoint.
3116
3146
 
3117
- - `path` (str or os.PathLike):
3118
- - path to directory
3119
- - path to file
3120
- - `name`:
3121
- - name of the checkpoint
3122
- - `metadata`:
3123
- - metadata of the checkpoint
3147
+ name : Optional[str], default: "mfchckpt"
3148
+ The name of the checkpoint.
3149
+
3150
+ metadata : Optional[Dict], default: {}
3151
+ Any metadata that needs to be saved with the checkpoint.
3152
+
3153
+ latest : bool, default: True
3154
+ If True, the checkpoint will be marked as the latest checkpoint.
3155
+ This helps determine if the checkpoint gets loaded when the task restarts.
3156
+
3157
+ storage_format : str, default: files
3158
+ If `tar`, the contents of the directory will be tarred before saving to the datastore.
3159
+ If `files`, saves directory directly to the datastore.
3124
3160
  """
3125
3161
  ...
3126
3162
  def __enter__(self):
@@ -3138,7 +3174,6 @@ class Checkpoint(object, metaclass=type):
3138
3174
  ```python
3139
3175
 
3140
3176
  Checkpoint().list(name="best") # lists checkpoints in the current task with the name "best"
3141
- Checkpoint().list(name="best", task="anotherflow/somerunid/somestep/sometask") # lists checkpoints in the another task with the name "best"
3142
3177
  Checkpoint().list(task="anotherflow/somerunid/somestep/sometask", name="best") # Identical as the above one but
3143
3178
  Checkpoint().list() # lists all the checkpoints in the current task
3144
3179