ob-metaflow-stubs 6.0.3.108__py2.py3-none-any.whl → 6.0.3.109__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 +494 -494
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +3 -3
  4. metaflow-stubs/client/__init__.pyi +4 -4
  5. metaflow-stubs/client/core.pyi +7 -7
  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 +5 -5
  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 +4 -2
  17. metaflow-stubs/metaflow_current.pyi +85 -85
  18. metaflow-stubs/mflog/mflog.pyi +2 -2
  19. metaflow-stubs/multicore_utils.pyi +2 -2
  20. metaflow-stubs/parameters.pyi +4 -4
  21. metaflow-stubs/plugins/__init__.pyi +5 -3
  22. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  24. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  31. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +131 -3
  36. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  37. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +6 -3
  52. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  59. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  60. metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
  61. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  62. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
  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 +3 -3
  76. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  77. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +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 +2 -2
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  88. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  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 +3 -3
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  101. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  102. metaflow-stubs/plugins/package_cli.pyi +2 -2
  103. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  104. metaflow-stubs/plugins/perimeters.pyi +2 -2
  105. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  106. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  112. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  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 +20 -4
  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 +2 -2
  133. metaflow-stubs/system/system_monitor.pyi +3 -3
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. {ob_metaflow_stubs-6.0.3.108.dist-info → ob_metaflow_stubs-6.0.3.109.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.109.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.109.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.108.dist-info → ob_metaflow_stubs-6.0.3.109.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.2+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-15T21:29:55.306291 #
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
11
+ import metaflow.flowspec
12
12
  import metaflow.metaflow_current
13
13
  import metaflow.datastore.inputs
14
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
15
14
  import typing
16
- import metaflow.flowspec
17
- import datetime
15
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
16
+ import metaflow.client.core
17
+ import metaflow.events
18
18
  import metaflow.runner.metaflow_runner
19
19
  import metaflow.parameters
20
- import metaflow.events
21
- import metaflow.client.core
20
+ import metaflow._vendor.click.types
21
+ import datetime
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -513,59 +513,111 @@ 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.
519
-
520
- This decorator is useful if this step may hang indefinitely.
521
-
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.
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 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]]]:
536
+ """
537
+ Specifies the Conda environment for the step.
525
538
 
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.
539
+ Information in this decorator will augment any
540
+ attributes set in the `@conda_base` flow-level decorator. Hence,
541
+ you can use `@conda_base` to set packages required by all
542
+ steps and use `@conda` to specify step-specific overrides.
528
543
 
529
544
  Parameters
530
545
  ----------
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.
546
+ packages : Dict[str, str], default {}
547
+ Packages to use for this step. The key is the name of the package
548
+ and the value is the version to use.
549
+ libraries : Dict[str, str], default {}
550
+ Supported for backward compatibility. When used with packages, packages will take precedence.
551
+ python : str, optional, default None
552
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
553
+ that the version used will correspond to the version of the Python interpreter used to start the run.
554
+ disabled : bool, default False
555
+ If set to True, disables @conda.
537
556
  """
538
557
  ...
539
558
 
540
559
  @typing.overload
541
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
560
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
542
561
  ...
543
562
 
544
563
  @typing.overload
545
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
564
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
546
565
  ...
547
566
 
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):
567
+ 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):
549
568
  """
550
- Specifies a timeout for your step.
569
+ Specifies the Conda environment for the step.
551
570
 
552
- This decorator is useful if this step may hang indefinitely.
571
+ Information in this decorator will augment any
572
+ attributes set in the `@conda_base` flow-level decorator. Hence,
573
+ you can use `@conda_base` to set packages required by all
574
+ steps and use `@conda` to specify step-specific overrides.
553
575
 
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.
576
+ Parameters
577
+ ----------
578
+ packages : Dict[str, str], default {}
579
+ Packages to use for this step. The key is the name of the package
580
+ and the value is the version to use.
581
+ libraries : Dict[str, str], default {}
582
+ Supported for backward compatibility. When used with packages, packages will take precedence.
583
+ python : str, optional, default None
584
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
585
+ that the version used will correspond to the version of the Python interpreter used to start the run.
586
+ disabled : bool, default False
587
+ If set to True, disables @conda.
588
+ """
589
+ ...
590
+
591
+ @typing.overload
592
+ 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]]]:
593
+ """
594
+ Specifies secrets to be retrieved and injected as environment variables prior to
595
+ the execution of a step.
557
596
 
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.
597
+ Parameters
598
+ ----------
599
+ sources : List[Union[str, Dict[str, Any]]], default: []
600
+ List of secret specs, defining how the secrets are to be retrieved
601
+ """
602
+ ...
603
+
604
+ @typing.overload
605
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
606
+ ...
607
+
608
+ @typing.overload
609
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
610
+ ...
611
+
612
+ 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]]] = []):
613
+ """
614
+ Specifies secrets to be retrieved and injected as environment variables prior to
615
+ the execution of a step.
560
616
 
561
617
  Parameters
562
618
  ----------
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.
619
+ sources : List[Union[str, Dict[str, Any]]], default: []
620
+ List of secret specs, defining how the secrets are to be retrieved
569
621
  """
570
622
  ...
571
623
 
@@ -685,187 +737,108 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
685
737
  ...
686
738
 
687
739
  @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]]]:
740
+ 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]]]:
689
741
  """
690
- Specifies the PyPI packages for the step.
742
+ Specifies a timeout for your step.
691
743
 
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.
744
+ This decorator is useful if this step may hang indefinitely.
745
+
746
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
747
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
748
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
749
+
750
+ Note that all the values specified in parameters are added together so if you specify
751
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
696
752
 
697
753
  Parameters
698
754
  ----------
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.
755
+ seconds : int, default 0
756
+ Number of seconds to wait prior to timing out.
757
+ minutes : int, default 0
758
+ Number of minutes to wait prior to timing out.
759
+ hours : int, default 0
760
+ Number of hours to wait prior to timing out.
705
761
  """
706
762
  ...
707
763
 
708
764
  @typing.overload
709
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
765
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
710
766
  ...
711
767
 
712
768
  @typing.overload
713
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
769
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
714
770
  ...
715
771
 
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):
772
+ 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):
717
773
  """
718
- Specifies the PyPI packages for the step.
774
+ Specifies a timeout for your step.
719
775
 
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.
776
+ This decorator is useful if this step may hang indefinitely.
777
+
778
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
779
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
780
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
781
+
782
+ Note that all the values specified in parameters are added together so if you specify
783
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
724
784
 
725
785
  Parameters
726
786
  ----------
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.
787
+ seconds : int, default 0
788
+ Number of seconds to wait prior to timing out.
789
+ minutes : int, default 0
790
+ Number of minutes to wait prior to timing out.
791
+ hours : int, default 0
792
+ Number of hours to wait prior to timing out.
733
793
  """
734
794
  ...
735
795
 
736
796
  @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]]]:
797
+ 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]]]:
738
798
  """
739
- Specifies the resources needed when executing this step.
740
-
741
- Use `@resources` to specify the resource requirements
742
- independently of the specific compute layer (`@batch`, `@kubernetes`).
799
+ Creates a human-readable report, a Metaflow Card, after this step completes.
743
800
 
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`.
801
+ Note that you may add multiple `@card` decorators in a step with different parameters.
754
802
 
755
803
  Parameters
756
804
  ----------
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.
805
+ type : str, default 'default'
806
+ Card type.
807
+ id : str, optional, default None
808
+ If multiple cards are present, use this id to identify this card.
809
+ options : Dict[str, Any], default {}
810
+ Options passed to the card. The contents depend on the card type.
811
+ timeout : int, default 45
812
+ Interrupt reporting if it takes more than this many seconds.
813
+
814
+
768
815
  """
769
816
  ...
770
817
 
771
818
  @typing.overload
772
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
819
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
773
820
  ...
774
821
 
775
822
  @typing.overload
776
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
823
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
777
824
  ...
778
825
 
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):
826
+ 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):
780
827
  """
781
- Specifies the resources needed when executing this step.
782
-
783
- Use `@resources` to specify the resource requirements
784
- independently of the specific compute layer (`@batch`, `@kubernetes`).
828
+ Creates a human-readable report, a Metaflow Card, after this step completes.
785
829
 
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`.
830
+ Note that you may add multiple `@card` decorators in a step with different parameters.
796
831
 
797
832
  Parameters
798
833
  ----------
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.
810
- """
811
- ...
812
-
813
- @typing.overload
814
- 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]]]:
815
- """
816
- Enables loading / saving of models within a step.
817
-
818
-
819
- Parameters
820
- ----------
821
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
822
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
823
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
824
- - `current.checkpoint`
825
- - `current.model`
826
- - `current.huggingface_hub`
827
-
828
- 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
829
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
830
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
831
-
832
- temp_dir_root : str, default: None
833
- The root directory under which `current.model.loaded` will store loaded models
834
-
835
-
836
-
837
- """
838
- ...
839
-
840
- @typing.overload
841
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
842
- ...
843
-
844
- @typing.overload
845
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
846
- ...
847
-
848
- 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):
849
- """
850
- Enables loading / saving of models within a step.
851
-
852
-
853
- Parameters
854
- ----------
855
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
856
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
857
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
858
- - `current.checkpoint`
859
- - `current.model`
860
- - `current.huggingface_hub`
861
-
862
- 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
863
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
864
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
865
-
866
- temp_dir_root : str, default: None
867
- The root directory under which `current.model.loaded` will store loaded models
868
-
834
+ type : str, default 'default'
835
+ Card type.
836
+ id : str, optional, default None
837
+ If multiple cards are present, use this id to identify this card.
838
+ options : Dict[str, Any], default {}
839
+ Options passed to the card. The contents depend on the card type.
840
+ timeout : int, default 45
841
+ Interrupt reporting if it takes more than this many seconds.
869
842
 
870
843
 
871
844
  """
@@ -889,111 +862,112 @@ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepF
889
862
  ...
890
863
 
891
864
  @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]]]:
865
+ 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]]]:
893
866
  """
894
- Specifies secrets to be retrieved and injected as environment variables prior to
895
- the execution of a step.
867
+ Enables checkpointing for a step.
868
+
896
869
 
897
870
  Parameters
898
871
  ----------
899
- sources : List[Union[str, Dict[str, Any]]], default: []
900
- List of secret specs, defining how the secrets are to be retrieved
872
+ load_policy : str, default: "fresh"
873
+ The policy for loading the checkpoint. The following policies are supported:
874
+ - "eager": Loads the the latest available checkpoint within the namespace.
875
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
876
+ will be loaded at the start of the task.
877
+ - "none": Do not load any checkpoint
878
+ - "fresh": Loads the lastest checkpoint created within the running Task.
879
+ This mode helps loading checkpoints across various retry attempts of the same task.
880
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
881
+ created within the task will be loaded when the task is retries execution on failure.
882
+
883
+ temp_dir_root : str, default: None
884
+ The root directory under which `current.checkpoint.directory` will be created.
885
+
886
+
887
+
901
888
  """
902
889
  ...
903
890
 
904
891
  @typing.overload
905
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
892
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
906
893
  ...
907
894
 
908
895
  @typing.overload
909
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
896
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
910
897
  ...
911
898
 
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]]] = []):
899
+ 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):
913
900
  """
914
- Specifies secrets to be retrieved and injected as environment variables prior to
915
- the execution of a step.
901
+ Enables checkpointing for a step.
902
+
916
903
 
917
904
  Parameters
918
905
  ----------
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().
906
+ load_policy : str, default: "fresh"
907
+ The policy for loading the checkpoint. The following policies are supported:
908
+ - "eager": Loads the the latest available checkpoint within the namespace.
909
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
910
+ will be loaded at the start of the task.
911
+ - "none": Do not load any checkpoint
912
+ - "fresh": Loads the lastest checkpoint created within the running Task.
913
+ This mode helps loading checkpoints across various retry attempts of the same task.
914
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
915
+ created within the task will be loaded when the task is retries execution on failure.
916
+
917
+ temp_dir_root : str, default: None
918
+ The root directory under which `current.checkpoint.directory` will be created.
919
+
920
+
921
+
940
922
  """
941
923
  ...
942
924
 
943
925
  @typing.overload
944
- 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]]]:
926
+ 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]]]:
945
927
  """
946
- Specifies the Conda environment for the step.
928
+ Specifies the PyPI packages for the step.
947
929
 
948
930
  Information in this decorator will augment any
949
- attributes set in the `@conda_base` flow-level decorator. Hence,
950
- you can use `@conda_base` to set packages required by all
951
- steps and use `@conda` to specify step-specific overrides.
931
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
932
+ you can use `@pypi_base` to set packages required by all
933
+ steps and use `@pypi` to specify step-specific overrides.
952
934
 
953
935
  Parameters
954
936
  ----------
955
- packages : Dict[str, str], default {}
937
+ packages : Dict[str, str], default: {}
956
938
  Packages to use for this step. The key is the name of the package
957
939
  and the value is the version to use.
958
- libraries : Dict[str, str], default {}
959
- Supported for backward compatibility. When used with packages, packages will take precedence.
960
- python : str, optional, default None
940
+ python : str, optional, default: None
961
941
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
962
942
  that the version used will correspond to the version of the Python interpreter used to start the run.
963
- disabled : bool, default False
964
- If set to True, disables @conda.
965
943
  """
966
944
  ...
967
945
 
968
946
  @typing.overload
969
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
947
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
970
948
  ...
971
949
 
972
950
  @typing.overload
973
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
951
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
974
952
  ...
975
953
 
976
- 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):
954
+ 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):
977
955
  """
978
- Specifies the Conda environment for the step.
956
+ Specifies the PyPI packages for the step.
979
957
 
980
958
  Information in this decorator will augment any
981
- attributes set in the `@conda_base` flow-level decorator. Hence,
982
- you can use `@conda_base` to set packages required by all
983
- steps and use `@conda` to specify step-specific overrides.
959
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
960
+ you can use `@pypi_base` to set packages required by all
961
+ steps and use `@pypi` to specify step-specific overrides.
984
962
 
985
963
  Parameters
986
964
  ----------
987
- packages : Dict[str, str], default {}
965
+ packages : Dict[str, str], default: {}
988
966
  Packages to use for this step. The key is the name of the package
989
967
  and the value is the version to use.
990
- libraries : Dict[str, str], default {}
991
- Supported for backward compatibility. When used with packages, packages will take precedence.
992
- python : str, optional, default None
968
+ python : str, optional, default: None
993
969
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
994
970
  that the version used will correspond to the version of the Python interpreter used to start the run.
995
- disabled : bool, default False
996
- If set to True, disables @conda.
997
971
  """
998
972
  ...
999
973
 
@@ -1029,63 +1003,79 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
1029
1003
  ...
1030
1004
 
1031
1005
  @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]]]:
1006
+ 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]]]:
1033
1007
  """
1034
- Enables checkpointing for a step.
1008
+ Specifies the resources needed when executing this step.
1009
+
1010
+ Use `@resources` to specify the resource requirements
1011
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1035
1012
 
1013
+ You can choose the compute layer on the command line by executing e.g.
1014
+ ```
1015
+ python myflow.py run --with batch
1016
+ ```
1017
+ or
1018
+ ```
1019
+ python myflow.py run --with kubernetes
1020
+ ```
1021
+ which executes the flow on the desired system using the
1022
+ requirements specified in `@resources`.
1036
1023
 
1037
1024
  Parameters
1038
1025
  ----------
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
-
1026
+ cpu : int, default 1
1027
+ Number of CPUs required for this step.
1028
+ gpu : int, default 0
1029
+ Number of GPUs required for this step.
1030
+ disk : int, optional, default None
1031
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1032
+ memory : int, default 4096
1033
+ Memory size (in MB) required for this step.
1034
+ shared_memory : int, optional, default None
1035
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1036
+ This parameter maps to the `--shm-size` option in Docker.
1055
1037
  """
1056
1038
  ...
1057
1039
 
1058
1040
  @typing.overload
1059
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1041
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1060
1042
  ...
1061
1043
 
1062
1044
  @typing.overload
1063
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1045
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1064
1046
  ...
1065
1047
 
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):
1048
+ 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):
1067
1049
  """
1068
- Enables checkpointing for a step.
1050
+ Specifies the resources needed when executing this step.
1051
+
1052
+ Use `@resources` to specify the resource requirements
1053
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1069
1054
 
1055
+ You can choose the compute layer on the command line by executing e.g.
1056
+ ```
1057
+ python myflow.py run --with batch
1058
+ ```
1059
+ or
1060
+ ```
1061
+ python myflow.py run --with kubernetes
1062
+ ```
1063
+ which executes the flow on the desired system using the
1064
+ requirements specified in `@resources`.
1070
1065
 
1071
1066
  Parameters
1072
1067
  ----------
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
-
1068
+ cpu : int, default 1
1069
+ Number of CPUs required for this step.
1070
+ gpu : int, default 0
1071
+ Number of GPUs required for this step.
1072
+ disk : int, optional, default None
1073
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1074
+ memory : int, default 4096
1075
+ Memory size (in MB) required for this step.
1076
+ shared_memory : int, optional, default None
1077
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1078
+ This parameter maps to the `--shm-size` option in Docker.
1089
1079
  """
1090
1080
  ...
1091
1081
 
@@ -1143,51 +1133,61 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1143
1133
  ...
1144
1134
 
1145
1135
  @typing.overload
1146
- 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]]]:
1136
+ 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]]]:
1147
1137
  """
1148
- Creates a human-readable report, a Metaflow Card, after this step completes.
1138
+ Enables loading / saving of models within a step.
1149
1139
 
1150
- Note that you may add multiple `@card` decorators in a step with different parameters.
1151
1140
 
1152
1141
  Parameters
1153
1142
  ----------
1154
- type : str, default 'default'
1155
- Card type.
1156
- id : str, optional, default None
1157
- If multiple cards are present, use this id to identify this card.
1158
- options : Dict[str, Any], default {}
1159
- Options passed to the card. The contents depend on the card type.
1160
- timeout : int, default 45
1161
- Interrupt reporting if it takes more than this many seconds.
1143
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1144
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1145
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1146
+ - `current.checkpoint`
1147
+ - `current.model`
1148
+ - `current.huggingface_hub`
1149
+
1150
+ 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
1151
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1152
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1153
+
1154
+ temp_dir_root : str, default: None
1155
+ The root directory under which `current.model.loaded` will store loaded models
1156
+
1162
1157
 
1163
1158
 
1164
1159
  """
1165
1160
  ...
1166
1161
 
1167
1162
  @typing.overload
1168
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1163
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1169
1164
  ...
1170
1165
 
1171
1166
  @typing.overload
1172
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1167
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1173
1168
  ...
1174
1169
 
1175
- 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):
1170
+ 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):
1176
1171
  """
1177
- Creates a human-readable report, a Metaflow Card, after this step completes.
1172
+ Enables loading / saving of models within a step.
1178
1173
 
1179
- Note that you may add multiple `@card` decorators in a step with different parameters.
1180
1174
 
1181
1175
  Parameters
1182
1176
  ----------
1183
- type : str, default 'default'
1184
- Card type.
1185
- id : str, optional, default None
1186
- If multiple cards are present, use this id to identify this card.
1187
- options : Dict[str, Any], default {}
1188
- Options passed to the card. The contents depend on the card type.
1189
- timeout : int, default 45
1190
- Interrupt reporting if it takes more than this many seconds.
1177
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1178
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1179
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1180
+ - `current.checkpoint`
1181
+ - `current.model`
1182
+ - `current.huggingface_hub`
1183
+
1184
+ 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
1185
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1186
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1187
+
1188
+ temp_dir_root : str, default: None
1189
+ The root directory under which `current.model.loaded` will store loaded models
1190
+
1191
1191
 
1192
1192
 
1193
1193
  """
@@ -1233,103 +1233,67 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1233
1233
  ...
1234
1234
 
1235
1235
  @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]]:
1236
+ 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]]:
1237
1237
  """
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
1249
-
1250
- Additionally, you can specify project aware upstream flow dependencies
1251
- by specifying the fully qualified project_flow_name.
1252
- ```
1253
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1254
- ```
1255
- or
1256
- ```
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"})
1264
- ```
1238
+ Specifies the Conda environment for all steps of the flow.
1265
1239
 
1266
- Note that `branch` is typically one of:
1267
- - `prod`
1268
- - `user.bob`
1269
- - `test.my_experiment`
1270
- - `prod.staging`
1240
+ Use `@conda_base` to set common libraries required by all
1241
+ steps and use `@conda` to specify step-specific additions.
1271
1242
 
1272
1243
  Parameters
1273
1244
  ----------
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
-
1245
+ packages : Dict[str, str], default {}
1246
+ Packages to use for this flow. The key is the name of the package
1247
+ and the value is the version to use.
1248
+ libraries : Dict[str, str], default {}
1249
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1250
+ python : str, optional, default None
1251
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1252
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1253
+ disabled : bool, default False
1254
+ If set to True, disables Conda.
1282
1255
  """
1283
1256
  ...
1284
1257
 
1285
1258
  @typing.overload
1286
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1259
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1287
1260
  ...
1288
1261
 
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] = {}):
1262
+ 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):
1290
1263
  """
1291
- Specifies the flow(s) that this flow depends on.
1292
-
1293
- ```
1294
- @trigger_on_finish(flow='FooFlow')
1295
- ```
1296
- or
1297
- ```
1298
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1299
- ```
1300
- This decorator respects the @project decorator and triggers the flow
1301
- when upstream runs within the same namespace complete successfully
1264
+ Specifies the Conda environment for all steps of the flow.
1302
1265
 
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
1309
- ```
1310
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1311
- ```
1266
+ Use `@conda_base` to set common libraries required by all
1267
+ steps and use `@conda` to specify step-specific additions.
1312
1268
 
1313
- You can also specify just the project or project branch (other values will be
1314
- inferred from the current project or project branch):
1315
- ```
1316
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1317
- ```
1269
+ Parameters
1270
+ ----------
1271
+ packages : Dict[str, str], default {}
1272
+ Packages to use for this flow. The key is the name of the package
1273
+ and the value is the version to use.
1274
+ libraries : Dict[str, str], default {}
1275
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1276
+ python : str, optional, default None
1277
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1278
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1279
+ disabled : bool, default False
1280
+ If set to True, disables Conda.
1281
+ """
1282
+ ...
1283
+
1284
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1285
+ """
1286
+ Specifies what flows belong to the same project.
1318
1287
 
1319
- Note that `branch` is typically one of:
1320
- - `prod`
1321
- - `user.bob`
1322
- - `test.my_experiment`
1323
- - `prod.staging`
1288
+ A project-specific namespace is created for all flows that
1289
+ use the same `@project(name)`.
1324
1290
 
1325
1291
  Parameters
1326
1292
  ----------
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.
1331
- options : Dict[str, Any], default {}
1332
- Backend-specific configuration for tuning eventing behavior.
1293
+ name : str
1294
+ Project name. Make sure that the name is unique amongst all
1295
+ projects that use the same production scheduler. The name may
1296
+ contain only lowercase alphanumeric characters and underscores.
1333
1297
 
1334
1298
 
1335
1299
  """
@@ -1430,6 +1394,48 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1430
1394
  """
1431
1395
  ...
1432
1396
 
1397
+ 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]]:
1398
+ """
1399
+ 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)
1400
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1401
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1402
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1403
+ starts only after all sensors finish.
1404
+
1405
+ Parameters
1406
+ ----------
1407
+ timeout : int
1408
+ Time, in seconds before the task times out and fails. (Default: 3600)
1409
+ poke_interval : int
1410
+ Time in seconds that the job should wait in between each try. (Default: 60)
1411
+ mode : str
1412
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1413
+ exponential_backoff : bool
1414
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1415
+ pool : str
1416
+ the slot pool this task should run in,
1417
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1418
+ soft_fail : bool
1419
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1420
+ name : str
1421
+ Name of the sensor on Airflow
1422
+ description : str
1423
+ Description of sensor in the Airflow UI
1424
+ bucket_key : Union[str, List[str]]
1425
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1426
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1427
+ bucket_name : str
1428
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1429
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1430
+ wildcard_match : bool
1431
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1432
+ aws_conn_id : str
1433
+ a reference to the s3 connection on Airflow. (Default: None)
1434
+ verify : bool
1435
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1436
+ """
1437
+ ...
1438
+
1433
1439
  def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1434
1440
  """
1435
1441
  This decorator is used to run NIM containers in Metaflow tasks as sidecars.
@@ -1461,70 +1467,106 @@ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[Fl
1461
1467
  """
1462
1468
  ...
1463
1469
 
1464
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1470
+ @typing.overload
1471
+ 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]]:
1465
1472
  """
1466
- Specifies what flows belong to the same project.
1473
+ Specifies the flow(s) that this flow depends on.
1467
1474
 
1468
- A project-specific namespace is created for all flows that
1469
- use the same `@project(name)`.
1475
+ ```
1476
+ @trigger_on_finish(flow='FooFlow')
1477
+ ```
1478
+ or
1479
+ ```
1480
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1481
+ ```
1482
+ This decorator respects the @project decorator and triggers the flow
1483
+ when upstream runs within the same namespace complete successfully
1470
1484
 
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.
1485
+ Additionally, you can specify project aware upstream flow dependencies
1486
+ by specifying the fully qualified project_flow_name.
1487
+ ```
1488
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1489
+ ```
1490
+ or
1491
+ ```
1492
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1493
+ ```
1477
1494
 
1495
+ You can also specify just the project or project branch (other values will be
1496
+ inferred from the current project or project branch):
1497
+ ```
1498
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1499
+ ```
1478
1500
 
1479
- """
1480
- ...
1481
-
1482
- @typing.overload
1483
- 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
- """
1485
- Specifies the times when the flow should be run when running on a
1486
- production scheduler.
1501
+ Note that `branch` is typically one of:
1502
+ - `prod`
1503
+ - `user.bob`
1504
+ - `test.my_experiment`
1505
+ - `prod.staging`
1487
1506
 
1488
1507
  Parameters
1489
1508
  ----------
1490
- hourly : bool, default False
1491
- Run the workflow hourly.
1492
- daily : bool, default True
1493
- Run the workflow daily.
1494
- weekly : bool, default False
1495
- Run the workflow weekly.
1496
- cron : str, optional, default None
1497
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1498
- specified by this expression.
1499
- timezone : str, optional, default None
1500
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1501
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1509
+ flow : Union[str, Dict[str, str]], optional, default None
1510
+ Upstream flow dependency for this flow.
1511
+ flows : List[Union[str, Dict[str, str]]], default []
1512
+ Upstream flow dependencies for this flow.
1513
+ options : Dict[str, Any], default {}
1514
+ Backend-specific configuration for tuning eventing behavior.
1515
+
1516
+
1502
1517
  """
1503
1518
  ...
1504
1519
 
1505
1520
  @typing.overload
1506
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1521
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1507
1522
  ...
1508
1523
 
1509
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1524
+ 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] = {}):
1510
1525
  """
1511
- Specifies the times when the flow should be run when running on a
1512
- production scheduler.
1526
+ Specifies the flow(s) that this flow depends on.
1527
+
1528
+ ```
1529
+ @trigger_on_finish(flow='FooFlow')
1530
+ ```
1531
+ or
1532
+ ```
1533
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1534
+ ```
1535
+ This decorator respects the @project decorator and triggers the flow
1536
+ when upstream runs within the same namespace complete successfully
1537
+
1538
+ Additionally, you can specify project aware upstream flow dependencies
1539
+ by specifying the fully qualified project_flow_name.
1540
+ ```
1541
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1542
+ ```
1543
+ or
1544
+ ```
1545
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1546
+ ```
1547
+
1548
+ You can also specify just the project or project branch (other values will be
1549
+ inferred from the current project or project branch):
1550
+ ```
1551
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1552
+ ```
1553
+
1554
+ Note that `branch` is typically one of:
1555
+ - `prod`
1556
+ - `user.bob`
1557
+ - `test.my_experiment`
1558
+ - `prod.staging`
1513
1559
 
1514
1560
  Parameters
1515
1561
  ----------
1516
- hourly : bool, default False
1517
- Run the workflow hourly.
1518
- daily : bool, default True
1519
- Run the workflow daily.
1520
- weekly : bool, default False
1521
- Run the workflow weekly.
1522
- cron : str, optional, default None
1523
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1524
- specified by this expression.
1525
- timezone : str, optional, default None
1526
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1527
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1562
+ flow : Union[str, Dict[str, str]], optional, default None
1563
+ Upstream flow dependency for this flow.
1564
+ flows : List[Union[str, Dict[str, str]]], default []
1565
+ Upstream flow dependencies for this flow.
1566
+ options : Dict[str, Any], default {}
1567
+ Backend-specific configuration for tuning eventing behavior.
1568
+
1569
+
1528
1570
  """
1529
1571
  ...
1530
1572
 
@@ -1570,94 +1612,52 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1570
1612
  """
1571
1613
  ...
1572
1614
 
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]]:
1574
- """
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.
1580
-
1581
- Parameters
1582
- ----------
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)
1612
- """
1613
- ...
1614
-
1615
1615
  @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]]:
1616
+ 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]]:
1617
1617
  """
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.
1618
+ Specifies the times when the flow should be run when running on a
1619
+ production scheduler.
1622
1620
 
1623
1621
  Parameters
1624
1622
  ----------
1625
- packages : Dict[str, str], default {}
1626
- Packages to use for this flow. The key is the name of the package
1627
- 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
1631
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1632
- 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.
1623
+ hourly : bool, default False
1624
+ Run the workflow hourly.
1625
+ daily : bool, default True
1626
+ Run the workflow daily.
1627
+ weekly : bool, default False
1628
+ Run the workflow weekly.
1629
+ cron : str, optional, default None
1630
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1631
+ specified by this expression.
1632
+ timezone : str, optional, default None
1633
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1634
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1635
1635
  """
1636
1636
  ...
1637
1637
 
1638
1638
  @typing.overload
1639
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1639
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1640
1640
  ...
1641
1641
 
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):
1642
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1643
1643
  """
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.
1644
+ Specifies the times when the flow should be run when running on a
1645
+ production scheduler.
1648
1646
 
1649
1647
  Parameters
1650
1648
  ----------
1651
- packages : Dict[str, str], default {}
1652
- Packages to use for this flow. The key is the name of the package
1653
- 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
1657
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1658
- 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.
1649
+ hourly : bool, default False
1650
+ Run the workflow hourly.
1651
+ daily : bool, default True
1652
+ Run the workflow daily.
1653
+ weekly : bool, default False
1654
+ Run the workflow weekly.
1655
+ cron : str, optional, default None
1656
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1657
+ specified by this expression.
1658
+ timezone : str, optional, default None
1659
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1660
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1661
1661
  """
1662
1662
  ...
1663
1663