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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. metaflow-stubs/__init__.pyi +585 -585
  2. metaflow-stubs/cards.pyi +3 -3
  3. metaflow-stubs/cli.pyi +1 -1
  4. metaflow-stubs/client/__init__.pyi +3 -3
  5. metaflow-stubs/client/core.pyi +6 -6
  6. metaflow-stubs/client/filecache.pyi +1 -1
  7. metaflow-stubs/clone_util.pyi +1 -1
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +1 -1
  10. metaflow-stubs/flowspec.pyi +4 -4
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +3 -3
  13. metaflow-stubs/info_file.pyi +1 -1
  14. metaflow-stubs/metadata/metadata.pyi +1 -1
  15. metaflow-stubs/metadata/util.pyi +1 -1
  16. metaflow-stubs/metaflow_config.pyi +1 -1
  17. metaflow-stubs/metaflow_current.pyi +88 -88
  18. metaflow-stubs/mflog/mflog.pyi +1 -1
  19. metaflow-stubs/multicore_utils.pyi +1 -1
  20. metaflow-stubs/parameters.pyi +3 -3
  21. metaflow-stubs/plugins/__init__.pyi +1 -1
  22. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  24. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
  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 +1 -1
  30. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  31. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  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 +1 -1
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  52. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +1 -1
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  59. metaflow-stubs/plugins/cards/__init__.pyi +1 -1
  60. metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
  61. metaflow-stubs/plugins/cards/card_client.pyi +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 +2 -2
  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 +2 -2
  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 +2 -2
  77. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +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 +1 -1
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  101. metaflow-stubs/plugins/logs_cli.pyi +1 -1
  102. metaflow-stubs/plugins/package_cli.pyi +1 -1
  103. metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
  104. metaflow-stubs/plugins/perimeters.pyi +1 -1
  105. metaflow-stubs/plugins/project_decorator.pyi +1 -1
  106. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +2 -2
  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 +1 -1
  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 +4 -4
  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 +2 -2
  134. metaflow-stubs/tagging_util.pyi +1 -1
  135. metaflow-stubs/tuple_util.pyi +1 -1
  136. {ob_metaflow_stubs-6.0.3.102rc1.dist-info → ob_metaflow_stubs-6.0.3.102rc2.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.102rc2.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.102rc1.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.102rc1.dist-info → ob_metaflow_stubs-6.0.3.102rc2.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.102rc1.dist-info → ob_metaflow_stubs-6.0.3.102rc2.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.12.22.1+obcheckpoint(0.0.10);ob(v1) #
4
- # Generated on 2024-09-20T18:51:04.453225 #
4
+ # Generated on 2024-09-20T18:57:11.211223 #
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.client.core
12
11
  import metaflow.metaflow_current
13
- import metaflow.parameters
14
- import metaflow._vendor.click.types
15
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
16
- import metaflow.runner.metaflow_runner
12
+ import metaflow.datastore.inputs
17
13
  import metaflow.events
18
- import typing
14
+ import metaflow.runner.metaflow_runner
15
+ import metaflow.client.core
19
16
  import datetime
20
- import metaflow.datastore.inputs
17
+ import metaflow._vendor.click.types
18
+ import metaflow.parameters
21
19
  import metaflow.flowspec
20
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
21
+ import typing
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -434,25 +434,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
434
434
  """
435
435
  ...
436
436
 
437
- @typing.overload
438
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
439
- """
440
- Decorator prototype for all step decorators. This function gets specialized
441
- and imported for all decorators types by _import_plugin_decorators().
442
- """
443
- ...
444
-
445
- @typing.overload
446
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
447
- ...
448
-
449
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
450
- """
451
- Decorator prototype for all step decorators. This function gets specialized
452
- and imported for all decorators types by _import_plugin_decorators().
453
- """
454
- ...
455
-
456
437
  @typing.overload
457
438
  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]]]:
458
439
  """
@@ -503,171 +484,112 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
503
484
  ...
504
485
 
505
486
  @typing.overload
506
- 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]]]:
487
+ def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
507
488
  """
508
- Specifies a timeout for your step.
509
-
510
- This decorator is useful if this step may hang indefinitely.
489
+ Specifies the number of times the task corresponding
490
+ to a step needs to be retried.
511
491
 
512
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
513
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
514
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
492
+ This decorator is useful for handling transient errors, such as networking issues.
493
+ If your task contains operations that can't be retried safely, e.g. database updates,
494
+ it is advisable to annotate it with `@retry(times=0)`.
515
495
 
516
- Note that all the values specified in parameters are added together so if you specify
517
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
496
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
497
+ decorator will execute a no-op task after all retries have been exhausted,
498
+ ensuring that the flow execution can continue.
518
499
 
519
500
  Parameters
520
501
  ----------
521
- seconds : int, default 0
522
- Number of seconds to wait prior to timing out.
523
- minutes : int, default 0
524
- Number of minutes to wait prior to timing out.
525
- hours : int, default 0
526
- Number of hours to wait prior to timing out.
502
+ times : int, default 3
503
+ Number of times to retry this task.
504
+ minutes_between_retries : int, default 2
505
+ Number of minutes between retries.
527
506
  """
528
507
  ...
529
508
 
530
509
  @typing.overload
531
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
510
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
532
511
  ...
533
512
 
534
513
  @typing.overload
535
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
536
- ...
537
-
538
- 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):
539
- """
540
- Specifies a timeout for your step.
541
-
542
- This decorator is useful if this step may hang indefinitely.
543
-
544
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
545
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
546
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
547
-
548
- Note that all the values specified in parameters are added together so if you specify
549
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
550
-
551
- Parameters
552
- ----------
553
- seconds : int, default 0
554
- Number of seconds to wait prior to timing out.
555
- minutes : int, default 0
556
- Number of minutes to wait prior to timing out.
557
- hours : int, default 0
558
- Number of hours to wait prior to timing out.
559
- """
514
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
560
515
  ...
561
516
 
562
- @typing.overload
563
- 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]]]:
517
+ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
564
518
  """
565
- Creates a human-readable report, a Metaflow Card, after this step completes.
566
-
567
- Note that you may add multiple `@card` decorators in a step with different parameters.
568
-
569
- Parameters
570
- ----------
571
- type : str, default 'default'
572
- Card type.
573
- id : str, optional, default None
574
- If multiple cards are present, use this id to identify this card.
575
- options : Dict[str, Any], default {}
576
- Options passed to the card. The contents depend on the card type.
577
- timeout : int, default 45
578
- Interrupt reporting if it takes more than this many seconds.
579
-
519
+ Specifies the number of times the task corresponding
520
+ to a step needs to be retried.
580
521
 
581
- """
582
- ...
583
-
584
- @typing.overload
585
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
586
- ...
587
-
588
- @typing.overload
589
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
590
- ...
591
-
592
- 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):
593
- """
594
- Creates a human-readable report, a Metaflow Card, after this step completes.
522
+ This decorator is useful for handling transient errors, such as networking issues.
523
+ If your task contains operations that can't be retried safely, e.g. database updates,
524
+ it is advisable to annotate it with `@retry(times=0)`.
595
525
 
596
- Note that you may add multiple `@card` decorators in a step with different parameters.
526
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
527
+ decorator will execute a no-op task after all retries have been exhausted,
528
+ ensuring that the flow execution can continue.
597
529
 
598
530
  Parameters
599
531
  ----------
600
- type : str, default 'default'
601
- Card type.
602
- id : str, optional, default None
603
- If multiple cards are present, use this id to identify this card.
604
- options : Dict[str, Any], default {}
605
- Options passed to the card. The contents depend on the card type.
606
- timeout : int, default 45
607
- Interrupt reporting if it takes more than this many seconds.
608
-
609
-
532
+ times : int, default 3
533
+ Number of times to retry this task.
534
+ minutes_between_retries : int, default 2
535
+ Number of minutes between retries.
610
536
  """
611
537
  ...
612
538
 
613
539
  @typing.overload
614
- 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]]]:
540
+ def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
615
541
  """
616
- Enables loading / saving of models within a step.
542
+ Specifies the Conda environment for the step.
617
543
 
544
+ Information in this decorator will augment any
545
+ attributes set in the `@conda_base` flow-level decorator. Hence,
546
+ you can use `@conda_base` to set packages required by all
547
+ steps and use `@conda` to specify step-specific overrides.
618
548
 
619
549
  Parameters
620
550
  ----------
621
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
622
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
623
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
624
- - `current.checkpoint`
625
- - `current.model`
626
- - `current.huggingface_hub`
627
-
628
- 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
629
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
630
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
631
-
632
- temp_dir_root : str, default: None
633
- The root directory under which `current.model.loaded` will store loaded models
634
-
635
-
636
-
551
+ packages : Dict[str, str], default {}
552
+ Packages to use for this step. The key is the name of the package
553
+ and the value is the version to use.
554
+ libraries : Dict[str, str], default {}
555
+ Supported for backward compatibility. When used with packages, packages will take precedence.
556
+ python : str, optional, default None
557
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
558
+ that the version used will correspond to the version of the Python interpreter used to start the run.
559
+ disabled : bool, default False
560
+ If set to True, disables @conda.
637
561
  """
638
562
  ...
639
563
 
640
564
  @typing.overload
641
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
565
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
642
566
  ...
643
567
 
644
568
  @typing.overload
645
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
569
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
646
570
  ...
647
571
 
648
- 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):
572
+ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
649
573
  """
650
- Enables loading / saving of models within a step.
574
+ Specifies the Conda environment for the step.
651
575
 
576
+ Information in this decorator will augment any
577
+ attributes set in the `@conda_base` flow-level decorator. Hence,
578
+ you can use `@conda_base` to set packages required by all
579
+ steps and use `@conda` to specify step-specific overrides.
652
580
 
653
581
  Parameters
654
582
  ----------
655
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
656
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
657
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
658
- - `current.checkpoint`
659
- - `current.model`
660
- - `current.huggingface_hub`
661
-
662
- 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
663
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
664
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
665
-
666
- temp_dir_root : str, default: None
667
- The root directory under which `current.model.loaded` will store loaded models
668
-
669
-
670
-
583
+ packages : Dict[str, str], default {}
584
+ Packages to use for this step. The key is the name of the package
585
+ and the value is the version to use.
586
+ libraries : Dict[str, str], default {}
587
+ Supported for backward compatibility. When used with packages, packages will take precedence.
588
+ python : str, optional, default None
589
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
590
+ that the version used will correspond to the version of the Python interpreter used to start the run.
591
+ disabled : bool, default False
592
+ If set to True, disables @conda.
671
593
  """
672
594
  ...
673
595
 
@@ -705,32 +627,133 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
705
627
  ...
706
628
 
707
629
  @typing.overload
708
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
630
+ def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
709
631
  """
710
- Internal decorator to support Fast bakery
632
+ Specifies a timeout for your step.
633
+
634
+ This decorator is useful if this step may hang indefinitely.
635
+
636
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
637
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
638
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
639
+
640
+ Note that all the values specified in parameters are added together so if you specify
641
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
642
+
643
+ Parameters
644
+ ----------
645
+ seconds : int, default 0
646
+ Number of seconds to wait prior to timing out.
647
+ minutes : int, default 0
648
+ Number of minutes to wait prior to timing out.
649
+ hours : int, default 0
650
+ Number of hours to wait prior to timing out.
711
651
  """
712
652
  ...
713
653
 
714
654
  @typing.overload
715
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
655
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
716
656
  ...
717
657
 
718
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
719
- """
720
- Internal decorator to support Fast bakery
721
- """
658
+ @typing.overload
659
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
722
660
  ...
723
661
 
724
- 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]]]:
662
+ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
725
663
  """
726
- Specifies that this step should execute on Kubernetes.
664
+ Specifies a timeout for your step.
727
665
 
728
- Parameters
729
- ----------
730
- cpu : int, default 1
731
- Number of CPUs required for this step. If `@resources` is
732
- also present, the maximum value from all decorators is used.
733
- memory : int, default 4096
666
+ This decorator is useful if this step may hang indefinitely.
667
+
668
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
669
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
670
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
671
+
672
+ Note that all the values specified in parameters are added together so if you specify
673
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
674
+
675
+ Parameters
676
+ ----------
677
+ seconds : int, default 0
678
+ Number of seconds to wait prior to timing out.
679
+ minutes : int, default 0
680
+ Number of minutes to wait prior to timing out.
681
+ hours : int, default 0
682
+ Number of hours to wait prior to timing out.
683
+ """
684
+ ...
685
+
686
+ @typing.overload
687
+ 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]]]:
688
+ """
689
+ Enables checkpointing for a step.
690
+
691
+
692
+ Parameters
693
+ ----------
694
+ load_policy : str, default: "fresh"
695
+ The policy for loading the checkpoint. The following policies are supported:
696
+ - "eager": Loads the the latest available checkpoint within the namespace.
697
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
698
+ will be loaded at the start of the task.
699
+ - "none": Do not load any checkpoint
700
+ - "fresh": Loads the lastest checkpoint created within the running Task.
701
+ This mode helps loading checkpoints across various retry attempts of the same task.
702
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
703
+ created within the task will be loaded when the task is retries execution on failure.
704
+
705
+ temp_dir_root : str, default: None
706
+ The root directory under which `current.checkpoint.directory` will be created.
707
+
708
+
709
+
710
+ """
711
+ ...
712
+
713
+ @typing.overload
714
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
715
+ ...
716
+
717
+ @typing.overload
718
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
719
+ ...
720
+
721
+ 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):
722
+ """
723
+ Enables checkpointing for a step.
724
+
725
+
726
+ Parameters
727
+ ----------
728
+ load_policy : str, default: "fresh"
729
+ The policy for loading the checkpoint. The following policies are supported:
730
+ - "eager": Loads the the latest available checkpoint within the namespace.
731
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
732
+ will be loaded at the start of the task.
733
+ - "none": Do not load any checkpoint
734
+ - "fresh": Loads the lastest checkpoint created within the running Task.
735
+ This mode helps loading checkpoints across various retry attempts of the same task.
736
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
737
+ created within the task will be loaded when the task is retries execution on failure.
738
+
739
+ temp_dir_root : str, default: None
740
+ The root directory under which `current.checkpoint.directory` will be created.
741
+
742
+
743
+
744
+ """
745
+ ...
746
+
747
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
748
+ """
749
+ Specifies that this step should execute on Kubernetes.
750
+
751
+ Parameters
752
+ ----------
753
+ cpu : int, default 1
754
+ Number of CPUs required for this step. If `@resources` is
755
+ also present, the maximum value from all decorators is used.
756
+ memory : int, default 4096
734
757
  Memory size (in MB) required for this step. If
735
758
  `@resources` is also present, the maximum value from all decorators is
736
759
  used.
@@ -787,6 +810,86 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
787
810
  """
788
811
  ...
789
812
 
813
+ @typing.overload
814
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
815
+ """
816
+ Decorator prototype for all step decorators. This function gets specialized
817
+ and imported for all decorators types by _import_plugin_decorators().
818
+ """
819
+ ...
820
+
821
+ @typing.overload
822
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
823
+ ...
824
+
825
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
826
+ """
827
+ Decorator prototype for all step decorators. This function gets specialized
828
+ and imported for all decorators types by _import_plugin_decorators().
829
+ """
830
+ ...
831
+
832
+ @typing.overload
833
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
834
+ """
835
+ Enables loading / saving of models within a step.
836
+
837
+
838
+ Parameters
839
+ ----------
840
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
841
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
842
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
843
+ - `current.checkpoint`
844
+ - `current.model`
845
+ - `current.huggingface_hub`
846
+
847
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
848
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
849
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
850
+
851
+ temp_dir_root : str, default: None
852
+ The root directory under which `current.model.loaded` will store loaded models
853
+
854
+
855
+
856
+ """
857
+ ...
858
+
859
+ @typing.overload
860
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
861
+ ...
862
+
863
+ @typing.overload
864
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
865
+ ...
866
+
867
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
868
+ """
869
+ Enables loading / saving of models within a step.
870
+
871
+
872
+ Parameters
873
+ ----------
874
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
875
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
876
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
877
+ - `current.checkpoint`
878
+ - `current.model`
879
+ - `current.huggingface_hub`
880
+
881
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
882
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
883
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
884
+
885
+ temp_dir_root : str, default: None
886
+ The root directory under which `current.model.loaded` will store loaded models
887
+
888
+
889
+
890
+ """
891
+ ...
892
+
790
893
  @typing.overload
791
894
  def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
792
895
  """
@@ -837,112 +940,96 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
837
940
  ...
838
941
 
839
942
  @typing.overload
840
- 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]]]:
943
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
841
944
  """
842
- Specifies the Conda environment for the step.
843
-
844
- Information in this decorator will augment any
845
- attributes set in the `@conda_base` flow-level decorator. Hence,
846
- you can use `@conda_base` to set packages required by all
847
- steps and use `@conda` to specify step-specific overrides.
848
-
849
- Parameters
850
- ----------
851
- packages : Dict[str, str], default {}
852
- Packages to use for this step. The key is the name of the package
853
- and the value is the version to use.
854
- libraries : Dict[str, str], default {}
855
- Supported for backward compatibility. When used with packages, packages will take precedence.
856
- python : str, optional, default None
857
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
858
- that the version used will correspond to the version of the Python interpreter used to start the run.
859
- disabled : bool, default False
860
- If set to True, disables @conda.
945
+ Internal decorator to support Fast bakery
861
946
  """
862
947
  ...
863
948
 
864
949
  @typing.overload
865
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
950
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
866
951
  ...
867
952
 
868
- @typing.overload
869
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
953
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
954
+ """
955
+ Internal decorator to support Fast bakery
956
+ """
870
957
  ...
871
958
 
872
- 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):
959
+ @typing.overload
960
+ 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]]]:
873
961
  """
874
- Specifies the Conda environment for the step.
962
+ Specifies the resources needed when executing this step.
875
963
 
876
- Information in this decorator will augment any
877
- attributes set in the `@conda_base` flow-level decorator. Hence,
878
- you can use `@conda_base` to set packages required by all
879
- steps and use `@conda` to specify step-specific overrides.
964
+ Use `@resources` to specify the resource requirements
965
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
966
+
967
+ You can choose the compute layer on the command line by executing e.g.
968
+ ```
969
+ python myflow.py run --with batch
970
+ ```
971
+ or
972
+ ```
973
+ python myflow.py run --with kubernetes
974
+ ```
975
+ which executes the flow on the desired system using the
976
+ requirements specified in `@resources`.
880
977
 
881
978
  Parameters
882
979
  ----------
883
- packages : Dict[str, str], default {}
884
- Packages to use for this step. The key is the name of the package
885
- and the value is the version to use.
886
- libraries : Dict[str, str], default {}
887
- Supported for backward compatibility. When used with packages, packages will take precedence.
888
- python : str, optional, default None
889
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
890
- that the version used will correspond to the version of the Python interpreter used to start the run.
891
- disabled : bool, default False
892
- If set to True, disables @conda.
980
+ cpu : int, default 1
981
+ Number of CPUs required for this step.
982
+ gpu : int, default 0
983
+ Number of GPUs required for this step.
984
+ disk : int, optional, default None
985
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
986
+ memory : int, default 4096
987
+ Memory size (in MB) required for this step.
988
+ shared_memory : int, optional, default None
989
+ The value for the size (in MiB) of the /dev/shm volume for this step.
990
+ This parameter maps to the `--shm-size` option in Docker.
893
991
  """
894
992
  ...
895
993
 
896
994
  @typing.overload
897
- 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]]]:
995
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
996
+ ...
997
+
998
+ @typing.overload
999
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1000
+ ...
1001
+
1002
+ 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):
898
1003
  """
899
- Specifies the number of times the task corresponding
900
- to a step needs to be retried.
1004
+ Specifies the resources needed when executing this step.
901
1005
 
902
- This decorator is useful for handling transient errors, such as networking issues.
903
- If your task contains operations that can't be retried safely, e.g. database updates,
904
- it is advisable to annotate it with `@retry(times=0)`.
905
-
906
- This can be used in conjunction with the `@catch` decorator. The `@catch`
907
- decorator will execute a no-op task after all retries have been exhausted,
908
- ensuring that the flow execution can continue.
909
-
910
- Parameters
911
- ----------
912
- times : int, default 3
913
- Number of times to retry this task.
914
- minutes_between_retries : int, default 2
915
- Number of minutes between retries.
916
- """
917
- ...
918
-
919
- @typing.overload
920
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
921
- ...
922
-
923
- @typing.overload
924
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
925
- ...
926
-
927
- 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):
928
- """
929
- Specifies the number of times the task corresponding
930
- to a step needs to be retried.
931
-
932
- This decorator is useful for handling transient errors, such as networking issues.
933
- If your task contains operations that can't be retried safely, e.g. database updates,
934
- it is advisable to annotate it with `@retry(times=0)`.
1006
+ Use `@resources` to specify the resource requirements
1007
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
935
1008
 
936
- This can be used in conjunction with the `@catch` decorator. The `@catch`
937
- decorator will execute a no-op task after all retries have been exhausted,
938
- ensuring that the flow execution can continue.
1009
+ You can choose the compute layer on the command line by executing e.g.
1010
+ ```
1011
+ python myflow.py run --with batch
1012
+ ```
1013
+ or
1014
+ ```
1015
+ python myflow.py run --with kubernetes
1016
+ ```
1017
+ which executes the flow on the desired system using the
1018
+ requirements specified in `@resources`.
939
1019
 
940
1020
  Parameters
941
1021
  ----------
942
- times : int, default 3
943
- Number of times to retry this task.
944
- minutes_between_retries : int, default 2
945
- Number of minutes between retries.
1022
+ cpu : int, default 1
1023
+ Number of CPUs required for this step.
1024
+ gpu : int, default 0
1025
+ Number of GPUs required for this step.
1026
+ disk : int, optional, default None
1027
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1028
+ memory : int, default 4096
1029
+ Memory size (in MB) required for this step.
1030
+ shared_memory : int, optional, default None
1031
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1032
+ This parameter maps to the `--shm-size` option in Docker.
946
1033
  """
947
1034
  ...
948
1035
 
@@ -978,140 +1065,92 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
978
1065
  ...
979
1066
 
980
1067
  @typing.overload
981
- 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]]]:
1068
+ def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
982
1069
  """
983
- Specifies the resources needed when executing this step.
984
-
985
- Use `@resources` to specify the resource requirements
986
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1070
+ Creates a human-readable report, a Metaflow Card, after this step completes.
987
1071
 
988
- You can choose the compute layer on the command line by executing e.g.
989
- ```
990
- python myflow.py run --with batch
991
- ```
992
- or
993
- ```
994
- python myflow.py run --with kubernetes
995
- ```
996
- which executes the flow on the desired system using the
997
- requirements specified in `@resources`.
1072
+ Note that you may add multiple `@card` decorators in a step with different parameters.
998
1073
 
999
1074
  Parameters
1000
1075
  ----------
1001
- cpu : int, default 1
1002
- Number of CPUs required for this step.
1003
- gpu : int, default 0
1004
- Number of GPUs required for this step.
1005
- disk : int, optional, default None
1006
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1007
- memory : int, default 4096
1008
- Memory size (in MB) required for this step.
1009
- shared_memory : int, optional, default None
1010
- The value for the size (in MiB) of the /dev/shm volume for this step.
1011
- This parameter maps to the `--shm-size` option in Docker.
1076
+ type : str, default 'default'
1077
+ Card type.
1078
+ id : str, optional, default None
1079
+ If multiple cards are present, use this id to identify this card.
1080
+ options : Dict[str, Any], default {}
1081
+ Options passed to the card. The contents depend on the card type.
1082
+ timeout : int, default 45
1083
+ Interrupt reporting if it takes more than this many seconds.
1084
+
1085
+
1012
1086
  """
1013
1087
  ...
1014
1088
 
1015
1089
  @typing.overload
1016
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1090
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1017
1091
  ...
1018
1092
 
1019
1093
  @typing.overload
1020
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1094
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1021
1095
  ...
1022
1096
 
1023
- 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):
1097
+ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
1024
1098
  """
1025
- Specifies the resources needed when executing this step.
1026
-
1027
- Use `@resources` to specify the resource requirements
1028
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1099
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1029
1100
 
1030
- You can choose the compute layer on the command line by executing e.g.
1031
- ```
1032
- python myflow.py run --with batch
1033
- ```
1034
- or
1035
- ```
1036
- python myflow.py run --with kubernetes
1037
- ```
1038
- which executes the flow on the desired system using the
1039
- requirements specified in `@resources`.
1101
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1040
1102
 
1041
1103
  Parameters
1042
1104
  ----------
1043
- cpu : int, default 1
1044
- Number of CPUs required for this step.
1045
- gpu : int, default 0
1046
- Number of GPUs required for this step.
1047
- disk : int, optional, default None
1048
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1049
- memory : int, default 4096
1050
- Memory size (in MB) required for this step.
1051
- shared_memory : int, optional, default None
1052
- The value for the size (in MiB) of the /dev/shm volume for this step.
1053
- This parameter maps to the `--shm-size` option in Docker.
1105
+ type : str, default 'default'
1106
+ Card type.
1107
+ id : str, optional, default None
1108
+ If multiple cards are present, use this id to identify this card.
1109
+ options : Dict[str, Any], default {}
1110
+ Options passed to the card. The contents depend on the card type.
1111
+ timeout : int, default 45
1112
+ Interrupt reporting if it takes more than this many seconds.
1113
+
1114
+
1054
1115
  """
1055
1116
  ...
1056
1117
 
1057
1118
  @typing.overload
1058
- 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]]]:
1119
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1059
1120
  """
1060
- Enables checkpointing for a step.
1061
-
1121
+ Specifies the PyPI packages for all steps of the flow.
1062
1122
 
1123
+ Use `@pypi_base` to set common packages required by all
1124
+ steps and use `@pypi` to specify step-specific overrides.
1063
1125
  Parameters
1064
1126
  ----------
1065
- load_policy : str, default: "fresh"
1066
- The policy for loading the checkpoint. The following policies are supported:
1067
- - "eager": Loads the the latest available checkpoint within the namespace.
1068
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1069
- will be loaded at the start of the task.
1070
- - "none": Do not load any checkpoint
1071
- - "fresh": Loads the lastest checkpoint created within the running Task.
1072
- This mode helps loading checkpoints across various retry attempts of the same task.
1073
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1074
- created within the task will be loaded when the task is retries execution on failure.
1075
-
1076
- temp_dir_root : str, default: None
1077
- The root directory under which `current.checkpoint.directory` will be created.
1078
-
1079
-
1080
-
1127
+ packages : Dict[str, str], default: {}
1128
+ Packages to use for this flow. The key is the name of the package
1129
+ and the value is the version to use.
1130
+ python : str, optional, default: None
1131
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1132
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1081
1133
  """
1082
1134
  ...
1083
1135
 
1084
1136
  @typing.overload
1085
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1086
- ...
1087
-
1088
- @typing.overload
1089
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1137
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1090
1138
  ...
1091
1139
 
1092
- 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):
1140
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1093
1141
  """
1094
- Enables checkpointing for a step.
1095
-
1142
+ Specifies the PyPI packages for all steps of the flow.
1096
1143
 
1144
+ Use `@pypi_base` to set common packages required by all
1145
+ steps and use `@pypi` to specify step-specific overrides.
1097
1146
  Parameters
1098
1147
  ----------
1099
- load_policy : str, default: "fresh"
1100
- The policy for loading the checkpoint. The following policies are supported:
1101
- - "eager": Loads the the latest available checkpoint within the namespace.
1102
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1103
- will be loaded at the start of the task.
1104
- - "none": Do not load any checkpoint
1105
- - "fresh": Loads the lastest checkpoint created within the running Task.
1106
- This mode helps loading checkpoints across various retry attempts of the same task.
1107
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1108
- created within the task will be loaded when the task is retries execution on failure.
1109
-
1110
- temp_dir_root : str, default: None
1111
- The root directory under which `current.checkpoint.directory` will be created.
1112
-
1113
-
1114
-
1148
+ packages : Dict[str, str], default: {}
1149
+ Packages to use for this flow. The key is the name of the package
1150
+ and the value is the version to use.
1151
+ python : str, optional, default: None
1152
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1153
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1115
1154
  """
1116
1155
  ...
1117
1156
 
@@ -1157,6 +1196,210 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1157
1196
  """
1158
1197
  ...
1159
1198
 
1199
+ 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]]:
1200
+ """
1201
+ 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)
1202
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1203
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1204
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1205
+ starts only after all sensors finish.
1206
+
1207
+ Parameters
1208
+ ----------
1209
+ timeout : int
1210
+ Time, in seconds before the task times out and fails. (Default: 3600)
1211
+ poke_interval : int
1212
+ Time in seconds that the job should wait in between each try. (Default: 60)
1213
+ mode : str
1214
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1215
+ exponential_backoff : bool
1216
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1217
+ pool : str
1218
+ the slot pool this task should run in,
1219
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1220
+ soft_fail : bool
1221
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1222
+ name : str
1223
+ Name of the sensor on Airflow
1224
+ description : str
1225
+ Description of sensor in the Airflow UI
1226
+ bucket_key : Union[str, List[str]]
1227
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1228
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1229
+ bucket_name : str
1230
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1231
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1232
+ wildcard_match : bool
1233
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1234
+ aws_conn_id : str
1235
+ a reference to the s3 connection on Airflow. (Default: None)
1236
+ verify : bool
1237
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1238
+ """
1239
+ ...
1240
+
1241
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1242
+ """
1243
+ Specifies what flows belong to the same project.
1244
+
1245
+ A project-specific namespace is created for all flows that
1246
+ use the same `@project(name)`.
1247
+
1248
+ Parameters
1249
+ ----------
1250
+ name : str
1251
+ Project name. Make sure that the name is unique amongst all
1252
+ projects that use the same production scheduler. The name may
1253
+ contain only lowercase alphanumeric characters and underscores.
1254
+
1255
+
1256
+ """
1257
+ ...
1258
+
1259
+ @typing.overload
1260
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1261
+ """
1262
+ Specifies the times when the flow should be run when running on a
1263
+ production scheduler.
1264
+
1265
+ Parameters
1266
+ ----------
1267
+ hourly : bool, default False
1268
+ Run the workflow hourly.
1269
+ daily : bool, default True
1270
+ Run the workflow daily.
1271
+ weekly : bool, default False
1272
+ Run the workflow weekly.
1273
+ cron : str, optional, default None
1274
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1275
+ specified by this expression.
1276
+ timezone : str, optional, default None
1277
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1278
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1279
+ """
1280
+ ...
1281
+
1282
+ @typing.overload
1283
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1284
+ ...
1285
+
1286
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1287
+ """
1288
+ Specifies the times when the flow should be run when running on a
1289
+ production scheduler.
1290
+
1291
+ Parameters
1292
+ ----------
1293
+ hourly : bool, default False
1294
+ Run the workflow hourly.
1295
+ daily : bool, default True
1296
+ Run the workflow daily.
1297
+ weekly : bool, default False
1298
+ Run the workflow weekly.
1299
+ cron : str, optional, default None
1300
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1301
+ specified by this expression.
1302
+ timezone : str, optional, default None
1303
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1304
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1305
+ """
1306
+ ...
1307
+
1308
+ @typing.overload
1309
+ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1310
+ """
1311
+ Specifies the event(s) that this flow depends on.
1312
+
1313
+ ```
1314
+ @trigger(event='foo')
1315
+ ```
1316
+ or
1317
+ ```
1318
+ @trigger(events=['foo', 'bar'])
1319
+ ```
1320
+
1321
+ Additionally, you can specify the parameter mappings
1322
+ to map event payload to Metaflow parameters for the flow.
1323
+ ```
1324
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1325
+ ```
1326
+ or
1327
+ ```
1328
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1329
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1330
+ ```
1331
+
1332
+ 'parameters' can also be a list of strings and tuples like so:
1333
+ ```
1334
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1335
+ ```
1336
+ This is equivalent to:
1337
+ ```
1338
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1339
+ ```
1340
+
1341
+ Parameters
1342
+ ----------
1343
+ event : Union[str, Dict[str, Any]], optional, default None
1344
+ Event dependency for this flow.
1345
+ events : List[Union[str, Dict[str, Any]]], default []
1346
+ Events dependency for this flow.
1347
+ options : Dict[str, Any], default {}
1348
+ Backend-specific configuration for tuning eventing behavior.
1349
+
1350
+
1351
+ """
1352
+ ...
1353
+
1354
+ @typing.overload
1355
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1356
+ ...
1357
+
1358
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1359
+ """
1360
+ Specifies the event(s) that this flow depends on.
1361
+
1362
+ ```
1363
+ @trigger(event='foo')
1364
+ ```
1365
+ or
1366
+ ```
1367
+ @trigger(events=['foo', 'bar'])
1368
+ ```
1369
+
1370
+ Additionally, you can specify the parameter mappings
1371
+ to map event payload to Metaflow parameters for the flow.
1372
+ ```
1373
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1374
+ ```
1375
+ or
1376
+ ```
1377
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1378
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1379
+ ```
1380
+
1381
+ 'parameters' can also be a list of strings and tuples like so:
1382
+ ```
1383
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1384
+ ```
1385
+ This is equivalent to:
1386
+ ```
1387
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1388
+ ```
1389
+
1390
+ Parameters
1391
+ ----------
1392
+ event : Union[str, Dict[str, Any]], optional, default None
1393
+ Event dependency for this flow.
1394
+ events : List[Union[str, Dict[str, Any]]], default []
1395
+ Events dependency for this flow.
1396
+ options : Dict[str, Any], default {}
1397
+ Backend-specific configuration for tuning eventing behavior.
1398
+
1399
+
1400
+ """
1401
+ ...
1402
+
1160
1403
  @typing.overload
1161
1404
  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]]:
1162
1405
  """
@@ -1237,48 +1480,6 @@ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[Fl
1237
1480
  """
1238
1481
  ...
1239
1482
 
1240
- 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]]:
1241
- """
1242
- 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)
1243
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1244
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1245
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1246
- starts only after all sensors finish.
1247
-
1248
- Parameters
1249
- ----------
1250
- timeout : int
1251
- Time, in seconds before the task times out and fails. (Default: 3600)
1252
- poke_interval : int
1253
- Time in seconds that the job should wait in between each try. (Default: 60)
1254
- mode : str
1255
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1256
- exponential_backoff : bool
1257
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1258
- pool : str
1259
- the slot pool this task should run in,
1260
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1261
- soft_fail : bool
1262
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1263
- name : str
1264
- Name of the sensor on Airflow
1265
- description : str
1266
- Description of sensor in the Airflow UI
1267
- bucket_key : Union[str, List[str]]
1268
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1269
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1270
- bucket_name : str
1271
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1272
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1273
- wildcard_match : bool
1274
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1275
- aws_conn_id : str
1276
- a reference to the s3 connection on Airflow. (Default: None)
1277
- verify : bool
1278
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1279
- """
1280
- ...
1281
-
1282
1483
  @typing.overload
1283
1484
  def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1284
1485
  """
@@ -1382,207 +1583,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1382
1583
  """
1383
1584
  ...
1384
1585
 
1385
- @typing.overload
1386
- 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]]:
1387
- """
1388
- Specifies the times when the flow should be run when running on a
1389
- production scheduler.
1390
-
1391
- Parameters
1392
- ----------
1393
- hourly : bool, default False
1394
- Run the workflow hourly.
1395
- daily : bool, default True
1396
- Run the workflow daily.
1397
- weekly : bool, default False
1398
- Run the workflow weekly.
1399
- cron : str, optional, default None
1400
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1401
- specified by this expression.
1402
- timezone : str, optional, default None
1403
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1404
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1405
- """
1406
- ...
1407
-
1408
- @typing.overload
1409
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1410
- ...
1411
-
1412
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1413
- """
1414
- Specifies the times when the flow should be run when running on a
1415
- production scheduler.
1416
-
1417
- Parameters
1418
- ----------
1419
- hourly : bool, default False
1420
- Run the workflow hourly.
1421
- daily : bool, default True
1422
- Run the workflow daily.
1423
- weekly : bool, default False
1424
- Run the workflow weekly.
1425
- cron : str, optional, default None
1426
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1427
- specified by this expression.
1428
- timezone : str, optional, default None
1429
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1430
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1431
- """
1432
- ...
1433
-
1434
- @typing.overload
1435
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1436
- """
1437
- Specifies the PyPI packages for all steps of the flow.
1438
-
1439
- Use `@pypi_base` to set common packages required by all
1440
- steps and use `@pypi` to specify step-specific overrides.
1441
- Parameters
1442
- ----------
1443
- packages : Dict[str, str], default: {}
1444
- Packages to use for this flow. The key is the name of the package
1445
- and the value is the version to use.
1446
- python : str, optional, default: None
1447
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1448
- that the version used will correspond to the version of the Python interpreter used to start the run.
1449
- """
1450
- ...
1451
-
1452
- @typing.overload
1453
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1454
- ...
1455
-
1456
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1457
- """
1458
- Specifies the PyPI packages for all steps of the flow.
1459
-
1460
- Use `@pypi_base` to set common packages required by all
1461
- steps and use `@pypi` to specify step-specific overrides.
1462
- Parameters
1463
- ----------
1464
- packages : Dict[str, str], default: {}
1465
- Packages to use for this flow. The key is the name of the package
1466
- and the value is the version to use.
1467
- python : str, optional, default: None
1468
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1469
- that the version used will correspond to the version of the Python interpreter used to start the run.
1470
- """
1471
- ...
1472
-
1473
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1474
- """
1475
- Specifies what flows belong to the same project.
1476
-
1477
- A project-specific namespace is created for all flows that
1478
- use the same `@project(name)`.
1479
-
1480
- Parameters
1481
- ----------
1482
- name : str
1483
- Project name. Make sure that the name is unique amongst all
1484
- projects that use the same production scheduler. The name may
1485
- contain only lowercase alphanumeric characters and underscores.
1486
-
1487
-
1488
- """
1489
- ...
1490
-
1491
- @typing.overload
1492
- def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1493
- """
1494
- Specifies the event(s) that this flow depends on.
1495
-
1496
- ```
1497
- @trigger(event='foo')
1498
- ```
1499
- or
1500
- ```
1501
- @trigger(events=['foo', 'bar'])
1502
- ```
1503
-
1504
- Additionally, you can specify the parameter mappings
1505
- to map event payload to Metaflow parameters for the flow.
1506
- ```
1507
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1508
- ```
1509
- or
1510
- ```
1511
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1512
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1513
- ```
1514
-
1515
- 'parameters' can also be a list of strings and tuples like so:
1516
- ```
1517
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1518
- ```
1519
- This is equivalent to:
1520
- ```
1521
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1522
- ```
1523
-
1524
- Parameters
1525
- ----------
1526
- event : Union[str, Dict[str, Any]], optional, default None
1527
- Event dependency for this flow.
1528
- events : List[Union[str, Dict[str, Any]]], default []
1529
- Events dependency for this flow.
1530
- options : Dict[str, Any], default {}
1531
- Backend-specific configuration for tuning eventing behavior.
1532
-
1533
-
1534
- """
1535
- ...
1536
-
1537
- @typing.overload
1538
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1539
- ...
1540
-
1541
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1542
- """
1543
- Specifies the event(s) that this flow depends on.
1544
-
1545
- ```
1546
- @trigger(event='foo')
1547
- ```
1548
- or
1549
- ```
1550
- @trigger(events=['foo', 'bar'])
1551
- ```
1552
-
1553
- Additionally, you can specify the parameter mappings
1554
- to map event payload to Metaflow parameters for the flow.
1555
- ```
1556
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1557
- ```
1558
- or
1559
- ```
1560
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1561
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1562
- ```
1563
-
1564
- 'parameters' can also be a list of strings and tuples like so:
1565
- ```
1566
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1567
- ```
1568
- This is equivalent to:
1569
- ```
1570
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1571
- ```
1572
-
1573
- Parameters
1574
- ----------
1575
- event : Union[str, Dict[str, Any]], optional, default None
1576
- Event dependency for this flow.
1577
- events : List[Union[str, Dict[str, Any]]], default []
1578
- Events dependency for this flow.
1579
- options : Dict[str, Any], default {}
1580
- Backend-specific configuration for tuning eventing behavior.
1581
-
1582
-
1583
- """
1584
- ...
1585
-
1586
1586
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1587
1587
  """
1588
1588
  Switch namespace to the one provided.