ob-metaflow-stubs 6.0.3.102rc3__py2.py3-none-any.whl → 6.0.3.102rc4__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. metaflow-stubs/__init__.pyi +648 -648
  2. metaflow-stubs/cards.pyi +4 -4
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +3 -3
  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 +4 -4
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  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 +63 -63
  18. metaflow-stubs/mflog/mflog.pyi +1 -1
  19. metaflow-stubs/multicore_utils.pyi +1 -1
  20. metaflow-stubs/parameters.pyi +3 -3
  21. metaflow-stubs/plugins/__init__.pyi +1 -1
  22. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  24. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +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 +4 -4
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +1 -1
  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 +3 -3
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +1 -1
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  52. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +1 -1
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  59. metaflow-stubs/plugins/cards/__init__.pyi +1 -1
  60. metaflow-stubs/plugins/cards/card_cli.pyi +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 +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  74. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  75. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  76. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  77. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  82. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  83. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  84. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  85. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  88. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +1 -1
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  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 +1 -1
  111. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  112. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  113. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  114. metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  117. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  118. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  120. metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
  121. metaflow-stubs/procpoll.pyi +1 -1
  122. metaflow-stubs/profilers/__init__.pyi +1 -1
  123. metaflow-stubs/pylint_wrapper.pyi +1 -1
  124. metaflow-stubs/runner/__init__.pyi +1 -1
  125. metaflow-stubs/runner/deployer.pyi +3 -3
  126. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  127. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  128. metaflow-stubs/runner/nbrun.pyi +1 -1
  129. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  130. metaflow-stubs/runner/utils.pyi +1 -1
  131. metaflow-stubs/system/__init__.pyi +2 -2
  132. metaflow-stubs/system/system_logger.pyi +2 -2
  133. metaflow-stubs/system/system_monitor.pyi +1 -1
  134. metaflow-stubs/tagging_util.pyi +1 -1
  135. metaflow-stubs/tuple_util.pyi +1 -1
  136. {ob_metaflow_stubs-6.0.3.102rc3.dist-info → ob_metaflow_stubs-6.0.3.102rc4.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.102rc4.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.102rc3.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.102rc3.dist-info → ob_metaflow_stubs-6.0.3.102rc4.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.102rc3.dist-info → ob_metaflow_stubs-6.0.3.102rc4.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-20T19:02:23.973955 #
4
+ # Generated on 2024-09-20T19:06:14.547638 #
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.runner.metaflow_runner
12
+ import metaflow.parameters
11
13
  import metaflow.flowspec
12
- import datetime
14
+ import metaflow.datastore.inputs
15
+ import metaflow.events
16
+ import metaflow.client.core
13
17
  import metaflow._vendor.click.types
14
- import metaflow.parameters
15
18
  import typing
16
- import metaflow.datastore.inputs
17
19
  import metaflow.metaflow_current
18
- import metaflow.events
19
- import metaflow.runner.metaflow_runner
20
+ import datetime
20
21
  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,254 +434,52 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
434
434
  """
435
435
  ...
436
436
 
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]]]:
438
- """
439
- Specifies that this step should execute on Kubernetes.
440
-
441
- Parameters
442
- ----------
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.
500
- """
501
- ...
502
-
503
437
  @typing.overload
504
- def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
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]]]:
505
439
  """
506
- Specifies the Conda environment for the step.
440
+ Specifies the PyPI packages for the step.
507
441
 
508
442
  Information in this decorator will augment any
509
- attributes set in the `@conda_base` flow-level decorator. Hence,
510
- you can use `@conda_base` to set packages required by all
511
- steps and use `@conda` to specify step-specific overrides.
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.
512
446
 
513
447
  Parameters
514
448
  ----------
515
- packages : Dict[str, str], default {}
449
+ packages : Dict[str, str], default: {}
516
450
  Packages to use for this step. The key is the name of the package
517
451
  and the value is the version to use.
518
- libraries : Dict[str, str], default {}
519
- Supported for backward compatibility. When used with packages, packages will take precedence.
520
- python : str, optional, default None
452
+ python : str, optional, default: None
521
453
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
522
454
  that the version used will correspond to the version of the Python interpreter used to start the run.
523
- disabled : bool, default False
524
- If set to True, disables @conda.
525
455
  """
526
456
  ...
527
457
 
528
458
  @typing.overload
529
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
459
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
530
460
  ...
531
461
 
532
462
  @typing.overload
533
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
463
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
534
464
  ...
535
465
 
536
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
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):
537
467
  """
538
- Specifies the Conda environment for the step.
468
+ Specifies the PyPI packages for the step.
539
469
 
540
470
  Information in this decorator will augment any
541
- attributes set in the `@conda_base` flow-level decorator. Hence,
542
- you can use `@conda_base` to set packages required by all
543
- steps and use `@conda` to specify step-specific overrides.
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.
544
474
 
545
475
  Parameters
546
476
  ----------
547
- packages : Dict[str, str], default {}
477
+ packages : Dict[str, str], default: {}
548
478
  Packages to use for this step. The key is the name of the package
549
479
  and the value is the version to use.
550
- libraries : Dict[str, str], default {}
551
- Supported for backward compatibility. When used with packages, packages will take precedence.
552
- python : str, optional, default None
480
+ python : str, optional, default: None
553
481
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
554
482
  that the version used will correspond to the version of the Python interpreter used to start the run.
555
- disabled : bool, default False
556
- If set to True, disables @conda.
557
- """
558
- ...
559
-
560
- @typing.overload
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]]]:
562
- """
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`.
578
-
579
- Parameters
580
- ----------
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.
592
- """
593
- ...
594
-
595
- @typing.overload
596
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
597
- ...
598
-
599
- @typing.overload
600
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
601
- ...
602
-
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):
604
- """
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`.
620
-
621
- Parameters
622
- ----------
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.
634
- """
635
- ...
636
-
637
- @typing.overload
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]]]:
639
- """
640
- Creates a human-readable report, a Metaflow Card, after this step completes.
641
-
642
- Note that you may add multiple `@card` decorators in a step with different parameters.
643
-
644
- Parameters
645
- ----------
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
- """
657
- ...
658
-
659
- @typing.overload
660
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
661
- ...
662
-
663
- @typing.overload
664
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
665
- ...
666
-
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):
668
- """
669
- Creates a human-readable report, a Metaflow Card, after this step completes.
670
-
671
- Note that you may add multiple `@card` decorators in a step with different parameters.
672
-
673
- Parameters
674
- ----------
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
-
685
483
  """
686
484
  ...
687
485
 
@@ -747,112 +545,19 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
747
545
  ...
748
546
 
749
547
  @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]]]:
548
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
751
549
  """
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.
762
-
763
- Parameters
764
- ----------
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.
771
- """
772
- ...
773
-
774
- @typing.overload
775
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
776
- ...
777
-
778
- @typing.overload
779
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
780
- ...
781
-
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):
783
- """
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.
803
- """
804
- ...
805
-
806
- @typing.overload
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]]]:
808
- """
809
- Specifies the number of times the task corresponding
810
- to a step needs to be retried.
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.
819
-
820
- Parameters
821
- ----------
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.
550
+ Internal decorator to support Fast bakery
826
551
  """
827
552
  ...
828
553
 
829
554
  @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]:
555
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
835
556
  ...
836
557
 
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):
558
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
838
559
  """
839
- Specifies the number of times the task corresponding
840
- to a step needs to be retried.
841
-
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)`.
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.
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.
560
+ Internal decorator to support Fast bakery
856
561
  """
857
562
  ...
858
563
 
@@ -887,91 +592,6 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
887
592
  """
888
593
  ...
889
594
 
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
904
- """
905
- ...
906
-
907
- @typing.overload
908
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
909
- """
910
- Specifies that the step will success under all circumstances.
911
-
912
- The decorator will create an optional artifact, specified by `var`, which
913
- contains the exception raised. You can use it to detect the presence
914
- of errors, indicating that all happy-path artifacts produced by the step
915
- are missing.
916
-
917
- Parameters
918
- ----------
919
- var : str, optional, default None
920
- Name of the artifact in which to store the caught exception.
921
- If not specified, the exception is not stored.
922
- print_exception : bool, default True
923
- Determines whether or not the exception is printed to
924
- stdout when caught.
925
- """
926
- ...
927
-
928
- @typing.overload
929
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
930
- ...
931
-
932
- @typing.overload
933
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
934
- ...
935
-
936
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
937
- """
938
- Specifies that the step will success under all circumstances.
939
-
940
- The decorator will create an optional artifact, specified by `var`, which
941
- contains the exception raised. You can use it to detect the presence
942
- of errors, indicating that all happy-path artifacts produced by the step
943
- are missing.
944
-
945
- Parameters
946
- ----------
947
- var : str, optional, default None
948
- Name of the artifact in which to store the caught exception.
949
- If not specified, the exception is not stored.
950
- print_exception : bool, default True
951
- Determines whether or not the exception is printed to
952
- stdout when caught.
953
- """
954
- ...
955
-
956
- @typing.overload
957
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
958
- """
959
- Decorator prototype for all step decorators. This function gets specialized
960
- and imported for all decorators types by _import_plugin_decorators().
961
- """
962
- ...
963
-
964
- @typing.overload
965
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
966
- ...
967
-
968
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
969
- """
970
- Decorator prototype for all step decorators. This function gets specialized
971
- and imported for all decorators types by _import_plugin_decorators().
972
- """
973
- ...
974
-
975
595
  @typing.overload
976
596
  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]]]:
977
597
  """
@@ -1067,92 +687,153 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
1067
687
  ...
1068
688
 
1069
689
  @typing.overload
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]]]:
690
+ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1071
691
  """
1072
- Specifies the PyPI packages for the step.
692
+ Specifies that the step will success under all circumstances.
1073
693
 
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.
694
+ The decorator will create an optional artifact, specified by `var`, which
695
+ contains the exception raised. You can use it to detect the presence
696
+ of errors, indicating that all happy-path artifacts produced by the step
697
+ are missing.
1078
698
 
1079
699
  Parameters
1080
700
  ----------
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.
701
+ var : str, optional, default None
702
+ Name of the artifact in which to store the caught exception.
703
+ If not specified, the exception is not stored.
704
+ print_exception : bool, default True
705
+ Determines whether or not the exception is printed to
706
+ stdout when caught.
1087
707
  """
1088
708
  ...
1089
709
 
1090
710
  @typing.overload
1091
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
711
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1092
712
  ...
1093
713
 
1094
714
  @typing.overload
1095
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
715
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1096
716
  ...
1097
717
 
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):
718
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
1099
719
  """
1100
- Specifies the PyPI packages for the step.
720
+ Specifies that the step will success under all circumstances.
1101
721
 
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.
722
+ The decorator will create an optional artifact, specified by `var`, which
723
+ contains the exception raised. You can use it to detect the presence
724
+ of errors, indicating that all happy-path artifacts produced by the step
725
+ are missing.
1106
726
 
1107
727
  Parameters
1108
728
  ----------
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.
729
+ var : str, optional, default None
730
+ Name of the artifact in which to store the caught exception.
731
+ If not specified, the exception is not stored.
732
+ print_exception : bool, default True
733
+ Determines whether or not the exception is printed to
734
+ stdout when caught.
1115
735
  """
1116
736
  ...
1117
737
 
1118
- @typing.overload
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]]:
738
+ 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]]]:
1120
739
  """
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.
740
+ Specifies that this step should execute on Kubernetes.
1125
741
 
1126
742
  Parameters
1127
743
  ----------
1128
- packages : Dict[str, str], default {}
1129
- Packages to use for this flow. The key is the name of the package
1130
- and the value is the version to use.
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
1134
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
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.
1138
- """
1139
- ...
1140
-
1141
- @typing.overload
1142
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1143
- ...
1144
-
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):
744
+ cpu : int, default 1
745
+ Number of CPUs required for this step. If `@resources` is
746
+ also present, the maximum value from all decorators is used.
747
+ memory : int, default 4096
748
+ Memory size (in MB) required for this step. If
749
+ `@resources` is also present, the maximum value from all decorators is
750
+ used.
751
+ disk : int, default 10240
752
+ Disk size (in MB) required for this step. If
753
+ `@resources` is also present, the maximum value from all decorators is
754
+ used.
755
+ image : str, optional, default None
756
+ Docker image to use when launching on Kubernetes. If not specified, and
757
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
758
+ not, a default Docker image mapping to the current version of Python is used.
759
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
760
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
761
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
762
+ Kubernetes service account to use when launching pod in Kubernetes.
763
+ secrets : List[str], optional, default None
764
+ Kubernetes secrets to use when launching pod in Kubernetes. These
765
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
766
+ in Metaflow configuration.
767
+ node_selector: Union[Dict[str,str], str], optional, default None
768
+ Kubernetes node selector(s) to apply to the pod running the task.
769
+ Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
770
+ or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
771
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
772
+ Kubernetes namespace to use when launching pod in Kubernetes.
773
+ gpu : int, optional, default None
774
+ Number of GPUs required for this step. A value of zero implies that
775
+ the scheduled node should not have GPUs.
776
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
777
+ The vendor of the GPUs to be used for this step.
778
+ tolerations : List[str], default []
779
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
780
+ Kubernetes tolerations to use when launching pod in Kubernetes.
781
+ use_tmpfs : bool, default False
782
+ This enables an explicit tmpfs mount for this step.
783
+ tmpfs_tempdir : bool, default True
784
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
785
+ tmpfs_size : int, optional, default: None
786
+ The value for the size (in MiB) of the tmpfs mount for this step.
787
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
788
+ memory allocated for this step.
789
+ tmpfs_path : str, optional, default /metaflow_temp
790
+ Path to tmpfs mount for this step.
791
+ persistent_volume_claims : Dict[str, str], optional, default None
792
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
793
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
794
+ shared_memory: int, optional
795
+ Shared memory size (in MiB) required for this step
796
+ port: int, optional
797
+ Port number to specify in the Kubernetes job object
798
+ compute_pool : str, optional, default None
799
+ Compute pool to be used for for this step.
800
+ If not specified, any accessible compute pool within the perimeter is used.
1146
801
  """
1147
- Specifies the Conda environment for all steps of the flow.
802
+ ...
803
+
804
+ @typing.overload
805
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
806
+ """
807
+ Decorator prototype for all step decorators. This function gets specialized
808
+ and imported for all decorators types by _import_plugin_decorators().
809
+ """
810
+ ...
811
+
812
+ @typing.overload
813
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
814
+ ...
815
+
816
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
817
+ """
818
+ Decorator prototype for all step decorators. This function gets specialized
819
+ and imported for all decorators types by _import_plugin_decorators().
820
+ """
821
+ ...
822
+
823
+ @typing.overload
824
+ def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
825
+ """
826
+ Specifies the Conda environment for the step.
1148
827
 
1149
- Use `@conda_base` to set common libraries required by all
1150
- steps and use `@conda` to specify step-specific additions.
828
+ Information in this decorator will augment any
829
+ attributes set in the `@conda_base` flow-level decorator. Hence,
830
+ you can use `@conda_base` to set packages required by all
831
+ steps and use `@conda` to specify step-specific overrides.
1151
832
 
1152
833
  Parameters
1153
834
  ----------
1154
835
  packages : Dict[str, str], default {}
1155
- Packages to use for this flow. The key is the name of the package
836
+ Packages to use for this step. The key is the name of the package
1156
837
  and the value is the version to use.
1157
838
  libraries : Dict[str, str], default {}
1158
839
  Supported for backward compatibility. When used with packages, packages will take precedence.
@@ -1160,98 +841,422 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1160
841
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1161
842
  that the version used will correspond to the version of the Python interpreter used to start the run.
1162
843
  disabled : bool, default False
1163
- If set to True, disables Conda.
844
+ If set to True, disables @conda.
1164
845
  """
1165
846
  ...
1166
847
 
1167
- def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
848
+ @typing.overload
849
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
850
+ ...
851
+
852
+ @typing.overload
853
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
854
+ ...
855
+
856
+ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1168
857
  """
1169
- The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1170
- This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
858
+ Specifies the Conda environment for the step.
859
+
860
+ Information in this decorator will augment any
861
+ attributes set in the `@conda_base` flow-level decorator. Hence,
862
+ you can use `@conda_base` to set packages required by all
863
+ steps and use `@conda` to specify step-specific overrides.
1171
864
 
1172
865
  Parameters
1173
866
  ----------
1174
- timeout : int
1175
- Time, in seconds before the task times out and fails. (Default: 3600)
1176
- poke_interval : int
1177
- Time in seconds that the job should wait in between each try. (Default: 60)
1178
- mode : str
1179
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1180
- exponential_backoff : bool
1181
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1182
- pool : str
1183
- the slot pool this task should run in,
1184
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1185
- soft_fail : bool
1186
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1187
- name : str
1188
- Name of the sensor on Airflow
1189
- description : str
1190
- Description of sensor in the Airflow UI
1191
- external_dag_id : str
1192
- The dag_id that contains the task you want to wait for.
1193
- external_task_ids : List[str]
1194
- The list of task_ids that you want to wait for.
1195
- If None (default value) the sensor waits for the DAG. (Default: None)
1196
- allowed_states : List[str]
1197
- Iterable of allowed states, (Default: ['success'])
1198
- failed_states : List[str]
1199
- Iterable of failed or dis-allowed states. (Default: None)
1200
- execution_delta : datetime.timedelta
1201
- time difference with the previous execution to look at,
1202
- the default is the same logical date as the current task or DAG. (Default: None)
1203
- check_existence: bool
1204
- Set to True to check if the external task exists or check if
1205
- the DAG to wait for exists. (Default: True)
867
+ packages : Dict[str, str], default {}
868
+ Packages to use for this step. The key is the name of the package
869
+ and the value is the version to use.
870
+ libraries : Dict[str, str], default {}
871
+ Supported for backward compatibility. When used with packages, packages will take precedence.
872
+ python : str, optional, default None
873
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
874
+ that the version used will correspond to the version of the Python interpreter used to start the run.
875
+ disabled : bool, default False
876
+ If set to True, disables @conda.
1206
877
  """
1207
878
  ...
1208
879
 
1209
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
880
+ @typing.overload
881
+ 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]]]:
1210
882
  """
1211
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
883
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1212
884
 
1213
- User code call
1214
- -----------
1215
- @nim(
1216
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1217
- backend='managed'
1218
- )
885
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1219
886
 
1220
- Valid backend options
1221
- ---------------------
1222
- - 'managed': Outerbounds selects a compute provider based on the model.
1223
- - 🚧 'dataplane': Run in your account.
887
+ Parameters
888
+ ----------
889
+ type : str, default 'default'
890
+ Card type.
891
+ id : str, optional, default None
892
+ If multiple cards are present, use this id to identify this card.
893
+ options : Dict[str, Any], default {}
894
+ Options passed to the card. The contents depend on the card type.
895
+ timeout : int, default 45
896
+ Interrupt reporting if it takes more than this many seconds.
1224
897
 
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
898
+
899
+ """
900
+ ...
901
+
902
+ @typing.overload
903
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
904
+ ...
905
+
906
+ @typing.overload
907
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
908
+ ...
909
+
910
+ 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):
911
+ """
912
+ Creates a human-readable report, a Metaflow Card, after this step completes.
913
+
914
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1230
915
 
1231
916
  Parameters
1232
917
  ----------
1233
- models: list[NIM]
1234
- List of NIM containers running models in sidecars.
1235
- backend: str
1236
- Compute provider to run the NIM container.
918
+ type : str, default 'default'
919
+ Card type.
920
+ id : str, optional, default None
921
+ If multiple cards are present, use this id to identify this card.
922
+ options : Dict[str, Any], default {}
923
+ Options passed to the card. The contents depend on the card type.
924
+ timeout : int, default 45
925
+ Interrupt reporting if it takes more than this many seconds.
926
+
927
+
1237
928
  """
1238
929
  ...
1239
930
 
1240
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
931
+ @typing.overload
932
+ 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]]]:
1241
933
  """
1242
- Specifies what flows belong to the same project.
934
+ Specifies the number of times the task corresponding
935
+ to a step needs to be retried.
1243
936
 
1244
- A project-specific namespace is created for all flows that
1245
- use the same `@project(name)`.
937
+ This decorator is useful for handling transient errors, such as networking issues.
938
+ If your task contains operations that can't be retried safely, e.g. database updates,
939
+ it is advisable to annotate it with `@retry(times=0)`.
940
+
941
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
942
+ decorator will execute a no-op task after all retries have been exhausted,
943
+ ensuring that the flow execution can continue.
1246
944
 
1247
945
  Parameters
1248
946
  ----------
1249
- name : str
1250
- Project name. Make sure that the name is unique amongst all
1251
- projects that use the same production scheduler. The name may
1252
- contain only lowercase alphanumeric characters and underscores.
947
+ times : int, default 3
948
+ Number of times to retry this task.
949
+ minutes_between_retries : int, default 2
950
+ Number of minutes between retries.
951
+ """
952
+ ...
953
+
954
+ @typing.overload
955
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
956
+ ...
957
+
958
+ @typing.overload
959
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
960
+ ...
961
+
962
+ 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):
963
+ """
964
+ Specifies the number of times the task corresponding
965
+ to a step needs to be retried.
1253
966
 
967
+ This decorator is useful for handling transient errors, such as networking issues.
968
+ If your task contains operations that can't be retried safely, e.g. database updates,
969
+ it is advisable to annotate it with `@retry(times=0)`.
1254
970
 
971
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
972
+ decorator will execute a no-op task after all retries have been exhausted,
973
+ ensuring that the flow execution can continue.
974
+
975
+ Parameters
976
+ ----------
977
+ times : int, default 3
978
+ Number of times to retry this task.
979
+ minutes_between_retries : int, default 2
980
+ Number of minutes between retries.
981
+ """
982
+ ...
983
+
984
+ @typing.overload
985
+ 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]]]:
986
+ """
987
+ Specifies the resources needed when executing this step.
988
+
989
+ Use `@resources` to specify the resource requirements
990
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
991
+
992
+ You can choose the compute layer on the command line by executing e.g.
993
+ ```
994
+ python myflow.py run --with batch
995
+ ```
996
+ or
997
+ ```
998
+ python myflow.py run --with kubernetes
999
+ ```
1000
+ which executes the flow on the desired system using the
1001
+ requirements specified in `@resources`.
1002
+
1003
+ Parameters
1004
+ ----------
1005
+ cpu : int, default 1
1006
+ Number of CPUs required for this step.
1007
+ gpu : int, default 0
1008
+ Number of GPUs required for this step.
1009
+ disk : int, optional, default None
1010
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1011
+ memory : int, default 4096
1012
+ Memory size (in MB) required for this step.
1013
+ shared_memory : int, optional, default None
1014
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1015
+ This parameter maps to the `--shm-size` option in Docker.
1016
+ """
1017
+ ...
1018
+
1019
+ @typing.overload
1020
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1021
+ ...
1022
+
1023
+ @typing.overload
1024
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1025
+ ...
1026
+
1027
+ 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):
1028
+ """
1029
+ Specifies the resources needed when executing this step.
1030
+
1031
+ Use `@resources` to specify the resource requirements
1032
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1033
+
1034
+ You can choose the compute layer on the command line by executing e.g.
1035
+ ```
1036
+ python myflow.py run --with batch
1037
+ ```
1038
+ or
1039
+ ```
1040
+ python myflow.py run --with kubernetes
1041
+ ```
1042
+ which executes the flow on the desired system using the
1043
+ requirements specified in `@resources`.
1044
+
1045
+ Parameters
1046
+ ----------
1047
+ cpu : int, default 1
1048
+ Number of CPUs required for this step.
1049
+ gpu : int, default 0
1050
+ Number of GPUs required for this step.
1051
+ disk : int, optional, default None
1052
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1053
+ memory : int, default 4096
1054
+ Memory size (in MB) required for this step.
1055
+ shared_memory : int, optional, default None
1056
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1057
+ This parameter maps to the `--shm-size` option in Docker.
1058
+ """
1059
+ ...
1060
+
1061
+ @typing.overload
1062
+ 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]]]:
1063
+ """
1064
+ Specifies a timeout for your step.
1065
+
1066
+ This decorator is useful if this step may hang indefinitely.
1067
+
1068
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1069
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1070
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1071
+
1072
+ Note that all the values specified in parameters are added together so if you specify
1073
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1074
+
1075
+ Parameters
1076
+ ----------
1077
+ seconds : int, default 0
1078
+ Number of seconds to wait prior to timing out.
1079
+ minutes : int, default 0
1080
+ Number of minutes to wait prior to timing out.
1081
+ hours : int, default 0
1082
+ Number of hours to wait prior to timing out.
1083
+ """
1084
+ ...
1085
+
1086
+ @typing.overload
1087
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1088
+ ...
1089
+
1090
+ @typing.overload
1091
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1092
+ ...
1093
+
1094
+ 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):
1095
+ """
1096
+ Specifies a timeout for your step.
1097
+
1098
+ This decorator is useful if this step may hang indefinitely.
1099
+
1100
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1101
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1102
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1103
+
1104
+ Note that all the values specified in parameters are added together so if you specify
1105
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1106
+
1107
+ Parameters
1108
+ ----------
1109
+ seconds : int, default 0
1110
+ Number of seconds to wait prior to timing out.
1111
+ minutes : int, default 0
1112
+ Number of minutes to wait prior to timing out.
1113
+ hours : int, default 0
1114
+ Number of hours to wait prior to timing out.
1115
+ """
1116
+ ...
1117
+
1118
+ @typing.overload
1119
+ def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1120
+ """
1121
+ Specifies the flow(s) that this flow depends on.
1122
+
1123
+ ```
1124
+ @trigger_on_finish(flow='FooFlow')
1125
+ ```
1126
+ or
1127
+ ```
1128
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1129
+ ```
1130
+ This decorator respects the @project decorator and triggers the flow
1131
+ when upstream runs within the same namespace complete successfully
1132
+
1133
+ Additionally, you can specify project aware upstream flow dependencies
1134
+ by specifying the fully qualified project_flow_name.
1135
+ ```
1136
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1137
+ ```
1138
+ or
1139
+ ```
1140
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1141
+ ```
1142
+
1143
+ You can also specify just the project or project branch (other values will be
1144
+ inferred from the current project or project branch):
1145
+ ```
1146
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1147
+ ```
1148
+
1149
+ Note that `branch` is typically one of:
1150
+ - `prod`
1151
+ - `user.bob`
1152
+ - `test.my_experiment`
1153
+ - `prod.staging`
1154
+
1155
+ Parameters
1156
+ ----------
1157
+ flow : Union[str, Dict[str, str]], optional, default None
1158
+ Upstream flow dependency for this flow.
1159
+ flows : List[Union[str, Dict[str, str]]], default []
1160
+ Upstream flow dependencies for this flow.
1161
+ options : Dict[str, Any], default {}
1162
+ Backend-specific configuration for tuning eventing behavior.
1163
+
1164
+
1165
+ """
1166
+ ...
1167
+
1168
+ @typing.overload
1169
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1170
+ ...
1171
+
1172
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1173
+ """
1174
+ Specifies the flow(s) that this flow depends on.
1175
+
1176
+ ```
1177
+ @trigger_on_finish(flow='FooFlow')
1178
+ ```
1179
+ or
1180
+ ```
1181
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1182
+ ```
1183
+ This decorator respects the @project decorator and triggers the flow
1184
+ when upstream runs within the same namespace complete successfully
1185
+
1186
+ Additionally, you can specify project aware upstream flow dependencies
1187
+ by specifying the fully qualified project_flow_name.
1188
+ ```
1189
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1190
+ ```
1191
+ or
1192
+ ```
1193
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1194
+ ```
1195
+
1196
+ You can also specify just the project or project branch (other values will be
1197
+ inferred from the current project or project branch):
1198
+ ```
1199
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1200
+ ```
1201
+
1202
+ Note that `branch` is typically one of:
1203
+ - `prod`
1204
+ - `user.bob`
1205
+ - `test.my_experiment`
1206
+ - `prod.staging`
1207
+
1208
+ Parameters
1209
+ ----------
1210
+ flow : Union[str, Dict[str, str]], optional, default None
1211
+ Upstream flow dependency for this flow.
1212
+ flows : List[Union[str, Dict[str, str]]], default []
1213
+ Upstream flow dependencies for this flow.
1214
+ options : Dict[str, Any], default {}
1215
+ Backend-specific configuration for tuning eventing behavior.
1216
+
1217
+
1218
+ """
1219
+ ...
1220
+
1221
+ 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]]:
1222
+ """
1223
+ 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)
1224
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1225
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1226
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1227
+ starts only after all sensors finish.
1228
+
1229
+ Parameters
1230
+ ----------
1231
+ timeout : int
1232
+ Time, in seconds before the task times out and fails. (Default: 3600)
1233
+ poke_interval : int
1234
+ Time in seconds that the job should wait in between each try. (Default: 60)
1235
+ mode : str
1236
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1237
+ exponential_backoff : bool
1238
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1239
+ pool : str
1240
+ the slot pool this task should run in,
1241
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1242
+ soft_fail : bool
1243
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1244
+ name : str
1245
+ Name of the sensor on Airflow
1246
+ description : str
1247
+ Description of sensor in the Airflow UI
1248
+ bucket_key : Union[str, List[str]]
1249
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1250
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1251
+ bucket_name : str
1252
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1253
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1254
+ wildcard_match : bool
1255
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1256
+ aws_conn_id : str
1257
+ a reference to the s3 connection on Airflow. (Default: None)
1258
+ verify : bool
1259
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1255
1260
  """
1256
1261
  ...
1257
1262
 
@@ -1304,6 +1309,86 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1304
1309
  """
1305
1310
  ...
1306
1311
 
1312
+ @typing.overload
1313
+ 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]]:
1314
+ """
1315
+ Specifies the Conda environment for all steps of the flow.
1316
+
1317
+ Use `@conda_base` to set common libraries required by all
1318
+ steps and use `@conda` to specify step-specific additions.
1319
+
1320
+ Parameters
1321
+ ----------
1322
+ packages : Dict[str, str], default {}
1323
+ Packages to use for this flow. The key is the name of the package
1324
+ and the value is the version to use.
1325
+ libraries : Dict[str, str], default {}
1326
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1327
+ python : str, optional, default None
1328
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1329
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1330
+ disabled : bool, default False
1331
+ If set to True, disables Conda.
1332
+ """
1333
+ ...
1334
+
1335
+ @typing.overload
1336
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1337
+ ...
1338
+
1339
+ 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):
1340
+ """
1341
+ Specifies the Conda environment for all steps of the flow.
1342
+
1343
+ Use `@conda_base` to set common libraries required by all
1344
+ steps and use `@conda` to specify step-specific additions.
1345
+
1346
+ Parameters
1347
+ ----------
1348
+ packages : Dict[str, str], default {}
1349
+ Packages to use for this flow. The key is the name of the package
1350
+ and the value is the version to use.
1351
+ libraries : Dict[str, str], default {}
1352
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1353
+ python : str, optional, default None
1354
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1355
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1356
+ disabled : bool, default False
1357
+ If set to True, disables Conda.
1358
+ """
1359
+ ...
1360
+
1361
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1362
+ """
1363
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1364
+
1365
+ User code call
1366
+ -----------
1367
+ @nim(
1368
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1369
+ backend='managed'
1370
+ )
1371
+
1372
+ Valid backend options
1373
+ ---------------------
1374
+ - 'managed': Outerbounds selects a compute provider based on the model.
1375
+ - 🚧 'dataplane': Run in your account.
1376
+
1377
+ Valid model options
1378
+ ----------------
1379
+ - 'meta/llama3-8b-instruct': 8B parameter model
1380
+ - 'meta/llama3-70b-instruct': 70B parameter model
1381
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1382
+
1383
+ Parameters
1384
+ ----------
1385
+ models: list[NIM]
1386
+ List of NIM containers running models in sidecars.
1387
+ backend: str
1388
+ Compute provider to run the NIM container.
1389
+ """
1390
+ ...
1391
+
1307
1392
  @typing.overload
1308
1393
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1309
1394
  """
@@ -1343,13 +1428,28 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1343
1428
  """
1344
1429
  ...
1345
1430
 
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]]:
1431
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1347
1432
  """
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.
1433
+ Specifies what flows belong to the same project.
1434
+
1435
+ A project-specific namespace is created for all flows that
1436
+ use the same `@project(name)`.
1437
+
1438
+ Parameters
1439
+ ----------
1440
+ name : str
1441
+ Project name. Make sure that the name is unique amongst all
1442
+ projects that use the same production scheduler. The name may
1443
+ contain only lowercase alphanumeric characters and underscores.
1444
+
1445
+
1446
+ """
1447
+ ...
1448
+
1449
+ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1450
+ """
1451
+ The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1452
+ This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1353
1453
 
1354
1454
  Parameters
1355
1455
  ----------
@@ -1370,121 +1470,21 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1370
1470
  Name of the sensor on Airflow
1371
1471
  description : str
1372
1472
  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)
1385
- """
1386
- ...
1387
-
1388
- @typing.overload
1389
- def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1390
- """
1391
- Specifies the flow(s) that this flow depends on.
1392
-
1393
- ```
1394
- @trigger_on_finish(flow='FooFlow')
1395
- ```
1396
- or
1397
- ```
1398
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1399
- ```
1400
- This decorator respects the @project decorator and triggers the flow
1401
- when upstream runs within the same namespace complete successfully
1402
-
1403
- Additionally, you can specify project aware upstream flow dependencies
1404
- by specifying the fully qualified project_flow_name.
1405
- ```
1406
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1407
- ```
1408
- or
1409
- ```
1410
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1411
- ```
1412
-
1413
- You can also specify just the project or project branch (other values will be
1414
- inferred from the current project or project branch):
1415
- ```
1416
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1417
- ```
1418
-
1419
- Note that `branch` is typically one of:
1420
- - `prod`
1421
- - `user.bob`
1422
- - `test.my_experiment`
1423
- - `prod.staging`
1424
-
1425
- Parameters
1426
- ----------
1427
- flow : Union[str, Dict[str, str]], optional, default None
1428
- Upstream flow dependency for this flow.
1429
- flows : List[Union[str, Dict[str, str]]], default []
1430
- Upstream flow dependencies for this flow.
1431
- options : Dict[str, Any], default {}
1432
- Backend-specific configuration for tuning eventing behavior.
1433
-
1434
-
1435
- """
1436
- ...
1437
-
1438
- @typing.overload
1439
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1440
- ...
1441
-
1442
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1443
- """
1444
- Specifies the flow(s) that this flow depends on.
1445
-
1446
- ```
1447
- @trigger_on_finish(flow='FooFlow')
1448
- ```
1449
- or
1450
- ```
1451
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1452
- ```
1453
- This decorator respects the @project decorator and triggers the flow
1454
- when upstream runs within the same namespace complete successfully
1455
-
1456
- Additionally, you can specify project aware upstream flow dependencies
1457
- by specifying the fully qualified project_flow_name.
1458
- ```
1459
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1460
- ```
1461
- or
1462
- ```
1463
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1464
- ```
1465
-
1466
- You can also specify just the project or project branch (other values will be
1467
- inferred from the current project or project branch):
1468
- ```
1469
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1470
- ```
1471
-
1472
- Note that `branch` is typically one of:
1473
- - `prod`
1474
- - `user.bob`
1475
- - `test.my_experiment`
1476
- - `prod.staging`
1477
-
1478
- Parameters
1479
- ----------
1480
- flow : Union[str, Dict[str, str]], optional, default None
1481
- Upstream flow dependency for this flow.
1482
- flows : List[Union[str, Dict[str, str]]], default []
1483
- Upstream flow dependencies for this flow.
1484
- options : Dict[str, Any], default {}
1485
- Backend-specific configuration for tuning eventing behavior.
1486
-
1487
-
1473
+ external_dag_id : str
1474
+ The dag_id that contains the task you want to wait for.
1475
+ external_task_ids : List[str]
1476
+ The list of task_ids that you want to wait for.
1477
+ If None (default value) the sensor waits for the DAG. (Default: None)
1478
+ allowed_states : List[str]
1479
+ Iterable of allowed states, (Default: ['success'])
1480
+ failed_states : List[str]
1481
+ Iterable of failed or dis-allowed states. (Default: None)
1482
+ execution_delta : datetime.timedelta
1483
+ time difference with the previous execution to look at,
1484
+ the default is the same logical date as the current task or DAG. (Default: None)
1485
+ check_existence: bool
1486
+ Set to True to check if the external task exists or check if
1487
+ the DAG to wait for exists. (Default: True)
1488
1488
  """
1489
1489
  ...
1490
1490