ob-metaflow-stubs 6.0.3.106__py2.py3-none-any.whl → 6.0.3.107__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 +498 -498
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +2 -2
  5. metaflow-stubs/client/core.pyi +5 -5
  6. metaflow-stubs/client/filecache.pyi +2 -2
  7. metaflow-stubs/clone_util.pyi +1 -1
  8. metaflow-stubs/events.pyi +1 -1
  9. metaflow-stubs/exception.pyi +1 -1
  10. metaflow-stubs/flowspec.pyi +4 -4
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +2 -2
  13. metaflow-stubs/info_file.pyi +1 -1
  14. metaflow-stubs/metadata/metadata.pyi +2 -2
  15. metaflow-stubs/metadata/util.pyi +1 -1
  16. metaflow-stubs/metaflow_config.pyi +1 -1
  17. metaflow-stubs/metaflow_current.pyi +97 -97
  18. metaflow-stubs/mflog/mflog.pyi +1 -1
  19. metaflow-stubs/multicore_utils.pyi +1 -1
  20. metaflow-stubs/parameters.pyi +2 -2
  21. metaflow-stubs/plugins/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  24. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  29. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  30. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  31. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  36. metaflow-stubs/plugins/aws/__init__.pyi +1 -1
  37. metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
  52. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  59. metaflow-stubs/plugins/cards/__init__.pyi +1 -1
  60. metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
  61. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  62. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +1 -1
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  74. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  75. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  76. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  77. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  82. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  83. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  84. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  85. metaflow-stubs/plugins/events_decorator.pyi +1 -1
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  88. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  101. metaflow-stubs/plugins/logs_cli.pyi +2 -2
  102. metaflow-stubs/plugins/package_cli.pyi +1 -1
  103. metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
  104. metaflow-stubs/plugins/perimeters.pyi +1 -1
  105. metaflow-stubs/plugins/project_decorator.pyi +1 -1
  106. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  112. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  113. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  114. metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  117. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  118. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  120. metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
  121. metaflow-stubs/procpoll.pyi +1 -1
  122. metaflow-stubs/profilers/__init__.pyi +1 -1
  123. metaflow-stubs/pylint_wrapper.pyi +1 -1
  124. metaflow-stubs/runner/__init__.pyi +1 -1
  125. metaflow-stubs/runner/deployer.pyi +2 -2
  126. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  127. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  128. metaflow-stubs/runner/nbrun.pyi +1 -1
  129. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  130. metaflow-stubs/runner/utils.pyi +1 -1
  131. metaflow-stubs/system/__init__.pyi +2 -2
  132. metaflow-stubs/system/system_logger.pyi +2 -2
  133. metaflow-stubs/system/system_monitor.pyi +1 -1
  134. metaflow-stubs/tagging_util.pyi +1 -1
  135. metaflow-stubs/tuple_util.pyi +1 -1
  136. {ob_metaflow_stubs-6.0.3.106.dist-info → ob_metaflow_stubs-6.0.3.107.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.107.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.106.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.106.dist-info → ob_metaflow_stubs-6.0.3.107.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.106.dist-info → ob_metaflow_stubs-6.0.3.107.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
- # Generated on 2024-10-04T19:10:58.884265 #
4
+ # Generated on 2024-10-07T18:39:02.357763 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow._vendor.click.types
12
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
13
- import metaflow.parameters
14
11
  import metaflow.metaflow_current
12
+ import metaflow._vendor.click.types
13
+ import metaflow.client.core
15
14
  import datetime
15
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
16
16
  import typing
17
- import metaflow.events
18
- import metaflow.runner.metaflow_runner
19
- import metaflow.datastore.inputs
20
17
  import metaflow.flowspec
21
- import metaflow.client.core
18
+ import metaflow.parameters
19
+ import metaflow.datastore.inputs
20
+ import metaflow.runner.metaflow_runner
21
+ import metaflow.events
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -513,120 +513,100 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
513
513
  ...
514
514
 
515
515
  @typing.overload
516
- 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]]]:
516
+ 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]]]:
517
517
  """
518
- Enables loading / saving of models within a step.
518
+ Specifies that the step will success under all circumstances.
519
519
 
520
+ The decorator will create an optional artifact, specified by `var`, which
521
+ contains the exception raised. You can use it to detect the presence
522
+ of errors, indicating that all happy-path artifacts produced by the step
523
+ are missing.
520
524
 
521
525
  Parameters
522
526
  ----------
523
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
524
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
525
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
526
- - `current.checkpoint`
527
- - `current.model`
528
- - `current.huggingface_hub`
529
-
530
- 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
531
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
532
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
533
-
534
- temp_dir_root : str, default: None
535
- The root directory under which `current.model.loaded` will store loaded models
536
-
537
-
538
-
527
+ var : str, optional, default None
528
+ Name of the artifact in which to store the caught exception.
529
+ If not specified, the exception is not stored.
530
+ print_exception : bool, default True
531
+ Determines whether or not the exception is printed to
532
+ stdout when caught.
539
533
  """
540
534
  ...
541
535
 
542
536
  @typing.overload
543
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
537
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
544
538
  ...
545
539
 
546
540
  @typing.overload
547
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
541
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
548
542
  ...
549
543
 
550
- 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):
544
+ 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):
551
545
  """
552
- Enables loading / saving of models within a step.
546
+ Specifies that the step will success under all circumstances.
553
547
 
548
+ The decorator will create an optional artifact, specified by `var`, which
549
+ contains the exception raised. You can use it to detect the presence
550
+ of errors, indicating that all happy-path artifacts produced by the step
551
+ are missing.
554
552
 
555
553
  Parameters
556
554
  ----------
557
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
558
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
559
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
560
- - `current.checkpoint`
561
- - `current.model`
562
- - `current.huggingface_hub`
563
-
564
- 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
565
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
566
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
567
-
568
- temp_dir_root : str, default: None
569
- The root directory under which `current.model.loaded` will store loaded models
570
-
571
-
572
-
555
+ var : str, optional, default None
556
+ Name of the artifact in which to store the caught exception.
557
+ If not specified, the exception is not stored.
558
+ print_exception : bool, default True
559
+ Determines whether or not the exception is printed to
560
+ stdout when caught.
573
561
  """
574
562
  ...
575
563
 
576
564
  @typing.overload
577
- 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]]]:
565
+ 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]]]:
578
566
  """
579
- Specifies the Conda environment for the step.
567
+ Specifies the PyPI packages for the step.
580
568
 
581
569
  Information in this decorator will augment any
582
- attributes set in the `@conda_base` flow-level decorator. Hence,
583
- you can use `@conda_base` to set packages required by all
584
- steps and use `@conda` to specify step-specific overrides.
570
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
571
+ you can use `@pypi_base` to set packages required by all
572
+ steps and use `@pypi` to specify step-specific overrides.
585
573
 
586
574
  Parameters
587
575
  ----------
588
- packages : Dict[str, str], default {}
576
+ packages : Dict[str, str], default: {}
589
577
  Packages to use for this step. The key is the name of the package
590
578
  and the value is the version to use.
591
- libraries : Dict[str, str], default {}
592
- Supported for backward compatibility. When used with packages, packages will take precedence.
593
- python : str, optional, default None
579
+ python : str, optional, default: None
594
580
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
595
581
  that the version used will correspond to the version of the Python interpreter used to start the run.
596
- disabled : bool, default False
597
- If set to True, disables @conda.
598
582
  """
599
583
  ...
600
584
 
601
585
  @typing.overload
602
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
586
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
603
587
  ...
604
588
 
605
589
  @typing.overload
606
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
590
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
607
591
  ...
608
592
 
609
- 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):
593
+ 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):
610
594
  """
611
- Specifies the Conda environment for the step.
595
+ Specifies the PyPI packages for the step.
612
596
 
613
597
  Information in this decorator will augment any
614
- attributes set in the `@conda_base` flow-level decorator. Hence,
615
- you can use `@conda_base` to set packages required by all
616
- steps and use `@conda` to specify step-specific overrides.
598
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
599
+ you can use `@pypi_base` to set packages required by all
600
+ steps and use `@pypi` to specify step-specific overrides.
617
601
 
618
602
  Parameters
619
603
  ----------
620
- packages : Dict[str, str], default {}
604
+ packages : Dict[str, str], default: {}
621
605
  Packages to use for this step. The key is the name of the package
622
606
  and the value is the version to use.
623
- libraries : Dict[str, str], default {}
624
- Supported for backward compatibility. When used with packages, packages will take precedence.
625
- python : str, optional, default None
607
+ python : str, optional, default: None
626
608
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
627
609
  that the version used will correspond to the version of the Python interpreter used to start the run.
628
- disabled : bool, default False
629
- If set to True, disables @conda.
630
610
  """
631
611
  ...
632
612
 
@@ -648,115 +628,63 @@ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepF
648
628
  ...
649
629
 
650
630
  @typing.overload
651
- 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]]]:
631
+ 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]]]:
652
632
  """
653
- Specifies that the step will success under all circumstances.
633
+ Enables checkpointing for a step.
654
634
 
655
- The decorator will create an optional artifact, specified by `var`, which
656
- contains the exception raised. You can use it to detect the presence
657
- of errors, indicating that all happy-path artifacts produced by the step
658
- are missing.
659
635
 
660
636
  Parameters
661
637
  ----------
662
- var : str, optional, default None
663
- Name of the artifact in which to store the caught exception.
664
- If not specified, the exception is not stored.
665
- print_exception : bool, default True
666
- Determines whether or not the exception is printed to
667
- stdout when caught.
668
- """
669
- ...
670
-
671
- @typing.overload
672
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
673
- ...
674
-
675
- @typing.overload
676
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
677
- ...
678
-
679
- 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):
680
- """
681
- Specifies that the step will success under all circumstances.
638
+ load_policy : str, default: "fresh"
639
+ The policy for loading the checkpoint. The following policies are supported:
640
+ - "eager": Loads the the latest available checkpoint within the namespace.
641
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
642
+ will be loaded at the start of the task.
643
+ - "none": Do not load any checkpoint
644
+ - "fresh": Loads the lastest checkpoint created within the running Task.
645
+ This mode helps loading checkpoints across various retry attempts of the same task.
646
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
647
+ created within the task will be loaded when the task is retries execution on failure.
648
+
649
+ temp_dir_root : str, default: None
650
+ The root directory under which `current.checkpoint.directory` will be created.
682
651
 
683
- The decorator will create an optional artifact, specified by `var`, which
684
- contains the exception raised. You can use it to detect the presence
685
- of errors, indicating that all happy-path artifacts produced by the step
686
- are missing.
687
652
 
688
- Parameters
689
- ----------
690
- var : str, optional, default None
691
- Name of the artifact in which to store the caught exception.
692
- If not specified, the exception is not stored.
693
- print_exception : bool, default True
694
- Determines whether or not the exception is printed to
695
- stdout when caught.
696
- """
697
- ...
698
-
699
- @typing.overload
700
- 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]]]:
701
- """
702
- Specifies secrets to be retrieved and injected as environment variables prior to
703
- the execution of a step.
704
653
 
705
- Parameters
706
- ----------
707
- sources : List[Union[str, Dict[str, Any]]], default: []
708
- List of secret specs, defining how the secrets are to be retrieved
709
654
  """
710
655
  ...
711
656
 
712
657
  @typing.overload
713
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
658
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
714
659
  ...
715
660
 
716
661
  @typing.overload
717
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
662
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
718
663
  ...
719
664
 
720
- 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]]] = []):
665
+ 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):
721
666
  """
722
- Specifies secrets to be retrieved and injected as environment variables prior to
723
- the execution of a step.
667
+ Enables checkpointing for a step.
724
668
 
725
- Parameters
726
- ----------
727
- sources : List[Union[str, Dict[str, Any]]], default: []
728
- List of secret specs, defining how the secrets are to be retrieved
729
- """
730
- ...
731
-
732
- @typing.overload
733
- 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]]]:
734
- """
735
- Specifies environment variables to be set prior to the execution of a step.
736
669
 
737
670
  Parameters
738
671
  ----------
739
- vars : Dict[str, str], default {}
740
- Dictionary of environment variables to set.
741
- """
742
- ...
743
-
744
- @typing.overload
745
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
746
- ...
747
-
748
- @typing.overload
749
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
750
- ...
751
-
752
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
753
- """
754
- Specifies environment variables to be set prior to the execution of a step.
672
+ load_policy : str, default: "fresh"
673
+ The policy for loading the checkpoint. The following policies are supported:
674
+ - "eager": Loads the the latest available checkpoint within the namespace.
675
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
676
+ will be loaded at the start of the task.
677
+ - "none": Do not load any checkpoint
678
+ - "fresh": Loads the lastest checkpoint created within the running Task.
679
+ This mode helps loading checkpoints across various retry attempts of the same task.
680
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
681
+ created within the task will be loaded when the task is retries execution on failure.
682
+
683
+ temp_dir_root : str, default: None
684
+ The root directory under which `current.checkpoint.directory` will be created.
685
+
686
+
755
687
 
756
- Parameters
757
- ----------
758
- vars : Dict[str, str], default {}
759
- Dictionary of environment variables to set.
760
688
  """
761
689
  ...
762
690
 
@@ -838,155 +766,172 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
838
766
  ...
839
767
 
840
768
  @typing.overload
841
- 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]]]:
769
+ 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]]]:
842
770
  """
843
- Specifies the number of times the task corresponding
844
- to a step needs to be retried.
845
-
846
- This decorator is useful for handling transient errors, such as networking issues.
847
- If your task contains operations that can't be retried safely, e.g. database updates,
848
- it is advisable to annotate it with `@retry(times=0)`.
771
+ Enables loading / saving of models within a step.
849
772
 
850
- This can be used in conjunction with the `@catch` decorator. The `@catch`
851
- decorator will execute a no-op task after all retries have been exhausted,
852
- ensuring that the flow execution can continue.
853
773
 
854
774
  Parameters
855
775
  ----------
856
- times : int, default 3
857
- Number of times to retry this task.
858
- minutes_between_retries : int, default 2
859
- Number of minutes between retries.
860
- """
861
- ...
776
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
777
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
778
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
779
+ - `current.checkpoint`
780
+ - `current.model`
781
+ - `current.huggingface_hub`
782
+
783
+ 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
784
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
785
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
786
+
787
+ temp_dir_root : str, default: None
788
+ The root directory under which `current.model.loaded` will store loaded models
789
+
790
+
791
+
792
+ """
793
+ ...
862
794
 
863
795
  @typing.overload
864
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
796
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
865
797
  ...
866
798
 
867
799
  @typing.overload
868
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
800
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
869
801
  ...
870
802
 
871
- 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):
803
+ 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):
872
804
  """
873
- Specifies the number of times the task corresponding
874
- to a step needs to be retried.
805
+ Enables loading / saving of models within a step.
875
806
 
876
- This decorator is useful for handling transient errors, such as networking issues.
877
- If your task contains operations that can't be retried safely, e.g. database updates,
878
- it is advisable to annotate it with `@retry(times=0)`.
879
-
880
- This can be used in conjunction with the `@catch` decorator. The `@catch`
881
- decorator will execute a no-op task after all retries have been exhausted,
882
- ensuring that the flow execution can continue.
883
807
 
884
808
  Parameters
885
809
  ----------
886
- times : int, default 3
887
- Number of times to retry this task.
888
- minutes_between_retries : int, default 2
889
- Number of minutes between retries.
810
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
811
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
812
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
813
+ - `current.checkpoint`
814
+ - `current.model`
815
+ - `current.huggingface_hub`
816
+
817
+ 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
818
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
819
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
820
+
821
+ temp_dir_root : str, default: None
822
+ The root directory under which `current.model.loaded` will store loaded models
823
+
824
+
825
+
890
826
  """
891
827
  ...
892
828
 
893
829
  @typing.overload
894
- 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]]]:
830
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
895
831
  """
896
- Creates a human-readable report, a Metaflow Card, after this step completes.
897
-
898
- Note that you may add multiple `@card` decorators in a step with different parameters.
832
+ Decorator prototype for all step decorators. This function gets specialized
833
+ and imported for all decorators types by _import_plugin_decorators().
834
+ """
835
+ ...
836
+
837
+ @typing.overload
838
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
839
+ ...
840
+
841
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
842
+ """
843
+ Decorator prototype for all step decorators. This function gets specialized
844
+ and imported for all decorators types by _import_plugin_decorators().
845
+ """
846
+ ...
847
+
848
+ @typing.overload
849
+ 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]]]:
850
+ """
851
+ Specifies secrets to be retrieved and injected as environment variables prior to
852
+ the execution of a step.
899
853
 
900
854
  Parameters
901
855
  ----------
902
- type : str, default 'default'
903
- Card type.
904
- id : str, optional, default None
905
- If multiple cards are present, use this id to identify this card.
906
- options : Dict[str, Any], default {}
907
- Options passed to the card. The contents depend on the card type.
908
- timeout : int, default 45
909
- Interrupt reporting if it takes more than this many seconds.
910
-
911
-
856
+ sources : List[Union[str, Dict[str, Any]]], default: []
857
+ List of secret specs, defining how the secrets are to be retrieved
912
858
  """
913
859
  ...
914
860
 
915
861
  @typing.overload
916
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
862
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
917
863
  ...
918
864
 
919
865
  @typing.overload
920
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
866
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
921
867
  ...
922
868
 
923
- 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):
869
+ 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]]] = []):
924
870
  """
925
- Creates a human-readable report, a Metaflow Card, after this step completes.
926
-
927
- Note that you may add multiple `@card` decorators in a step with different parameters.
871
+ Specifies secrets to be retrieved and injected as environment variables prior to
872
+ the execution of a step.
928
873
 
929
874
  Parameters
930
875
  ----------
931
- type : str, default 'default'
932
- Card type.
933
- id : str, optional, default None
934
- If multiple cards are present, use this id to identify this card.
935
- options : Dict[str, Any], default {}
936
- Options passed to the card. The contents depend on the card type.
937
- timeout : int, default 45
938
- Interrupt reporting if it takes more than this many seconds.
939
-
940
-
876
+ sources : List[Union[str, Dict[str, Any]]], default: []
877
+ List of secret specs, defining how the secrets are to be retrieved
941
878
  """
942
879
  ...
943
880
 
944
881
  @typing.overload
945
- 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]]]:
882
+ 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]]]:
946
883
  """
947
- Specifies the PyPI packages for the step.
884
+ Specifies the Conda environment for the step.
948
885
 
949
886
  Information in this decorator will augment any
950
- attributes set in the `@pyi_base` flow-level decorator. Hence,
951
- you can use `@pypi_base` to set packages required by all
952
- steps and use `@pypi` to specify step-specific overrides.
887
+ attributes set in the `@conda_base` flow-level decorator. Hence,
888
+ you can use `@conda_base` to set packages required by all
889
+ steps and use `@conda` to specify step-specific overrides.
953
890
 
954
891
  Parameters
955
892
  ----------
956
- packages : Dict[str, str], default: {}
893
+ packages : Dict[str, str], default {}
957
894
  Packages to use for this step. The key is the name of the package
958
895
  and the value is the version to use.
959
- python : str, optional, default: None
896
+ libraries : Dict[str, str], default {}
897
+ Supported for backward compatibility. When used with packages, packages will take precedence.
898
+ python : str, optional, default None
960
899
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
961
900
  that the version used will correspond to the version of the Python interpreter used to start the run.
901
+ disabled : bool, default False
902
+ If set to True, disables @conda.
962
903
  """
963
904
  ...
964
905
 
965
906
  @typing.overload
966
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
907
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
967
908
  ...
968
909
 
969
910
  @typing.overload
970
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
911
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
971
912
  ...
972
913
 
973
- 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):
914
+ 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):
974
915
  """
975
- Specifies the PyPI packages for the step.
916
+ Specifies the Conda environment for the step.
976
917
 
977
918
  Information in this decorator will augment any
978
- attributes set in the `@pyi_base` flow-level decorator. Hence,
979
- you can use `@pypi_base` to set packages required by all
980
- steps and use `@pypi` to specify step-specific overrides.
919
+ attributes set in the `@conda_base` flow-level decorator. Hence,
920
+ you can use `@conda_base` to set packages required by all
921
+ steps and use `@conda` to specify step-specific overrides.
981
922
 
982
923
  Parameters
983
924
  ----------
984
- packages : Dict[str, str], default: {}
925
+ packages : Dict[str, str], default {}
985
926
  Packages to use for this step. The key is the name of the package
986
927
  and the value is the version to use.
987
- python : str, optional, default: None
928
+ libraries : Dict[str, str], default {}
929
+ Supported for backward compatibility. When used with packages, packages will take precedence.
930
+ python : str, optional, default None
988
931
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
989
932
  that the version used will correspond to the version of the Python interpreter used to start the run.
933
+ disabled : bool, default False
934
+ If set to True, disables @conda.
990
935
  """
991
936
  ...
992
937
 
@@ -1047,6 +992,141 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
1047
992
  """
1048
993
  ...
1049
994
 
995
+ @typing.overload
996
+ 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]]]:
997
+ """
998
+ Specifies the number of times the task corresponding
999
+ to a step needs to be retried.
1000
+
1001
+ This decorator is useful for handling transient errors, such as networking issues.
1002
+ If your task contains operations that can't be retried safely, e.g. database updates,
1003
+ it is advisable to annotate it with `@retry(times=0)`.
1004
+
1005
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1006
+ decorator will execute a no-op task after all retries have been exhausted,
1007
+ ensuring that the flow execution can continue.
1008
+
1009
+ Parameters
1010
+ ----------
1011
+ times : int, default 3
1012
+ Number of times to retry this task.
1013
+ minutes_between_retries : int, default 2
1014
+ Number of minutes between retries.
1015
+ """
1016
+ ...
1017
+
1018
+ @typing.overload
1019
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1020
+ ...
1021
+
1022
+ @typing.overload
1023
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1024
+ ...
1025
+
1026
+ 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):
1027
+ """
1028
+ Specifies the number of times the task corresponding
1029
+ to a step needs to be retried.
1030
+
1031
+ This decorator is useful for handling transient errors, such as networking issues.
1032
+ If your task contains operations that can't be retried safely, e.g. database updates,
1033
+ it is advisable to annotate it with `@retry(times=0)`.
1034
+
1035
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1036
+ decorator will execute a no-op task after all retries have been exhausted,
1037
+ ensuring that the flow execution can continue.
1038
+
1039
+ Parameters
1040
+ ----------
1041
+ times : int, default 3
1042
+ Number of times to retry this task.
1043
+ minutes_between_retries : int, default 2
1044
+ Number of minutes between retries.
1045
+ """
1046
+ ...
1047
+
1048
+ @typing.overload
1049
+ 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]]]:
1050
+ """
1051
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1052
+
1053
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1054
+
1055
+ Parameters
1056
+ ----------
1057
+ type : str, default 'default'
1058
+ Card type.
1059
+ id : str, optional, default None
1060
+ If multiple cards are present, use this id to identify this card.
1061
+ options : Dict[str, Any], default {}
1062
+ Options passed to the card. The contents depend on the card type.
1063
+ timeout : int, default 45
1064
+ Interrupt reporting if it takes more than this many seconds.
1065
+
1066
+
1067
+ """
1068
+ ...
1069
+
1070
+ @typing.overload
1071
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1072
+ ...
1073
+
1074
+ @typing.overload
1075
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1076
+ ...
1077
+
1078
+ 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):
1079
+ """
1080
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1081
+
1082
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1083
+
1084
+ Parameters
1085
+ ----------
1086
+ type : str, default 'default'
1087
+ Card type.
1088
+ id : str, optional, default None
1089
+ If multiple cards are present, use this id to identify this card.
1090
+ options : Dict[str, Any], default {}
1091
+ Options passed to the card. The contents depend on the card type.
1092
+ timeout : int, default 45
1093
+ Interrupt reporting if it takes more than this many seconds.
1094
+
1095
+
1096
+ """
1097
+ ...
1098
+
1099
+ @typing.overload
1100
+ 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]]]:
1101
+ """
1102
+ Specifies environment variables to be set prior to the execution of a step.
1103
+
1104
+ Parameters
1105
+ ----------
1106
+ vars : Dict[str, str], default {}
1107
+ Dictionary of environment variables to set.
1108
+ """
1109
+ ...
1110
+
1111
+ @typing.overload
1112
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1113
+ ...
1114
+
1115
+ @typing.overload
1116
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1117
+ ...
1118
+
1119
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1120
+ """
1121
+ Specifies environment variables to be set prior to the execution of a step.
1122
+
1123
+ Parameters
1124
+ ----------
1125
+ vars : Dict[str, str], default {}
1126
+ Dictionary of environment variables to set.
1127
+ """
1128
+ ...
1129
+
1050
1130
  def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1051
1131
  """
1052
1132
  Specifies that this step should execute on Kubernetes.
@@ -1113,146 +1193,6 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
1113
1193
  """
1114
1194
  ...
1115
1195
 
1116
- @typing.overload
1117
- 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]]]:
1118
- """
1119
- Enables checkpointing for a step.
1120
-
1121
-
1122
- Parameters
1123
- ----------
1124
- load_policy : str, default: "fresh"
1125
- The policy for loading the checkpoint. The following policies are supported:
1126
- - "eager": Loads the the latest available checkpoint within the namespace.
1127
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1128
- will be loaded at the start of the task.
1129
- - "none": Do not load any checkpoint
1130
- - "fresh": Loads the lastest checkpoint created within the running Task.
1131
- This mode helps loading checkpoints across various retry attempts of the same task.
1132
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1133
- created within the task will be loaded when the task is retries execution on failure.
1134
-
1135
- temp_dir_root : str, default: None
1136
- The root directory under which `current.checkpoint.directory` will be created.
1137
-
1138
-
1139
-
1140
- """
1141
- ...
1142
-
1143
- @typing.overload
1144
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1145
- ...
1146
-
1147
- @typing.overload
1148
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1149
- ...
1150
-
1151
- 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):
1152
- """
1153
- Enables checkpointing for a step.
1154
-
1155
-
1156
- Parameters
1157
- ----------
1158
- load_policy : str, default: "fresh"
1159
- The policy for loading the checkpoint. The following policies are supported:
1160
- - "eager": Loads the the latest available checkpoint within the namespace.
1161
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1162
- will be loaded at the start of the task.
1163
- - "none": Do not load any checkpoint
1164
- - "fresh": Loads the lastest checkpoint created within the running Task.
1165
- This mode helps loading checkpoints across various retry attempts of the same task.
1166
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1167
- created within the task will be loaded when the task is retries execution on failure.
1168
-
1169
- temp_dir_root : str, default: None
1170
- The root directory under which `current.checkpoint.directory` will be created.
1171
-
1172
-
1173
-
1174
- """
1175
- ...
1176
-
1177
- @typing.overload
1178
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1179
- """
1180
- Decorator prototype for all step decorators. This function gets specialized
1181
- and imported for all decorators types by _import_plugin_decorators().
1182
- """
1183
- ...
1184
-
1185
- @typing.overload
1186
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1187
- ...
1188
-
1189
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1190
- """
1191
- Decorator prototype for all step decorators. This function gets specialized
1192
- and imported for all decorators types by _import_plugin_decorators().
1193
- """
1194
- ...
1195
-
1196
- 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]]:
1197
- """
1198
- 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.
1199
- 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.
1200
-
1201
- Parameters
1202
- ----------
1203
- timeout : int
1204
- Time, in seconds before the task times out and fails. (Default: 3600)
1205
- poke_interval : int
1206
- Time in seconds that the job should wait in between each try. (Default: 60)
1207
- mode : str
1208
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1209
- exponential_backoff : bool
1210
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1211
- pool : str
1212
- the slot pool this task should run in,
1213
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1214
- soft_fail : bool
1215
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1216
- name : str
1217
- Name of the sensor on Airflow
1218
- description : str
1219
- Description of sensor in the Airflow UI
1220
- external_dag_id : str
1221
- The dag_id that contains the task you want to wait for.
1222
- external_task_ids : List[str]
1223
- The list of task_ids that you want to wait for.
1224
- If None (default value) the sensor waits for the DAG. (Default: None)
1225
- allowed_states : List[str]
1226
- Iterable of allowed states, (Default: ['success'])
1227
- failed_states : List[str]
1228
- Iterable of failed or dis-allowed states. (Default: None)
1229
- execution_delta : datetime.timedelta
1230
- time difference with the previous execution to look at,
1231
- the default is the same logical date as the current task or DAG. (Default: None)
1232
- check_existence: bool
1233
- Set to True to check if the external task exists or check if
1234
- the DAG to wait for exists. (Default: True)
1235
- """
1236
- ...
1237
-
1238
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1239
- """
1240
- Specifies what flows belong to the same project.
1241
-
1242
- A project-specific namespace is created for all flows that
1243
- use the same `@project(name)`.
1244
-
1245
- Parameters
1246
- ----------
1247
- name : str
1248
- Project name. Make sure that the name is unique amongst all
1249
- projects that use the same production scheduler. The name may
1250
- contain only lowercase alphanumeric characters and underscores.
1251
-
1252
-
1253
- """
1254
- ...
1255
-
1256
1196
  @typing.overload
1257
1197
  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]]:
1258
1198
  """
@@ -1303,51 +1243,97 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1303
1243
  ...
1304
1244
 
1305
1245
  @typing.overload
1306
- 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]]:
1246
+ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1307
1247
  """
1308
- Specifies the Conda environment for all steps of the flow.
1248
+ Specifies the event(s) that this flow depends on.
1309
1249
 
1310
- Use `@conda_base` to set common libraries required by all
1311
- steps and use `@conda` to specify step-specific additions.
1250
+ ```
1251
+ @trigger(event='foo')
1252
+ ```
1253
+ or
1254
+ ```
1255
+ @trigger(events=['foo', 'bar'])
1256
+ ```
1257
+
1258
+ Additionally, you can specify the parameter mappings
1259
+ to map event payload to Metaflow parameters for the flow.
1260
+ ```
1261
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1262
+ ```
1263
+ or
1264
+ ```
1265
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1266
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1267
+ ```
1268
+
1269
+ 'parameters' can also be a list of strings and tuples like so:
1270
+ ```
1271
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1272
+ ```
1273
+ This is equivalent to:
1274
+ ```
1275
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1276
+ ```
1312
1277
 
1313
1278
  Parameters
1314
1279
  ----------
1315
- packages : Dict[str, str], default {}
1316
- Packages to use for this flow. The key is the name of the package
1317
- and the value is the version to use.
1318
- libraries : Dict[str, str], default {}
1319
- Supported for backward compatibility. When used with packages, packages will take precedence.
1320
- python : str, optional, default None
1321
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1322
- that the version used will correspond to the version of the Python interpreter used to start the run.
1323
- disabled : bool, default False
1324
- If set to True, disables Conda.
1280
+ event : Union[str, Dict[str, Any]], optional, default None
1281
+ Event dependency for this flow.
1282
+ events : List[Union[str, Dict[str, Any]]], default []
1283
+ Events dependency for this flow.
1284
+ options : Dict[str, Any], default {}
1285
+ Backend-specific configuration for tuning eventing behavior.
1286
+
1287
+
1325
1288
  """
1326
1289
  ...
1327
1290
 
1328
1291
  @typing.overload
1329
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1292
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1330
1293
  ...
1331
1294
 
1332
- 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):
1295
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1333
1296
  """
1334
- Specifies the Conda environment for all steps of the flow.
1297
+ Specifies the event(s) that this flow depends on.
1335
1298
 
1336
- Use `@conda_base` to set common libraries required by all
1337
- steps and use `@conda` to specify step-specific additions.
1299
+ ```
1300
+ @trigger(event='foo')
1301
+ ```
1302
+ or
1303
+ ```
1304
+ @trigger(events=['foo', 'bar'])
1305
+ ```
1306
+
1307
+ Additionally, you can specify the parameter mappings
1308
+ to map event payload to Metaflow parameters for the flow.
1309
+ ```
1310
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1311
+ ```
1312
+ or
1313
+ ```
1314
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1315
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1316
+ ```
1317
+
1318
+ 'parameters' can also be a list of strings and tuples like so:
1319
+ ```
1320
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1321
+ ```
1322
+ This is equivalent to:
1323
+ ```
1324
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1325
+ ```
1338
1326
 
1339
1327
  Parameters
1340
1328
  ----------
1341
- packages : Dict[str, str], default {}
1342
- Packages to use for this flow. The key is the name of the package
1343
- and the value is the version to use.
1344
- libraries : Dict[str, str], default {}
1345
- Supported for backward compatibility. When used with packages, packages will take precedence.
1346
- python : str, optional, default None
1347
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1348
- that the version used will correspond to the version of the Python interpreter used to start the run.
1349
- disabled : bool, default False
1350
- If set to True, disables Conda.
1329
+ event : Union[str, Dict[str, Any]], optional, default None
1330
+ Event dependency for this flow.
1331
+ events : List[Union[str, Dict[str, Any]]], default []
1332
+ Events dependency for this flow.
1333
+ options : Dict[str, Any], default {}
1334
+ Backend-specific configuration for tuning eventing behavior.
1335
+
1336
+
1351
1337
  """
1352
1338
  ...
1353
1339
 
@@ -1382,6 +1368,24 @@ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[Fl
1382
1368
  """
1383
1369
  ...
1384
1370
 
1371
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1372
+ """
1373
+ Specifies what flows belong to the same project.
1374
+
1375
+ A project-specific namespace is created for all flows that
1376
+ use the same `@project(name)`.
1377
+
1378
+ Parameters
1379
+ ----------
1380
+ name : str
1381
+ Project name. Make sure that the name is unique amongst all
1382
+ projects that use the same production scheduler. The name may
1383
+ contain only lowercase alphanumeric characters and underscores.
1384
+
1385
+
1386
+ """
1387
+ ...
1388
+
1385
1389
  @typing.overload
1386
1390
  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]]:
1387
1391
  """
@@ -1524,101 +1528,6 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1524
1528
  """
1525
1529
  ...
1526
1530
 
1527
- @typing.overload
1528
- def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1529
- """
1530
- Specifies the event(s) that this flow depends on.
1531
-
1532
- ```
1533
- @trigger(event='foo')
1534
- ```
1535
- or
1536
- ```
1537
- @trigger(events=['foo', 'bar'])
1538
- ```
1539
-
1540
- Additionally, you can specify the parameter mappings
1541
- to map event payload to Metaflow parameters for the flow.
1542
- ```
1543
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1544
- ```
1545
- or
1546
- ```
1547
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1548
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1549
- ```
1550
-
1551
- 'parameters' can also be a list of strings and tuples like so:
1552
- ```
1553
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1554
- ```
1555
- This is equivalent to:
1556
- ```
1557
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1558
- ```
1559
-
1560
- Parameters
1561
- ----------
1562
- event : Union[str, Dict[str, Any]], optional, default None
1563
- Event dependency for this flow.
1564
- events : List[Union[str, Dict[str, Any]]], default []
1565
- Events dependency for this flow.
1566
- options : Dict[str, Any], default {}
1567
- Backend-specific configuration for tuning eventing behavior.
1568
-
1569
-
1570
- """
1571
- ...
1572
-
1573
- @typing.overload
1574
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1575
- ...
1576
-
1577
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1578
- """
1579
- Specifies the event(s) that this flow depends on.
1580
-
1581
- ```
1582
- @trigger(event='foo')
1583
- ```
1584
- or
1585
- ```
1586
- @trigger(events=['foo', 'bar'])
1587
- ```
1588
-
1589
- Additionally, you can specify the parameter mappings
1590
- to map event payload to Metaflow parameters for the flow.
1591
- ```
1592
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1593
- ```
1594
- or
1595
- ```
1596
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1597
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1598
- ```
1599
-
1600
- 'parameters' can also be a list of strings and tuples like so:
1601
- ```
1602
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1603
- ```
1604
- This is equivalent to:
1605
- ```
1606
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1607
- ```
1608
-
1609
- Parameters
1610
- ----------
1611
- event : Union[str, Dict[str, Any]], optional, default None
1612
- Event dependency for this flow.
1613
- events : List[Union[str, Dict[str, Any]]], default []
1614
- Events dependency for this flow.
1615
- options : Dict[str, Any], default {}
1616
- Backend-specific configuration for tuning eventing behavior.
1617
-
1618
-
1619
- """
1620
- ...
1621
-
1622
1531
  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]]:
1623
1532
  """
1624
1533
  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)
@@ -1661,6 +1570,97 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1661
1570
  """
1662
1571
  ...
1663
1572
 
1573
+ 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]]:
1574
+ """
1575
+ 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.
1576
+ 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.
1577
+
1578
+ Parameters
1579
+ ----------
1580
+ timeout : int
1581
+ Time, in seconds before the task times out and fails. (Default: 3600)
1582
+ poke_interval : int
1583
+ Time in seconds that the job should wait in between each try. (Default: 60)
1584
+ mode : str
1585
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1586
+ exponential_backoff : bool
1587
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1588
+ pool : str
1589
+ the slot pool this task should run in,
1590
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1591
+ soft_fail : bool
1592
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1593
+ name : str
1594
+ Name of the sensor on Airflow
1595
+ description : str
1596
+ Description of sensor in the Airflow UI
1597
+ external_dag_id : str
1598
+ The dag_id that contains the task you want to wait for.
1599
+ external_task_ids : List[str]
1600
+ The list of task_ids that you want to wait for.
1601
+ If None (default value) the sensor waits for the DAG. (Default: None)
1602
+ allowed_states : List[str]
1603
+ Iterable of allowed states, (Default: ['success'])
1604
+ failed_states : List[str]
1605
+ Iterable of failed or dis-allowed states. (Default: None)
1606
+ execution_delta : datetime.timedelta
1607
+ time difference with the previous execution to look at,
1608
+ the default is the same logical date as the current task or DAG. (Default: None)
1609
+ check_existence: bool
1610
+ Set to True to check if the external task exists or check if
1611
+ the DAG to wait for exists. (Default: True)
1612
+ """
1613
+ ...
1614
+
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]]:
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.
1622
+
1623
+ Parameters
1624
+ ----------
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.
1635
+ """
1636
+ ...
1637
+
1638
+ @typing.overload
1639
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1640
+ ...
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):
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.
1648
+
1649
+ Parameters
1650
+ ----------
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.
1661
+ """
1662
+ ...
1663
+
1664
1664
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1665
1665
  """
1666
1666
  Switch namespace to the one provided.