ob-metaflow-stubs 6.0.3.109rc1__py2.py3-none-any.whl → 6.0.3.110__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 +586 -594
  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 +6 -6
  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 +4 -4
  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 +2 -2
  15. metaflow-stubs/metadata/util.pyi +2 -2
  16. metaflow-stubs/metaflow_config.pyi +4 -2
  17. metaflow-stubs/metaflow_current.pyi +48 -48
  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 +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  31. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +5 -5
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +8 -8
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +132 -4
  36. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  37. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +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 +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 +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 +3 -3
  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 +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 +2 -2
  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 +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.109rc1.dist-info → ob_metaflow_stubs-6.0.3.110.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.110.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.109rc1.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.109rc1.dist-info → ob_metaflow_stubs-6.0.3.110.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.109rc1.dist-info → ob_metaflow_stubs-6.0.3.110.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.25.1+obcheckpoint(0.0.13);ob(v1) #
4
- # Generated on 2024-10-10T01:39:58.507568 #
3
+ # MF version: 2.12.25.2+obcheckpoint(0.1.0);ob(v1) #
4
+ # Generated on 2024-10-16T01:27:45.836502 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow.metaflow_current
12
- import metaflow._vendor.click.types
13
- import metaflow.events
14
11
  import metaflow.datastore.inputs
12
+ import metaflow.runner.metaflow_runner
15
13
  import metaflow.flowspec
16
14
  import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
15
+ import metaflow.parameters
17
16
  import datetime
17
+ import metaflow.metaflow_current
18
18
  import metaflow.client.core
19
- import metaflow.runner.metaflow_runner
20
19
  import typing
21
- import metaflow.parameters
20
+ import metaflow.events
21
+ import metaflow._vendor.click.types
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -512,102 +512,16 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
512
512
  """
513
513
  ...
514
514
 
515
- @typing.overload
516
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
517
- """
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.
538
-
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.
557
-
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]]]:
515
+ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
567
516
  """
568
- Specifies the PyPI packages for the step.
569
-
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.
517
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
574
518
 
575
519
  Parameters
576
520
  ----------
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.
583
- """
584
- ...
585
-
586
- @typing.overload
587
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
588
- ...
589
-
590
- @typing.overload
591
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
592
- ...
593
-
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):
595
- """
596
- Specifies the PyPI packages for the step.
521
+ temp_dir_root : str, optional
522
+ The root directory that will hold the temporary directory where objects will be downloaded.
597
523
 
598
- Information in this decorator will augment any
599
- attributes set in the `@pyi_base` flow-level decorator. Hence,
600
- you can use `@pypi_base` to set packages required by all
601
- steps and use `@pypi` to specify step-specific overrides.
602
524
 
603
- Parameters
604
- ----------
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.
611
525
  """
612
526
  ...
613
527
 
@@ -678,166 +592,19 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
678
592
  ...
679
593
 
680
594
  @typing.overload
681
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
682
- """
683
- Specifies secrets to be retrieved and injected as environment variables prior to
684
- the execution of a step.
685
-
686
- Parameters
687
- ----------
688
- sources : List[Union[str, Dict[str, Any]]], default: []
689
- List of secret specs, defining how the secrets are to be retrieved
690
- """
691
- ...
692
-
693
- @typing.overload
694
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
695
- ...
696
-
697
- @typing.overload
698
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
699
- ...
700
-
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]]] = []):
702
- """
703
- Specifies secrets to be retrieved and injected as environment variables prior to
704
- the execution of a step.
705
-
706
- Parameters
707
- ----------
708
- sources : List[Union[str, Dict[str, Any]]], default: []
709
- List of secret specs, defining how the secrets are to be retrieved
710
- """
711
- ...
712
-
713
- @typing.overload
714
- def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
715
- """
716
- Specifies the number of times the task corresponding
717
- to a step needs to be retried.
718
-
719
- This decorator is useful for handling transient errors, such as networking issues.
720
- If your task contains operations that can't be retried safely, e.g. database updates,
721
- it is advisable to annotate it with `@retry(times=0)`.
722
-
723
- This can be used in conjunction with the `@catch` decorator. The `@catch`
724
- decorator will execute a no-op task after all retries have been exhausted,
725
- ensuring that the flow execution can continue.
726
-
727
- Parameters
728
- ----------
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.
733
- """
734
- ...
735
-
736
- @typing.overload
737
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
738
- ...
739
-
740
- @typing.overload
741
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
742
- ...
743
-
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):
745
- """
746
- Specifies the number of times the task corresponding
747
- to a step needs to be retried.
748
-
749
- This decorator is useful for handling transient errors, such as networking issues.
750
- If your task contains operations that can't be retried safely, e.g. database updates,
751
- it is advisable to annotate it with `@retry(times=0)`.
752
-
753
- This can be used in conjunction with the `@catch` decorator. The `@catch`
754
- decorator will execute a no-op task after all retries have been exhausted,
755
- ensuring that the flow execution can continue.
756
-
757
- Parameters
758
- ----------
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.
763
- """
764
- ...
765
-
766
- @typing.overload
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]]]:
768
- """
769
- Specifies a timeout for your step.
770
-
771
- This decorator is useful if this step may hang indefinitely.
772
-
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.
779
-
780
- Parameters
781
- ----------
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.
788
- """
789
- ...
790
-
791
- @typing.overload
792
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
793
- ...
794
-
795
- @typing.overload
796
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
797
- ...
798
-
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):
800
- """
801
- Specifies a timeout for your step.
802
-
803
- This decorator is useful if this step may hang indefinitely.
804
-
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.
811
-
812
- Parameters
813
- ----------
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]:
595
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
825
596
  """
826
- Decorator that helps cache, version and store models/datasets from huggingface hub.
827
-
828
-
597
+ Internal decorator to support Fast bakery
829
598
  """
830
599
  ...
831
600
 
832
601
  @typing.overload
833
- def huggingface_hub(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
602
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
834
603
  ...
835
604
 
836
- def huggingface_hub(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
605
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
837
606
  """
838
- Decorator that helps cache, version and store models/datasets from huggingface hub.
839
-
840
-
607
+ Internal decorator to support Fast bakery
841
608
  """
842
609
  ...
843
610
 
@@ -903,202 +670,141 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
903
670
  ...
904
671
 
905
672
  @typing.overload
906
- def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
673
+ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
907
674
  """
908
- Specifies the Conda environment for the step.
675
+ Specifies the PyPI packages for the step.
909
676
 
910
677
  Information in this decorator will augment any
911
- attributes set in the `@conda_base` flow-level decorator. Hence,
912
- you can use `@conda_base` to set packages required by all
913
- steps and use `@conda` to specify step-specific overrides.
678
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
679
+ you can use `@pypi_base` to set packages required by all
680
+ steps and use `@pypi` to specify step-specific overrides.
914
681
 
915
682
  Parameters
916
683
  ----------
917
- packages : Dict[str, str], default {}
684
+ packages : Dict[str, str], default: {}
918
685
  Packages to use for this step. The key is the name of the package
919
686
  and the value is the version to use.
920
- libraries : Dict[str, str], default {}
921
- Supported for backward compatibility. When used with packages, packages will take precedence.
922
- python : str, optional, default None
687
+ python : str, optional, default: None
923
688
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
924
689
  that the version used will correspond to the version of the Python interpreter used to start the run.
925
- disabled : bool, default False
926
- If set to True, disables @conda.
927
690
  """
928
691
  ...
929
692
 
930
693
  @typing.overload
931
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
694
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
932
695
  ...
933
696
 
934
697
  @typing.overload
935
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
698
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
936
699
  ...
937
700
 
938
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
701
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
939
702
  """
940
- Specifies the Conda environment for the step.
703
+ Specifies the PyPI packages for the step.
941
704
 
942
705
  Information in this decorator will augment any
943
- attributes set in the `@conda_base` flow-level decorator. Hence,
944
- you can use `@conda_base` to set packages required by all
945
- steps and use `@conda` to specify step-specific overrides.
706
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
707
+ you can use `@pypi_base` to set packages required by all
708
+ steps and use `@pypi` to specify step-specific overrides.
946
709
 
947
710
  Parameters
948
711
  ----------
949
- packages : Dict[str, str], default {}
712
+ packages : Dict[str, str], default: {}
950
713
  Packages to use for this step. The key is the name of the package
951
714
  and the value is the version to use.
952
- libraries : Dict[str, str], default {}
953
- Supported for backward compatibility. When used with packages, packages will take precedence.
954
- python : str, optional, default None
715
+ python : str, optional, default: None
955
716
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
956
717
  that the version used will correspond to the version of the Python interpreter used to start the run.
957
- disabled : bool, default False
958
- If set to True, disables @conda.
959
718
  """
960
719
  ...
961
720
 
962
721
  @typing.overload
963
- def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
722
+ 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]]]:
964
723
  """
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`.
724
+ Specifies secrets to be retrieved and injected as environment variables prior to
725
+ the execution of a step.
980
726
 
981
727
  Parameters
982
728
  ----------
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.
729
+ sources : List[Union[str, Dict[str, Any]]], default: []
730
+ List of secret specs, defining how the secrets are to be retrieved
994
731
  """
995
732
  ...
996
733
 
997
734
  @typing.overload
998
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
735
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
999
736
  ...
1000
737
 
1001
738
  @typing.overload
1002
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
739
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1003
740
  ...
1004
741
 
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):
742
+ 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]]] = []):
1006
743
  """
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`.
744
+ Specifies secrets to be retrieved and injected as environment variables prior to
745
+ the execution of a step.
1022
746
 
1023
747
  Parameters
1024
748
  ----------
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.
749
+ sources : List[Union[str, Dict[str, Any]]], default: []
750
+ List of secret specs, defining how the secrets are to be retrieved
1036
751
  """
1037
752
  ...
1038
753
 
1039
754
  @typing.overload
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]]]:
755
+ 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]]]:
1041
756
  """
1042
- Specifies that the step will success under all circumstances.
757
+ Specifies a timeout for your step.
1043
758
 
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.
759
+ This decorator is useful if this step may hang indefinitely.
760
+
761
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
762
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
763
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
764
+
765
+ Note that all the values specified in parameters are added together so if you specify
766
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1048
767
 
1049
768
  Parameters
1050
769
  ----------
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.
770
+ seconds : int, default 0
771
+ Number of seconds to wait prior to timing out.
772
+ minutes : int, default 0
773
+ Number of minutes to wait prior to timing out.
774
+ hours : int, default 0
775
+ Number of hours to wait prior to timing out.
1057
776
  """
1058
777
  ...
1059
778
 
1060
779
  @typing.overload
1061
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
780
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1062
781
  ...
1063
782
 
1064
783
  @typing.overload
1065
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
784
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1066
785
  ...
1067
786
 
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):
787
+ 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):
1069
788
  """
1070
- Specifies that the step will success under all circumstances.
789
+ Specifies a timeout for your step.
1071
790
 
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.
791
+ This decorator is useful if this step may hang indefinitely.
792
+
793
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
794
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
795
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
796
+
797
+ Note that all the values specified in parameters are added together so if you specify
798
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1076
799
 
1077
800
  Parameters
1078
801
  ----------
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.
1085
- """
1086
- ...
1087
-
1088
- @typing.overload
1089
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1090
- """
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
802
+ seconds : int, default 0
803
+ Number of seconds to wait prior to timing out.
804
+ minutes : int, default 0
805
+ Number of minutes to wait prior to timing out.
806
+ hours : int, default 0
807
+ Number of hours to wait prior to timing out.
1102
808
  """
1103
809
  ...
1104
810
 
@@ -1164,113 +870,458 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
1164
870
  ...
1165
871
 
1166
872
  @typing.overload
1167
- def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
873
+ 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]]]:
1168
874
  """
1169
- Creates a human-readable report, a Metaflow Card, after this step completes.
875
+ Specifies the number of times the task corresponding
876
+ to a step needs to be retried.
1170
877
 
1171
- Note that you may add multiple `@card` decorators in a step with different parameters.
878
+ This decorator is useful for handling transient errors, such as networking issues.
879
+ If your task contains operations that can't be retried safely, e.g. database updates,
880
+ it is advisable to annotate it with `@retry(times=0)`.
881
+
882
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
883
+ decorator will execute a no-op task after all retries have been exhausted,
884
+ ensuring that the flow execution can continue.
1172
885
 
1173
886
  Parameters
1174
887
  ----------
1175
- type : str, default 'default'
1176
- Card type.
1177
- id : str, optional, default None
1178
- If multiple cards are present, use this id to identify this card.
1179
- options : Dict[str, Any], default {}
1180
- Options passed to the card. The contents depend on the card type.
1181
- timeout : int, default 45
1182
- Interrupt reporting if it takes more than this many seconds.
1183
-
1184
-
888
+ times : int, default 3
889
+ Number of times to retry this task.
890
+ minutes_between_retries : int, default 2
891
+ Number of minutes between retries.
1185
892
  """
1186
893
  ...
1187
894
 
1188
895
  @typing.overload
1189
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
896
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1190
897
  ...
1191
898
 
1192
899
  @typing.overload
1193
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
900
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1194
901
  ...
1195
902
 
1196
- def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
903
+ 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):
1197
904
  """
1198
- Creates a human-readable report, a Metaflow Card, after this step completes.
905
+ Specifies the number of times the task corresponding
906
+ to a step needs to be retried.
1199
907
 
1200
- Note that you may add multiple `@card` decorators in a step with different parameters.
908
+ This decorator is useful for handling transient errors, such as networking issues.
909
+ If your task contains operations that can't be retried safely, e.g. database updates,
910
+ it is advisable to annotate it with `@retry(times=0)`.
911
+
912
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
913
+ decorator will execute a no-op task after all retries have been exhausted,
914
+ ensuring that the flow execution can continue.
1201
915
 
1202
916
  Parameters
1203
917
  ----------
1204
- type : str, default 'default'
1205
- Card type.
1206
- id : str, optional, default None
1207
- If multiple cards are present, use this id to identify this card.
1208
- options : Dict[str, Any], default {}
1209
- Options passed to the card. The contents depend on the card type.
1210
- timeout : int, default 45
1211
- Interrupt reporting if it takes more than this many seconds.
1212
-
1213
-
918
+ times : int, default 3
919
+ Number of times to retry this task.
920
+ minutes_between_retries : int, default 2
921
+ Number of minutes between retries.
1214
922
  """
1215
923
  ...
1216
924
 
1217
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
925
+ @typing.overload
926
+ 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]]]:
1218
927
  """
1219
- Specifies what flows belong to the same project.
928
+ Specifies that the step will success under all circumstances.
1220
929
 
1221
- A project-specific namespace is created for all flows that
1222
- use the same `@project(name)`.
930
+ The decorator will create an optional artifact, specified by `var`, which
931
+ contains the exception raised. You can use it to detect the presence
932
+ of errors, indicating that all happy-path artifacts produced by the step
933
+ are missing.
1223
934
 
1224
935
  Parameters
1225
936
  ----------
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.
937
+ var : str, optional, default None
938
+ Name of the artifact in which to store the caught exception.
939
+ If not specified, the exception is not stored.
940
+ print_exception : bool, default True
941
+ Determines whether or not the exception is printed to
942
+ stdout when caught.
943
+ """
944
+ ...
945
+
946
+ @typing.overload
947
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
948
+ ...
949
+
950
+ @typing.overload
951
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
952
+ ...
953
+
954
+ 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):
955
+ """
956
+ Specifies that the step will success under all circumstances.
1230
957
 
958
+ The decorator will create an optional artifact, specified by `var`, which
959
+ contains the exception raised. You can use it to detect the presence
960
+ of errors, indicating that all happy-path artifacts produced by the step
961
+ are missing.
1231
962
 
963
+ Parameters
964
+ ----------
965
+ var : str, optional, default None
966
+ Name of the artifact in which to store the caught exception.
967
+ If not specified, the exception is not stored.
968
+ print_exception : bool, default True
969
+ Determines whether or not the exception is printed to
970
+ stdout when caught.
1232
971
  """
1233
972
  ...
1234
973
 
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]]:
974
+ @typing.overload
975
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1236
976
  """
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.
977
+ Decorator prototype for all step decorators. This function gets specialized
978
+ and imported for all decorators types by _import_plugin_decorators().
979
+ """
980
+ ...
981
+
982
+ @typing.overload
983
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
984
+ ...
985
+
986
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
987
+ """
988
+ Decorator prototype for all step decorators. This function gets specialized
989
+ and imported for all decorators types by _import_plugin_decorators().
990
+ """
991
+ ...
992
+
993
+ @typing.overload
994
+ 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]]]:
995
+ """
996
+ Specifies environment variables to be set prior to the execution of a step.
1242
997
 
1243
998
  Parameters
1244
999
  ----------
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)
1000
+ vars : Dict[str, str], default {}
1001
+ Dictionary of environment variables to set.
1002
+ """
1003
+ ...
1004
+
1005
+ @typing.overload
1006
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1007
+ ...
1008
+
1009
+ @typing.overload
1010
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1011
+ ...
1012
+
1013
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1014
+ """
1015
+ Specifies environment variables to be set prior to the execution of a step.
1016
+
1017
+ Parameters
1018
+ ----------
1019
+ vars : Dict[str, str], default {}
1020
+ Dictionary of environment variables to set.
1021
+ """
1022
+ ...
1023
+
1024
+ @typing.overload
1025
+ 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]]]:
1026
+ """
1027
+ Specifies the resources needed when executing this step.
1028
+
1029
+ Use `@resources` to specify the resource requirements
1030
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1031
+
1032
+ You can choose the compute layer on the command line by executing e.g.
1033
+ ```
1034
+ python myflow.py run --with batch
1035
+ ```
1036
+ or
1037
+ ```
1038
+ python myflow.py run --with kubernetes
1039
+ ```
1040
+ which executes the flow on the desired system using the
1041
+ requirements specified in `@resources`.
1042
+
1043
+ Parameters
1044
+ ----------
1045
+ cpu : int, default 1
1046
+ Number of CPUs required for this step.
1047
+ gpu : int, default 0
1048
+ Number of GPUs required for this step.
1049
+ disk : int, optional, default None
1050
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1051
+ memory : int, default 4096
1052
+ Memory size (in MB) required for this step.
1053
+ shared_memory : int, optional, default None
1054
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1055
+ This parameter maps to the `--shm-size` option in Docker.
1056
+ """
1057
+ ...
1058
+
1059
+ @typing.overload
1060
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1061
+ ...
1062
+
1063
+ @typing.overload
1064
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1065
+ ...
1066
+
1067
+ 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):
1068
+ """
1069
+ Specifies the resources needed when executing this step.
1070
+
1071
+ Use `@resources` to specify the resource requirements
1072
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1073
+
1074
+ You can choose the compute layer on the command line by executing e.g.
1075
+ ```
1076
+ python myflow.py run --with batch
1077
+ ```
1078
+ or
1079
+ ```
1080
+ python myflow.py run --with kubernetes
1081
+ ```
1082
+ which executes the flow on the desired system using the
1083
+ requirements specified in `@resources`.
1084
+
1085
+ Parameters
1086
+ ----------
1087
+ cpu : int, default 1
1088
+ Number of CPUs required for this step.
1089
+ gpu : int, default 0
1090
+ Number of GPUs required for this step.
1091
+ disk : int, optional, default None
1092
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1093
+ memory : int, default 4096
1094
+ Memory size (in MB) required for this step.
1095
+ shared_memory : int, optional, default None
1096
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1097
+ This parameter maps to the `--shm-size` option in Docker.
1098
+ """
1099
+ ...
1100
+
1101
+ @typing.overload
1102
+ 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]]]:
1103
+ """
1104
+ Specifies the Conda environment for the step.
1105
+
1106
+ Information in this decorator will augment any
1107
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1108
+ you can use `@conda_base` to set packages required by all
1109
+ steps and use `@conda` to specify step-specific overrides.
1110
+
1111
+ Parameters
1112
+ ----------
1113
+ packages : Dict[str, str], default {}
1114
+ Packages to use for this step. The key is the name of the package
1115
+ and the value is the version to use.
1116
+ libraries : Dict[str, str], default {}
1117
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1118
+ python : str, optional, default None
1119
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1120
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1121
+ disabled : bool, default False
1122
+ If set to True, disables @conda.
1123
+ """
1124
+ ...
1125
+
1126
+ @typing.overload
1127
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1128
+ ...
1129
+
1130
+ @typing.overload
1131
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1132
+ ...
1133
+
1134
+ 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):
1135
+ """
1136
+ Specifies the Conda environment for the step.
1137
+
1138
+ Information in this decorator will augment any
1139
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1140
+ you can use `@conda_base` to set packages required by all
1141
+ steps and use `@conda` to specify step-specific overrides.
1142
+
1143
+ Parameters
1144
+ ----------
1145
+ packages : Dict[str, str], default {}
1146
+ Packages to use for this step. The key is the name of the package
1147
+ and the value is the version to use.
1148
+ libraries : Dict[str, str], default {}
1149
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1150
+ python : str, optional, default None
1151
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1152
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1153
+ disabled : bool, default False
1154
+ If set to True, disables @conda.
1155
+ """
1156
+ ...
1157
+
1158
+ @typing.overload
1159
+ 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]]]:
1160
+ """
1161
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1162
+
1163
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1164
+
1165
+ Parameters
1166
+ ----------
1167
+ type : str, default 'default'
1168
+ Card type.
1169
+ id : str, optional, default None
1170
+ If multiple cards are present, use this id to identify this card.
1171
+ options : Dict[str, Any], default {}
1172
+ Options passed to the card. The contents depend on the card type.
1173
+ timeout : int, default 45
1174
+ Interrupt reporting if it takes more than this many seconds.
1175
+
1176
+
1177
+ """
1178
+ ...
1179
+
1180
+ @typing.overload
1181
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1182
+ ...
1183
+
1184
+ @typing.overload
1185
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1186
+ ...
1187
+
1188
+ 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):
1189
+ """
1190
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1191
+
1192
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1193
+
1194
+ Parameters
1195
+ ----------
1196
+ type : str, default 'default'
1197
+ Card type.
1198
+ id : str, optional, default None
1199
+ If multiple cards are present, use this id to identify this card.
1200
+ options : Dict[str, Any], default {}
1201
+ Options passed to the card. The contents depend on the card type.
1202
+ timeout : int, default 45
1203
+ Interrupt reporting if it takes more than this many seconds.
1204
+
1205
+
1206
+ """
1207
+ ...
1208
+
1209
+ @typing.overload
1210
+ 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]]:
1211
+ """
1212
+ Specifies the Conda environment for all steps of the flow.
1213
+
1214
+ Use `@conda_base` to set common libraries required by all
1215
+ steps and use `@conda` to specify step-specific additions.
1216
+
1217
+ Parameters
1218
+ ----------
1219
+ packages : Dict[str, str], default {}
1220
+ Packages to use for this flow. The key is the name of the package
1221
+ and the value is the version to use.
1222
+ libraries : Dict[str, str], default {}
1223
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1224
+ python : str, optional, default None
1225
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1226
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1227
+ disabled : bool, default False
1228
+ If set to True, disables Conda.
1229
+ """
1230
+ ...
1231
+
1232
+ @typing.overload
1233
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1234
+ ...
1235
+
1236
+ 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):
1237
+ """
1238
+ Specifies the Conda environment for all steps of the flow.
1239
+
1240
+ Use `@conda_base` to set common libraries required by all
1241
+ steps and use `@conda` to specify step-specific additions.
1242
+
1243
+ Parameters
1244
+ ----------
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.
1255
+ """
1256
+ ...
1257
+
1258
+ @typing.overload
1259
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1260
+ """
1261
+ Specifies the PyPI packages for all steps of the flow.
1262
+
1263
+ Use `@pypi_base` to set common packages required by all
1264
+ steps and use `@pypi` to specify step-specific overrides.
1265
+ Parameters
1266
+ ----------
1267
+ packages : Dict[str, str], default: {}
1268
+ Packages to use for this flow. The key is the name of the package
1269
+ and the value is the version to use.
1270
+ python : str, optional, default: None
1271
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1272
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1273
+ """
1274
+ ...
1275
+
1276
+ @typing.overload
1277
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1278
+ ...
1279
+
1280
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1281
+ """
1282
+ Specifies the PyPI packages for all steps of the flow.
1283
+
1284
+ Use `@pypi_base` to set common packages required by all
1285
+ steps and use `@pypi` to specify step-specific overrides.
1286
+ Parameters
1287
+ ----------
1288
+ packages : Dict[str, str], default: {}
1289
+ Packages to use for this flow. The key is the name of the package
1290
+ and the value is the version to use.
1291
+ python : str, optional, default: None
1292
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1293
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1294
+ """
1295
+ ...
1296
+
1297
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1298
+ """
1299
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1300
+
1301
+ User code call
1302
+ -----------
1303
+ @nim(
1304
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1305
+ backend='managed'
1306
+ )
1307
+
1308
+ Valid backend options
1309
+ ---------------------
1310
+ - 'managed': Outerbounds selects a compute provider based on the model.
1311
+ - 🚧 'dataplane': Run in your account.
1312
+
1313
+ Valid model options
1314
+ ----------------
1315
+ - 'meta/llama3-8b-instruct': 8B parameter model
1316
+ - 'meta/llama3-70b-instruct': 70B parameter model
1317
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1318
+
1319
+ Parameters
1320
+ ----------
1321
+ models: list[NIM]
1322
+ List of NIM containers running models in sidecars.
1323
+ backend: str
1324
+ Compute provider to run the NIM container.
1274
1325
  """
1275
1326
  ...
1276
1327
 
@@ -1369,125 +1420,21 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1369
1420
  """
1370
1421
  ...
1371
1422
 
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
- """
1412
- ...
1413
-
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]]:
1416
- """
1417
- Specifies the Conda environment for all steps of the flow.
1418
-
1419
- Use `@conda_base` to set common libraries required by all
1420
- steps and use `@conda` to specify step-specific additions.
1421
-
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):
1423
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1442
1424
  """
1443
- Specifies the Conda environment for all steps of the flow.
1425
+ Specifies what flows belong to the same project.
1444
1426
 
1445
- Use `@conda_base` to set common libraries required by all
1446
- steps and use `@conda` to specify step-specific additions.
1427
+ A project-specific namespace is created for all flows that
1428
+ use the same `@project(name)`.
1447
1429
 
1448
1430
  Parameters
1449
1431
  ----------
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.
1460
- """
1461
- ...
1462
-
1463
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1464
- """
1465
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1466
-
1467
- User code call
1468
- -----------
1469
- @nim(
1470
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1471
- backend='managed'
1472
- )
1473
-
1474
- Valid backend options
1475
- ---------------------
1476
- - 'managed': Outerbounds selects a compute provider based on the model.
1477
- - 🚧 'dataplane': Run in your account.
1432
+ name : str
1433
+ Project name. Make sure that the name is unique amongst all
1434
+ projects that use the same production scheduler. The name may
1435
+ contain only lowercase alphanumeric characters and underscores.
1478
1436
 
1479
- Valid model options
1480
- ----------------
1481
- - 'meta/llama3-8b-instruct': 8B parameter model
1482
- - 'meta/llama3-70b-instruct': 70B parameter model
1483
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1484
1437
 
1485
- Parameters
1486
- ----------
1487
- models: list[NIM]
1488
- List of NIM containers running models in sidecars.
1489
- backend: str
1490
- Compute provider to run the NIM container.
1491
1438
  """
1492
1439
  ...
1493
1440
 
@@ -1540,6 +1487,90 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1540
1487
  """
1541
1488
  ...
1542
1489
 
1490
+ 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]]:
1491
+ """
1492
+ 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)
1493
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1494
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1495
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1496
+ starts only after all sensors finish.
1497
+
1498
+ Parameters
1499
+ ----------
1500
+ timeout : int
1501
+ Time, in seconds before the task times out and fails. (Default: 3600)
1502
+ poke_interval : int
1503
+ Time in seconds that the job should wait in between each try. (Default: 60)
1504
+ mode : str
1505
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1506
+ exponential_backoff : bool
1507
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1508
+ pool : str
1509
+ the slot pool this task should run in,
1510
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1511
+ soft_fail : bool
1512
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1513
+ name : str
1514
+ Name of the sensor on Airflow
1515
+ description : str
1516
+ Description of sensor in the Airflow UI
1517
+ bucket_key : Union[str, List[str]]
1518
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1519
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1520
+ bucket_name : str
1521
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1522
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1523
+ wildcard_match : bool
1524
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1525
+ aws_conn_id : str
1526
+ a reference to the s3 connection on Airflow. (Default: None)
1527
+ verify : bool
1528
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1529
+ """
1530
+ ...
1531
+
1532
+ 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]]:
1533
+ """
1534
+ 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.
1535
+ 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.
1536
+
1537
+ Parameters
1538
+ ----------
1539
+ timeout : int
1540
+ Time, in seconds before the task times out and fails. (Default: 3600)
1541
+ poke_interval : int
1542
+ Time in seconds that the job should wait in between each try. (Default: 60)
1543
+ mode : str
1544
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1545
+ exponential_backoff : bool
1546
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1547
+ pool : str
1548
+ the slot pool this task should run in,
1549
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1550
+ soft_fail : bool
1551
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1552
+ name : str
1553
+ Name of the sensor on Airflow
1554
+ description : str
1555
+ Description of sensor in the Airflow UI
1556
+ external_dag_id : str
1557
+ The dag_id that contains the task you want to wait for.
1558
+ external_task_ids : List[str]
1559
+ The list of task_ids that you want to wait for.
1560
+ If None (default value) the sensor waits for the DAG. (Default: None)
1561
+ allowed_states : List[str]
1562
+ Iterable of allowed states, (Default: ['success'])
1563
+ failed_states : List[str]
1564
+ Iterable of failed or dis-allowed states. (Default: None)
1565
+ execution_delta : datetime.timedelta
1566
+ time difference with the previous execution to look at,
1567
+ the default is the same logical date as the current task or DAG. (Default: None)
1568
+ check_existence: bool
1569
+ Set to True to check if the external task exists or check if
1570
+ the DAG to wait for exists. (Default: True)
1571
+ """
1572
+ ...
1573
+
1543
1574
  @typing.overload
1544
1575
  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]]:
1545
1576
  """
@@ -1643,45 +1674,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1643
1674
  """
1644
1675
  ...
1645
1676
 
1646
- @typing.overload
1647
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1648
- """
1649
- Specifies the PyPI packages for all steps of the flow.
1650
-
1651
- Use `@pypi_base` to set common packages required by all
1652
- steps and use `@pypi` to specify step-specific overrides.
1653
- Parameters
1654
- ----------
1655
- packages : Dict[str, str], default: {}
1656
- Packages to use for this flow. The key is the name of the package
1657
- and the value is the version to use.
1658
- python : str, optional, default: None
1659
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1660
- that the version used will correspond to the version of the Python interpreter used to start the run.
1661
- """
1662
- ...
1663
-
1664
- @typing.overload
1665
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1666
- ...
1667
-
1668
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1669
- """
1670
- Specifies the PyPI packages for all steps of the flow.
1671
-
1672
- Use `@pypi_base` to set common packages required by all
1673
- steps and use `@pypi` to specify step-specific overrides.
1674
- Parameters
1675
- ----------
1676
- packages : Dict[str, str], default: {}
1677
- Packages to use for this flow. The key is the name of the package
1678
- and the value is the version to use.
1679
- python : str, optional, default: None
1680
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1681
- that the version used will correspond to the version of the Python interpreter used to start the run.
1682
- """
1683
- ...
1684
-
1685
1677
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1686
1678
  """
1687
1679
  Switch namespace to the one provided.