ob-metaflow-stubs 6.0.3.102rc2__py2.py3-none-any.whl → 6.0.3.102rc3__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 +597 -597
  2. metaflow-stubs/cards.pyi +4 -4
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +2 -2
  5. metaflow-stubs/client/core.pyi +6 -6
  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 +5 -5
  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 +2 -2
  15. metaflow-stubs/metadata/util.pyi +1 -1
  16. metaflow-stubs/metaflow_config.pyi +1 -1
  17. metaflow-stubs/metaflow_current.pyi +95 -95
  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 +2 -2
  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 +3 -3
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +7 -7
  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 +2 -2
  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 +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 +1 -1
  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 +5 -5
  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 +2 -2
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  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 +3 -3
  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 +2 -2
  104. metaflow-stubs/plugins/perimeters.pyi +1 -1
  105. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  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 +2 -2
  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 +3 -3
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  120. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  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 +3 -3
  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.102rc2.dist-info → ob_metaflow_stubs-6.0.3.102rc3.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.102rc3.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.102rc2.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.102rc2.dist-info → ob_metaflow_stubs-6.0.3.102rc3.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.102rc2.dist-info → ob_metaflow_stubs-6.0.3.102rc3.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:57:11.211223 #
4
+ # Generated on 2024-09-20T19:02:23.973955 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow.metaflow_current
12
- import metaflow.datastore.inputs
13
- import metaflow.events
14
- import metaflow.runner.metaflow_runner
15
- import metaflow.client.core
11
+ import metaflow.flowspec
16
12
  import datetime
17
13
  import metaflow._vendor.click.types
18
14
  import metaflow.parameters
19
- import metaflow.flowspec
20
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
21
15
  import typing
16
+ import metaflow.datastore.inputs
17
+ import metaflow.metaflow_current
18
+ import metaflow.events
19
+ import metaflow.runner.metaflow_runner
20
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
21
+ import metaflow.client.core
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -434,105 +434,69 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
434
434
  """
435
435
  ...
436
436
 
437
- @typing.overload
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]]]:
439
- """
440
- Specifies the PyPI packages for the step.
441
-
442
- Information in this decorator will augment any
443
- attributes set in the `@pyi_base` flow-level decorator. Hence,
444
- you can use `@pypi_base` to set packages required by all
445
- steps and use `@pypi` to specify step-specific overrides.
446
-
447
- Parameters
448
- ----------
449
- packages : Dict[str, str], default: {}
450
- Packages to use for this step. The key is the name of the package
451
- and the value is the version to use.
452
- python : str, optional, default: None
453
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
454
- that the version used will correspond to the version of the Python interpreter used to start the run.
455
- """
456
- ...
457
-
458
- @typing.overload
459
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
460
- ...
461
-
462
- @typing.overload
463
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
464
- ...
465
-
466
- 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):
467
- """
468
- Specifies the PyPI packages for the step.
469
-
470
- Information in this decorator will augment any
471
- attributes set in the `@pyi_base` flow-level decorator. Hence,
472
- you can use `@pypi_base` to set packages required by all
473
- steps and use `@pypi` to specify step-specific overrides.
474
-
475
- Parameters
476
- ----------
477
- packages : Dict[str, str], default: {}
478
- Packages to use for this step. The key is the name of the package
479
- and the value is the version to use.
480
- python : str, optional, default: None
481
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
482
- that the version used will correspond to the version of the Python interpreter used to start the run.
483
- """
484
- ...
485
-
486
- @typing.overload
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]]]:
488
- """
489
- Specifies the number of times the task corresponding
490
- to a step needs to be retried.
491
-
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)`.
495
-
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.
499
-
500
- Parameters
501
- ----------
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.
506
- """
507
- ...
508
-
509
- @typing.overload
510
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
511
- ...
512
-
513
- @typing.overload
514
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
515
- ...
516
-
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):
437
+ 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]]]:
518
438
  """
519
- Specifies the number of times the task corresponding
520
- to a step needs to be retried.
521
-
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)`.
525
-
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.
439
+ Specifies that this step should execute on Kubernetes.
529
440
 
530
441
  Parameters
531
442
  ----------
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.
443
+ cpu : int, default 1
444
+ Number of CPUs required for this step. If `@resources` is
445
+ also present, the maximum value from all decorators is used.
446
+ memory : int, default 4096
447
+ Memory size (in MB) required for this step. If
448
+ `@resources` is also present, the maximum value from all decorators is
449
+ used.
450
+ disk : int, default 10240
451
+ Disk size (in MB) required for this step. If
452
+ `@resources` is also present, the maximum value from all decorators is
453
+ used.
454
+ image : str, optional, default None
455
+ Docker image to use when launching on Kubernetes. If not specified, and
456
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
457
+ not, a default Docker image mapping to the current version of Python is used.
458
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
459
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
460
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
461
+ Kubernetes service account to use when launching pod in Kubernetes.
462
+ secrets : List[str], optional, default None
463
+ Kubernetes secrets to use when launching pod in Kubernetes. These
464
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
465
+ in Metaflow configuration.
466
+ node_selector: Union[Dict[str,str], str], optional, default None
467
+ Kubernetes node selector(s) to apply to the pod running the task.
468
+ Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
469
+ or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
470
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
471
+ Kubernetes namespace to use when launching pod in Kubernetes.
472
+ gpu : int, optional, default None
473
+ Number of GPUs required for this step. A value of zero implies that
474
+ the scheduled node should not have GPUs.
475
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
476
+ The vendor of the GPUs to be used for this step.
477
+ tolerations : List[str], default []
478
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
479
+ Kubernetes tolerations to use when launching pod in Kubernetes.
480
+ use_tmpfs : bool, default False
481
+ This enables an explicit tmpfs mount for this step.
482
+ tmpfs_tempdir : bool, default True
483
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
484
+ tmpfs_size : int, optional, default: None
485
+ The value for the size (in MiB) of the tmpfs mount for this step.
486
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
487
+ memory allocated for this step.
488
+ tmpfs_path : str, optional, default /metaflow_temp
489
+ Path to tmpfs mount for this step.
490
+ persistent_volume_claims : Dict[str, str], optional, default None
491
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
492
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
493
+ shared_memory: int, optional
494
+ Shared memory size (in MiB) required for this step
495
+ port: int, optional
496
+ Port number to specify in the Kubernetes job object
497
+ compute_pool : str, optional, default None
498
+ Compute pool to be used for for this step.
499
+ If not specified, any accessible compute pool within the perimeter is used.
536
500
  """
537
501
  ...
538
502
 
@@ -594,116 +558,154 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
594
558
  ...
595
559
 
596
560
  @typing.overload
597
- 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]]]:
561
+ 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]]]:
598
562
  """
599
- Specifies secrets to be retrieved and injected as environment variables prior to
600
- the execution of a step.
563
+ Specifies the resources needed when executing this step.
564
+
565
+ Use `@resources` to specify the resource requirements
566
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
567
+
568
+ You can choose the compute layer on the command line by executing e.g.
569
+ ```
570
+ python myflow.py run --with batch
571
+ ```
572
+ or
573
+ ```
574
+ python myflow.py run --with kubernetes
575
+ ```
576
+ which executes the flow on the desired system using the
577
+ requirements specified in `@resources`.
601
578
 
602
579
  Parameters
603
580
  ----------
604
- sources : List[Union[str, Dict[str, Any]]], default: []
605
- List of secret specs, defining how the secrets are to be retrieved
581
+ cpu : int, default 1
582
+ Number of CPUs required for this step.
583
+ gpu : int, default 0
584
+ Number of GPUs required for this step.
585
+ disk : int, optional, default None
586
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
587
+ memory : int, default 4096
588
+ Memory size (in MB) required for this step.
589
+ shared_memory : int, optional, default None
590
+ The value for the size (in MiB) of the /dev/shm volume for this step.
591
+ This parameter maps to the `--shm-size` option in Docker.
606
592
  """
607
593
  ...
608
594
 
609
595
  @typing.overload
610
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
596
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
611
597
  ...
612
598
 
613
599
  @typing.overload
614
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
600
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
615
601
  ...
616
602
 
617
- 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]]] = []):
603
+ 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):
618
604
  """
619
- Specifies secrets to be retrieved and injected as environment variables prior to
620
- the execution of a step.
605
+ Specifies the resources needed when executing this step.
606
+
607
+ Use `@resources` to specify the resource requirements
608
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
609
+
610
+ You can choose the compute layer on the command line by executing e.g.
611
+ ```
612
+ python myflow.py run --with batch
613
+ ```
614
+ or
615
+ ```
616
+ python myflow.py run --with kubernetes
617
+ ```
618
+ which executes the flow on the desired system using the
619
+ requirements specified in `@resources`.
621
620
 
622
621
  Parameters
623
622
  ----------
624
- sources : List[Union[str, Dict[str, Any]]], default: []
625
- List of secret specs, defining how the secrets are to be retrieved
623
+ cpu : int, default 1
624
+ Number of CPUs required for this step.
625
+ gpu : int, default 0
626
+ Number of GPUs required for this step.
627
+ disk : int, optional, default None
628
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
629
+ memory : int, default 4096
630
+ Memory size (in MB) required for this step.
631
+ shared_memory : int, optional, default None
632
+ The value for the size (in MiB) of the /dev/shm volume for this step.
633
+ This parameter maps to the `--shm-size` option in Docker.
626
634
  """
627
635
  ...
628
636
 
629
637
  @typing.overload
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]]]:
638
+ 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]]]:
631
639
  """
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.
640
+ Creates a human-readable report, a Metaflow Card, after this step completes.
639
641
 
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
+ Note that you may add multiple `@card` decorators in a step with different parameters.
642
643
 
643
644
  Parameters
644
645
  ----------
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.
651
- """
646
+ type : str, default 'default'
647
+ Card type.
648
+ id : str, optional, default None
649
+ If multiple cards are present, use this id to identify this card.
650
+ options : Dict[str, Any], default {}
651
+ Options passed to the card. The contents depend on the card type.
652
+ timeout : int, default 45
653
+ Interrupt reporting if it takes more than this many seconds.
654
+
655
+
656
+ """
652
657
  ...
653
658
 
654
659
  @typing.overload
655
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
660
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
656
661
  ...
657
662
 
658
663
  @typing.overload
659
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
664
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
660
665
  ...
661
666
 
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):
667
+ 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):
663
668
  """
664
- Specifies a timeout for your step.
665
-
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.
669
+ Creates a human-readable report, a Metaflow Card, after this step completes.
671
670
 
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.
671
+ Note that you may add multiple `@card` decorators in a step with different parameters.
674
672
 
675
673
  Parameters
676
674
  ----------
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.
675
+ type : str, default 'default'
676
+ Card type.
677
+ id : str, optional, default None
678
+ If multiple cards are present, use this id to identify this card.
679
+ options : Dict[str, Any], default {}
680
+ Options passed to the card. The contents depend on the card type.
681
+ timeout : int, default 45
682
+ Interrupt reporting if it takes more than this many seconds.
683
+
684
+
683
685
  """
684
686
  ...
685
687
 
686
688
  @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]]]:
689
+ 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]]]:
688
690
  """
689
- Enables checkpointing for a step.
691
+ Enables loading / saving of models within a step.
690
692
 
691
693
 
692
694
  Parameters
693
695
  ----------
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.
696
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
697
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
698
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
699
+ - `current.checkpoint`
700
+ - `current.model`
701
+ - `current.huggingface_hub`
702
+
703
+ 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
704
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
705
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
704
706
 
705
707
  temp_dir_root : str, default: None
706
- The root directory under which `current.checkpoint.directory` will be created.
708
+ The root directory under which `current.model.loaded` will store loaded models
707
709
 
708
710
 
709
711
 
@@ -711,182 +713,194 @@ def checkpoint(*, load_policy: str = "fresh", temp_dir_root: str = None) -> typi
711
713
  ...
712
714
 
713
715
  @typing.overload
714
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
716
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
715
717
  ...
716
718
 
717
719
  @typing.overload
718
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
720
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
719
721
  ...
720
722
 
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):
723
+ 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):
722
724
  """
723
- Enables checkpointing for a step.
725
+ Enables loading / saving of models within a step.
724
726
 
725
727
 
726
728
  Parameters
727
729
  ----------
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.
730
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
731
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
732
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
733
+ - `current.checkpoint`
734
+ - `current.model`
735
+ - `current.huggingface_hub`
736
+
737
+ 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
738
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
739
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
738
740
 
739
741
  temp_dir_root : str, default: None
740
- The root directory under which `current.checkpoint.directory` will be created.
742
+ The root directory under which `current.model.loaded` will store loaded models
741
743
 
742
744
 
743
745
 
744
746
  """
745
747
  ...
746
748
 
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]]]:
749
+ @typing.overload
750
+ 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]]]:
748
751
  """
749
- Specifies that this step should execute on Kubernetes.
752
+ Specifies a timeout for your step.
753
+
754
+ This decorator is useful if this step may hang indefinitely.
755
+
756
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
757
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
758
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
759
+
760
+ Note that all the values specified in parameters are added together so if you specify
761
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
750
762
 
751
763
  Parameters
752
764
  ----------
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
757
- Memory size (in MB) required for this step. If
758
- `@resources` is also present, the maximum value from all decorators is
759
- used.
760
- disk : int, default 10240
761
- Disk size (in MB) required for this step. If
762
- `@resources` is also present, the maximum value from all decorators is
763
- used.
764
- image : str, optional, default None
765
- Docker image to use when launching on Kubernetes. If not specified, and
766
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
767
- not, a default Docker image mapping to the current version of Python is used.
768
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
769
- If given, the imagePullPolicy to be applied to the Docker image of the step.
770
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
771
- Kubernetes service account to use when launching pod in Kubernetes.
772
- secrets : List[str], optional, default None
773
- Kubernetes secrets to use when launching pod in Kubernetes. These
774
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
775
- in Metaflow configuration.
776
- node_selector: Union[Dict[str,str], str], optional, default None
777
- Kubernetes node selector(s) to apply to the pod running the task.
778
- Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
779
- or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
780
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
781
- Kubernetes namespace to use when launching pod in Kubernetes.
782
- gpu : int, optional, default None
783
- Number of GPUs required for this step. A value of zero implies that
784
- the scheduled node should not have GPUs.
785
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
786
- The vendor of the GPUs to be used for this step.
787
- tolerations : List[str], default []
788
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
789
- Kubernetes tolerations to use when launching pod in Kubernetes.
790
- use_tmpfs : bool, default False
791
- This enables an explicit tmpfs mount for this step.
792
- tmpfs_tempdir : bool, default True
793
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
794
- tmpfs_size : int, optional, default: None
795
- The value for the size (in MiB) of the tmpfs mount for this step.
796
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
797
- memory allocated for this step.
798
- tmpfs_path : str, optional, default /metaflow_temp
799
- Path to tmpfs mount for this step.
800
- persistent_volume_claims : Dict[str, str], optional, default None
801
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
802
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
803
- shared_memory: int, optional
804
- Shared memory size (in MiB) required for this step
805
- port: int, optional
806
- Port number to specify in the Kubernetes job object
807
- compute_pool : str, optional, default None
808
- Compute pool to be used for for this step.
809
- If not specified, any accessible compute pool within the perimeter is used.
765
+ seconds : int, default 0
766
+ Number of seconds to wait prior to timing out.
767
+ minutes : int, default 0
768
+ Number of minutes to wait prior to timing out.
769
+ hours : int, default 0
770
+ Number of hours to wait prior to timing out.
810
771
  """
811
772
  ...
812
773
 
813
774
  @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
- """
775
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
819
776
  ...
820
777
 
821
778
  @typing.overload
822
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
779
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
823
780
  ...
824
781
 
825
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
782
+ 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):
826
783
  """
827
- Decorator prototype for all step decorators. This function gets specialized
828
- and imported for all decorators types by _import_plugin_decorators().
784
+ Specifies a timeout for your step.
785
+
786
+ This decorator is useful if this step may hang indefinitely.
787
+
788
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
789
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
790
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
791
+
792
+ Note that all the values specified in parameters are added together so if you specify
793
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
794
+
795
+ Parameters
796
+ ----------
797
+ seconds : int, default 0
798
+ Number of seconds to wait prior to timing out.
799
+ minutes : int, default 0
800
+ Number of minutes to wait prior to timing out.
801
+ hours : int, default 0
802
+ Number of hours to wait prior to timing out.
829
803
  """
830
804
  ...
831
805
 
832
806
  @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]]]:
807
+ 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]]]:
834
808
  """
835
- Enables loading / saving of models within a step.
809
+ Specifies the number of times the task corresponding
810
+ to a step needs to be retried.
836
811
 
812
+ This decorator is useful for handling transient errors, such as networking issues.
813
+ If your task contains operations that can't be retried safely, e.g. database updates,
814
+ it is advisable to annotate it with `@retry(times=0)`.
815
+
816
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
817
+ decorator will execute a no-op task after all retries have been exhausted,
818
+ ensuring that the flow execution can continue.
837
819
 
838
820
  Parameters
839
821
  ----------
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.
822
+ times : int, default 3
823
+ Number of times to retry this task.
824
+ minutes_between_retries : int, default 2
825
+ Number of minutes between retries.
826
+ """
827
+ ...
828
+
829
+ @typing.overload
830
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
831
+ ...
832
+
833
+ @typing.overload
834
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
835
+ ...
836
+
837
+ 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):
838
+ """
839
+ Specifies the number of times the task corresponding
840
+ to a step needs to be retried.
850
841
 
851
- temp_dir_root : str, default: None
852
- The root directory under which `current.model.loaded` will store loaded models
842
+ This decorator is useful for handling transient errors, such as networking issues.
843
+ If your task contains operations that can't be retried safely, e.g. database updates,
844
+ it is advisable to annotate it with `@retry(times=0)`.
853
845
 
846
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
847
+ decorator will execute a no-op task after all retries have been exhausted,
848
+ ensuring that the flow execution can continue.
854
849
 
850
+ Parameters
851
+ ----------
852
+ times : int, default 3
853
+ Number of times to retry this task.
854
+ minutes_between_retries : int, default 2
855
+ Number of minutes between retries.
856
+ """
857
+ ...
858
+
859
+ @typing.overload
860
+ 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]]]:
861
+ """
862
+ Specifies environment variables to be set prior to the execution of a step.
855
863
 
864
+ Parameters
865
+ ----------
866
+ vars : Dict[str, str], default {}
867
+ Dictionary of environment variables to set.
856
868
  """
857
869
  ...
858
870
 
859
871
  @typing.overload
860
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
872
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
861
873
  ...
862
874
 
863
875
  @typing.overload
864
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
876
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
865
877
  ...
866
878
 
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):
879
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
868
880
  """
869
- Enables loading / saving of models within a step.
870
-
881
+ Specifies environment variables to be set prior to the execution of a step.
871
882
 
872
883
  Parameters
873
884
  ----------
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
-
885
+ vars : Dict[str, str], default {}
886
+ Dictionary of environment variables to set.
887
+ """
888
+ ...
889
+
890
+ @typing.overload
891
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
892
+ """
893
+ Internal decorator to support Fast bakery
894
+ """
895
+ ...
896
+
897
+ @typing.overload
898
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
899
+ ...
900
+
901
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
902
+ """
903
+ Internal decorator to support Fast bakery
890
904
  """
891
905
  ...
892
906
 
@@ -940,217 +954,213 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
940
954
  ...
941
955
 
942
956
  @typing.overload
943
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
957
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
944
958
  """
945
- Internal decorator to support Fast bakery
959
+ Decorator prototype for all step decorators. This function gets specialized
960
+ and imported for all decorators types by _import_plugin_decorators().
946
961
  """
947
962
  ...
948
963
 
949
964
  @typing.overload
950
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
965
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
951
966
  ...
952
967
 
953
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
968
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
954
969
  """
955
- Internal decorator to support Fast bakery
970
+ Decorator prototype for all step decorators. This function gets specialized
971
+ and imported for all decorators types by _import_plugin_decorators().
956
972
  """
957
973
  ...
958
974
 
959
975
  @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]]]:
976
+ 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]]]:
961
977
  """
962
- Specifies the resources needed when executing this step.
963
-
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`.
978
+ Specifies secrets to be retrieved and injected as environment variables prior to
979
+ the execution of a step.
977
980
 
978
981
  Parameters
979
982
  ----------
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.
983
+ sources : List[Union[str, Dict[str, Any]]], default: []
984
+ List of secret specs, defining how the secrets are to be retrieved
991
985
  """
992
986
  ...
993
987
 
994
988
  @typing.overload
995
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
989
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
996
990
  ...
997
991
 
998
992
  @typing.overload
999
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
993
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1000
994
  ...
1001
995
 
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):
996
+ 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]]] = []):
1003
997
  """
1004
- Specifies the resources needed when executing this step.
1005
-
1006
- Use `@resources` to specify the resource requirements
1007
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1008
-
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`.
998
+ Specifies secrets to be retrieved and injected as environment variables prior to
999
+ the execution of a step.
1019
1000
 
1020
1001
  Parameters
1021
1002
  ----------
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.
1003
+ sources : List[Union[str, Dict[str, Any]]], default: []
1004
+ List of secret specs, defining how the secrets are to be retrieved
1033
1005
  """
1034
1006
  ...
1035
1007
 
1036
1008
  @typing.overload
1037
- 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]]]:
1009
+ 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]]]:
1038
1010
  """
1039
- Specifies environment variables to be set prior to the execution of a step.
1011
+ Enables checkpointing for a step.
1012
+
1040
1013
 
1041
1014
  Parameters
1042
1015
  ----------
1043
- vars : Dict[str, str], default {}
1044
- Dictionary of environment variables to set.
1016
+ load_policy : str, default: "fresh"
1017
+ The policy for loading the checkpoint. The following policies are supported:
1018
+ - "eager": Loads the the latest available checkpoint within the namespace.
1019
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1020
+ will be loaded at the start of the task.
1021
+ - "none": Do not load any checkpoint
1022
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1023
+ This mode helps loading checkpoints across various retry attempts of the same task.
1024
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1025
+ created within the task will be loaded when the task is retries execution on failure.
1026
+
1027
+ temp_dir_root : str, default: None
1028
+ The root directory under which `current.checkpoint.directory` will be created.
1029
+
1030
+
1031
+
1045
1032
  """
1046
1033
  ...
1047
1034
 
1048
1035
  @typing.overload
1049
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1036
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1050
1037
  ...
1051
1038
 
1052
1039
  @typing.overload
1053
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1040
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1054
1041
  ...
1055
1042
 
1056
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1043
+ 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):
1057
1044
  """
1058
- Specifies environment variables to be set prior to the execution of a step.
1045
+ Enables checkpointing for a step.
1046
+
1059
1047
 
1060
1048
  Parameters
1061
1049
  ----------
1062
- vars : Dict[str, str], default {}
1063
- Dictionary of environment variables to set.
1050
+ load_policy : str, default: "fresh"
1051
+ The policy for loading the checkpoint. The following policies are supported:
1052
+ - "eager": Loads the the latest available checkpoint within the namespace.
1053
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1054
+ will be loaded at the start of the task.
1055
+ - "none": Do not load any checkpoint
1056
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1057
+ This mode helps loading checkpoints across various retry attempts of the same task.
1058
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1059
+ created within the task will be loaded when the task is retries execution on failure.
1060
+
1061
+ temp_dir_root : str, default: None
1062
+ The root directory under which `current.checkpoint.directory` will be created.
1063
+
1064
+
1065
+
1064
1066
  """
1065
1067
  ...
1066
1068
 
1067
1069
  @typing.overload
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]]]:
1070
+ 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]]]:
1069
1071
  """
1070
- Creates a human-readable report, a Metaflow Card, after this step completes.
1072
+ Specifies the PyPI packages for the step.
1071
1073
 
1072
- Note that you may add multiple `@card` decorators in a step with different parameters.
1074
+ Information in this decorator will augment any
1075
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1076
+ you can use `@pypi_base` to set packages required by all
1077
+ steps and use `@pypi` to specify step-specific overrides.
1073
1078
 
1074
1079
  Parameters
1075
1080
  ----------
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
-
1081
+ packages : Dict[str, str], default: {}
1082
+ Packages to use for this step. The key is the name of the package
1083
+ and the value is the version to use.
1084
+ python : str, optional, default: None
1085
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1086
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1086
1087
  """
1087
1088
  ...
1088
1089
 
1089
1090
  @typing.overload
1090
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1091
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1091
1092
  ...
1092
1093
 
1093
1094
  @typing.overload
1094
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1095
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1095
1096
  ...
1096
1097
 
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):
1098
+ 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):
1098
1099
  """
1099
- Creates a human-readable report, a Metaflow Card, after this step completes.
1100
+ Specifies the PyPI packages for the step.
1100
1101
 
1101
- Note that you may add multiple `@card` decorators in a step with different parameters.
1102
+ Information in this decorator will augment any
1103
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1104
+ you can use `@pypi_base` to set packages required by all
1105
+ steps and use `@pypi` to specify step-specific overrides.
1102
1106
 
1103
1107
  Parameters
1104
1108
  ----------
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
-
1109
+ packages : Dict[str, str], default: {}
1110
+ Packages to use for this step. The key is the name of the package
1111
+ and the value is the version to use.
1112
+ python : str, optional, default: None
1113
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1114
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1115
1115
  """
1116
1116
  ...
1117
1117
 
1118
1118
  @typing.overload
1119
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1119
+ 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]]:
1120
1120
  """
1121
- Specifies the PyPI packages for all steps of the flow.
1121
+ Specifies the Conda environment for all steps of the flow.
1122
+
1123
+ Use `@conda_base` to set common libraries required by all
1124
+ steps and use `@conda` to specify step-specific additions.
1122
1125
 
1123
- Use `@pypi_base` to set common packages required by all
1124
- steps and use `@pypi` to specify step-specific overrides.
1125
1126
  Parameters
1126
1127
  ----------
1127
- packages : Dict[str, str], default: {}
1128
+ packages : Dict[str, str], default {}
1128
1129
  Packages to use for this flow. The key is the name of the package
1129
1130
  and the value is the version to use.
1130
- python : str, optional, default: None
1131
+ libraries : Dict[str, str], default {}
1132
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1133
+ python : str, optional, default None
1131
1134
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1132
1135
  that the version used will correspond to the version of the Python interpreter used to start the run.
1136
+ disabled : bool, default False
1137
+ If set to True, disables Conda.
1133
1138
  """
1134
1139
  ...
1135
1140
 
1136
1141
  @typing.overload
1137
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1142
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1138
1143
  ...
1139
1144
 
1140
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1145
+ 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):
1141
1146
  """
1142
- Specifies the PyPI packages for all steps of the flow.
1147
+ Specifies the Conda environment for all steps of the flow.
1148
+
1149
+ Use `@conda_base` to set common libraries required by all
1150
+ steps and use `@conda` to specify step-specific additions.
1143
1151
 
1144
- Use `@pypi_base` to set common packages required by all
1145
- steps and use `@pypi` to specify step-specific overrides.
1146
1152
  Parameters
1147
1153
  ----------
1148
- packages : Dict[str, str], default: {}
1154
+ packages : Dict[str, str], default {}
1149
1155
  Packages to use for this flow. The key is the name of the package
1150
1156
  and the value is the version to use.
1151
- python : str, optional, default: None
1157
+ libraries : Dict[str, str], default {}
1158
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1159
+ python : str, optional, default None
1152
1160
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1153
1161
  that the version used will correspond to the version of the Python interpreter used to start the run.
1162
+ disabled : bool, default False
1163
+ If set to True, disables Conda.
1154
1164
  """
1155
1165
  ...
1156
1166
 
@@ -1196,45 +1206,34 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1196
1206
  """
1197
1207
  ...
1198
1208
 
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]]:
1209
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1200
1210
  """
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.
1211
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1212
+
1213
+ User code call
1214
+ -----------
1215
+ @nim(
1216
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1217
+ backend='managed'
1218
+ )
1219
+
1220
+ Valid backend options
1221
+ ---------------------
1222
+ - 'managed': Outerbounds selects a compute provider based on the model.
1223
+ - 🚧 'dataplane': Run in your account.
1224
+
1225
+ Valid model options
1226
+ ----------------
1227
+ - 'meta/llama3-8b-instruct': 8B parameter model
1228
+ - 'meta/llama3-70b-instruct': 70B parameter model
1229
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1206
1230
 
1207
1231
  Parameters
1208
1232
  ----------
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)
1233
+ models: list[NIM]
1234
+ List of NIM containers running models in sidecars.
1235
+ backend: str
1236
+ Compute provider to run the NIM container.
1238
1237
  """
1239
1238
  ...
1240
1239
 
@@ -1265,218 +1264,124 @@ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False,
1265
1264
  Parameters
1266
1265
  ----------
1267
1266
  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
-
1267
+ Run the workflow hourly.
1268
+ daily : bool, default True
1269
+ Run the workflow daily.
1270
+ weekly : bool, default False
1271
+ Run the workflow weekly.
1272
+ cron : str, optional, default None
1273
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1274
+ specified by this expression.
1275
+ timezone : str, optional, default None
1276
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1277
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1351
1278
  """
1352
1279
  ...
1353
1280
 
1354
1281
  @typing.overload
1355
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1282
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1356
1283
  ...
1357
1284
 
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] = {}):
1285
+ 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):
1359
1286
  """
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
- ```
1287
+ Specifies the times when the flow should be run when running on a
1288
+ production scheduler.
1389
1289
 
1390
1290
  Parameters
1391
1291
  ----------
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
-
1292
+ hourly : bool, default False
1293
+ Run the workflow hourly.
1294
+ daily : bool, default True
1295
+ Run the workflow daily.
1296
+ weekly : bool, default False
1297
+ Run the workflow weekly.
1298
+ cron : str, optional, default None
1299
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1300
+ specified by this expression.
1301
+ timezone : str, optional, default None
1302
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1303
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1400
1304
  """
1401
1305
  ...
1402
1306
 
1403
1307
  @typing.overload
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]]:
1308
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1405
1309
  """
1406
- Specifies the Conda environment for all steps of the flow.
1407
-
1408
- Use `@conda_base` to set common libraries required by all
1409
- steps and use `@conda` to specify step-specific additions.
1310
+ Specifies the PyPI packages for all steps of the flow.
1410
1311
 
1312
+ Use `@pypi_base` to set common packages required by all
1313
+ steps and use `@pypi` to specify step-specific overrides.
1411
1314
  Parameters
1412
1315
  ----------
1413
- packages : Dict[str, str], default {}
1316
+ packages : Dict[str, str], default: {}
1414
1317
  Packages to use for this flow. The key is the name of the package
1415
1318
  and the value is the version to use.
1416
- libraries : Dict[str, str], default {}
1417
- Supported for backward compatibility. When used with packages, packages will take precedence.
1418
- python : str, optional, default None
1319
+ python : str, optional, default: None
1419
1320
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1420
1321
  that the version used will correspond to the version of the Python interpreter used to start the run.
1421
- disabled : bool, default False
1422
- If set to True, disables Conda.
1423
1322
  """
1424
1323
  ...
1425
1324
 
1426
1325
  @typing.overload
1427
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1326
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1428
1327
  ...
1429
1328
 
1430
- 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):
1329
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1431
1330
  """
1432
- Specifies the Conda environment for all steps of the flow.
1433
-
1434
- Use `@conda_base` to set common libraries required by all
1435
- steps and use `@conda` to specify step-specific additions.
1331
+ Specifies the PyPI packages for all steps of the flow.
1436
1332
 
1333
+ Use `@pypi_base` to set common packages required by all
1334
+ steps and use `@pypi` to specify step-specific overrides.
1437
1335
  Parameters
1438
1336
  ----------
1439
- packages : Dict[str, str], default {}
1337
+ packages : Dict[str, str], default: {}
1440
1338
  Packages to use for this flow. The key is the name of the package
1441
1339
  and the value is the version to use.
1442
- libraries : Dict[str, str], default {}
1443
- Supported for backward compatibility. When used with packages, packages will take precedence.
1444
- python : str, optional, default None
1340
+ python : str, optional, default: None
1445
1341
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1446
1342
  that the version used will correspond to the version of the Python interpreter used to start the run.
1447
- disabled : bool, default False
1448
- If set to True, disables Conda.
1449
1343
  """
1450
1344
  ...
1451
1345
 
1452
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1346
+ 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]]:
1453
1347
  """
1454
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1455
-
1456
- User code call
1457
- -----------
1458
- @nim(
1459
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1460
- backend='managed'
1461
- )
1462
-
1463
- Valid backend options
1464
- ---------------------
1465
- - 'managed': Outerbounds selects a compute provider based on the model.
1466
- - 🚧 'dataplane': Run in your account.
1467
-
1468
- Valid model options
1469
- ----------------
1470
- - 'meta/llama3-8b-instruct': 8B parameter model
1471
- - 'meta/llama3-70b-instruct': 70B parameter model
1472
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1348
+ 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)
1349
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1350
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1351
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1352
+ starts only after all sensors finish.
1473
1353
 
1474
1354
  Parameters
1475
1355
  ----------
1476
- models: list[NIM]
1477
- List of NIM containers running models in sidecars.
1478
- backend: str
1479
- Compute provider to run the NIM container.
1356
+ timeout : int
1357
+ Time, in seconds before the task times out and fails. (Default: 3600)
1358
+ poke_interval : int
1359
+ Time in seconds that the job should wait in between each try. (Default: 60)
1360
+ mode : str
1361
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1362
+ exponential_backoff : bool
1363
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1364
+ pool : str
1365
+ the slot pool this task should run in,
1366
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1367
+ soft_fail : bool
1368
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1369
+ name : str
1370
+ Name of the sensor on Airflow
1371
+ description : str
1372
+ Description of sensor in the Airflow UI
1373
+ bucket_key : Union[str, List[str]]
1374
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1375
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1376
+ bucket_name : str
1377
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1378
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1379
+ wildcard_match : bool
1380
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1381
+ aws_conn_id : str
1382
+ a reference to the s3 connection on Airflow. (Default: None)
1383
+ verify : bool
1384
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1480
1385
  """
1481
1386
  ...
1482
1387
 
@@ -1583,6 +1488,101 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1583
1488
  """
1584
1489
  ...
1585
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.