ob-metaflow-stubs 6.0.3.111__py2.py3-none-any.whl → 6.0.3.112rc0__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- metaflow-stubs/__init__.pyi +594 -594
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/clone_util.pyi +1 -1
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata/metadata.pyi +1 -1
- metaflow-stubs/metadata/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +45 -45
- metaflow-stubs/mflog/mflog.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/parameters.pyi +1 -1
- metaflow-stubs/plugins/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/logs_cli.pyi +2 -2
- metaflow-stubs/plugins/package_cli.pyi +1 -1
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/tag_cli.pyi +4 -4
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/procpoll.pyi +1 -1
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +1 -1
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- {ob_metaflow_stubs-6.0.3.111.dist-info → ob_metaflow_stubs-6.0.3.112rc0.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.112rc0.dist-info/RECORD +140 -0
- ob_metaflow_stubs-6.0.3.111.dist-info/RECORD +0 -140
- {ob_metaflow_stubs-6.0.3.111.dist-info → ob_metaflow_stubs-6.0.3.112rc0.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.111.dist-info → ob_metaflow_stubs-6.0.3.112rc0.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.12.25.2+obcheckpoint(0.1.0);ob(v1) #
|
4
|
-
# Generated on 2024-10-
|
4
|
+
# Generated on 2024-10-21T18:58:32.974120 #
|
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.
|
11
|
+
import metaflow.metaflow_current
|
12
12
|
import metaflow.parameters
|
13
13
|
import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
14
|
-
import metaflow.
|
15
|
-
import metaflow.events
|
16
|
-
import metaflow.datastore.inputs
|
14
|
+
import metaflow.flowspec
|
17
15
|
import typing
|
18
|
-
import metaflow.
|
19
|
-
import metaflow.client.core
|
16
|
+
import metaflow.events
|
20
17
|
import datetime
|
18
|
+
import metaflow.client.core
|
19
|
+
import metaflow.datastore.inputs
|
20
|
+
import metaflow._vendor.click.types
|
21
21
|
import metaflow.runner.metaflow_runner
|
22
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
23
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
@@ -513,21 +513,112 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
513
513
|
...
|
514
514
|
|
515
515
|
@typing.overload
|
516
|
-
def
|
516
|
+
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]]]:
|
517
517
|
"""
|
518
|
-
|
519
|
-
|
518
|
+
Specifies a timeout for your step.
|
519
|
+
|
520
|
+
This decorator is useful if this step may hang indefinitely.
|
521
|
+
|
522
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
523
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
524
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
525
|
+
|
526
|
+
Note that all the values specified in parameters are added together so if you specify
|
527
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
528
|
+
|
529
|
+
Parameters
|
530
|
+
----------
|
531
|
+
seconds : int, default 0
|
532
|
+
Number of seconds to wait prior to timing out.
|
533
|
+
minutes : int, default 0
|
534
|
+
Number of minutes to wait prior to timing out.
|
535
|
+
hours : int, default 0
|
536
|
+
Number of hours to wait prior to timing out.
|
520
537
|
"""
|
521
538
|
...
|
522
539
|
|
523
540
|
@typing.overload
|
524
|
-
def
|
541
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
525
542
|
...
|
526
543
|
|
527
|
-
|
544
|
+
@typing.overload
|
545
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
546
|
+
...
|
547
|
+
|
548
|
+
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):
|
528
549
|
"""
|
529
|
-
|
530
|
-
|
550
|
+
Specifies a timeout for your step.
|
551
|
+
|
552
|
+
This decorator is useful if this step may hang indefinitely.
|
553
|
+
|
554
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
555
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
556
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
557
|
+
|
558
|
+
Note that all the values specified in parameters are added together so if you specify
|
559
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
560
|
+
|
561
|
+
Parameters
|
562
|
+
----------
|
563
|
+
seconds : int, default 0
|
564
|
+
Number of seconds to wait prior to timing out.
|
565
|
+
minutes : int, default 0
|
566
|
+
Number of minutes to wait prior to timing out.
|
567
|
+
hours : int, default 0
|
568
|
+
Number of hours to wait prior to timing out.
|
569
|
+
"""
|
570
|
+
...
|
571
|
+
|
572
|
+
@typing.overload
|
573
|
+
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]]]:
|
574
|
+
"""
|
575
|
+
Specifies the number of times the task corresponding
|
576
|
+
to a step needs to be retried.
|
577
|
+
|
578
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
579
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
580
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
581
|
+
|
582
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
583
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
584
|
+
ensuring that the flow execution can continue.
|
585
|
+
|
586
|
+
Parameters
|
587
|
+
----------
|
588
|
+
times : int, default 3
|
589
|
+
Number of times to retry this task.
|
590
|
+
minutes_between_retries : int, default 2
|
591
|
+
Number of minutes between retries.
|
592
|
+
"""
|
593
|
+
...
|
594
|
+
|
595
|
+
@typing.overload
|
596
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
597
|
+
...
|
598
|
+
|
599
|
+
@typing.overload
|
600
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
601
|
+
...
|
602
|
+
|
603
|
+
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):
|
604
|
+
"""
|
605
|
+
Specifies the number of times the task corresponding
|
606
|
+
to a step needs to be retried.
|
607
|
+
|
608
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
609
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
610
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
611
|
+
|
612
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
613
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
614
|
+
ensuring that the flow execution can continue.
|
615
|
+
|
616
|
+
Parameters
|
617
|
+
----------
|
618
|
+
times : int, default 3
|
619
|
+
Number of times to retry this task.
|
620
|
+
minutes_between_retries : int, default 2
|
621
|
+
Number of minutes between retries.
|
531
622
|
"""
|
532
623
|
...
|
533
624
|
|
@@ -589,80 +680,6 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
589
680
|
|
590
681
|
|
591
682
|
|
592
|
-
"""
|
593
|
-
...
|
594
|
-
|
595
|
-
@typing.overload
|
596
|
-
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]]]:
|
597
|
-
"""
|
598
|
-
Enables loading / saving of models within a step.
|
599
|
-
|
600
|
-
|
601
|
-
Parameters
|
602
|
-
----------
|
603
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
604
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
605
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
606
|
-
- `current.checkpoint`
|
607
|
-
- `current.model`
|
608
|
-
- `current.huggingface_hub`
|
609
|
-
|
610
|
-
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
|
611
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
612
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
613
|
-
|
614
|
-
temp_dir_root : str, default: None
|
615
|
-
The root directory under which `current.model.loaded` will store loaded models
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
"""
|
620
|
-
...
|
621
|
-
|
622
|
-
@typing.overload
|
623
|
-
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
624
|
-
...
|
625
|
-
|
626
|
-
@typing.overload
|
627
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
628
|
-
...
|
629
|
-
|
630
|
-
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):
|
631
|
-
"""
|
632
|
-
Enables loading / saving of models within a step.
|
633
|
-
|
634
|
-
|
635
|
-
Parameters
|
636
|
-
----------
|
637
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
638
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
639
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
640
|
-
- `current.checkpoint`
|
641
|
-
- `current.model`
|
642
|
-
- `current.huggingface_hub`
|
643
|
-
|
644
|
-
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
|
645
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
646
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
647
|
-
|
648
|
-
temp_dir_root : str, default: None
|
649
|
-
The root directory under which `current.model.loaded` will store loaded models
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
"""
|
654
|
-
...
|
655
|
-
|
656
|
-
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
657
|
-
"""
|
658
|
-
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
659
|
-
|
660
|
-
Parameters
|
661
|
-
----------
|
662
|
-
temp_dir_root : str, optional
|
663
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
664
|
-
|
665
|
-
|
666
683
|
"""
|
667
684
|
...
|
668
685
|
|
@@ -744,92 +761,108 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
744
761
|
...
|
745
762
|
|
746
763
|
@typing.overload
|
747
|
-
def
|
764
|
+
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]]]:
|
748
765
|
"""
|
749
|
-
Specifies
|
750
|
-
|
766
|
+
Specifies the PyPI packages for the step.
|
767
|
+
|
768
|
+
Information in this decorator will augment any
|
769
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
770
|
+
you can use `@pypi_base` to set packages required by all
|
771
|
+
steps and use `@pypi` to specify step-specific overrides.
|
751
772
|
|
752
773
|
Parameters
|
753
774
|
----------
|
754
|
-
|
755
|
-
|
775
|
+
packages : Dict[str, str], default: {}
|
776
|
+
Packages to use for this step. The key is the name of the package
|
777
|
+
and the value is the version to use.
|
778
|
+
python : str, optional, default: None
|
779
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
780
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
756
781
|
"""
|
757
782
|
...
|
758
783
|
|
759
784
|
@typing.overload
|
760
|
-
def
|
785
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
761
786
|
...
|
762
787
|
|
763
788
|
@typing.overload
|
764
|
-
def
|
789
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
765
790
|
...
|
766
791
|
|
767
|
-
def
|
792
|
+
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):
|
768
793
|
"""
|
769
|
-
Specifies
|
770
|
-
|
794
|
+
Specifies the PyPI packages for the step.
|
795
|
+
|
796
|
+
Information in this decorator will augment any
|
797
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
798
|
+
you can use `@pypi_base` to set packages required by all
|
799
|
+
steps and use `@pypi` to specify step-specific overrides.
|
771
800
|
|
772
801
|
Parameters
|
773
802
|
----------
|
774
|
-
|
775
|
-
|
803
|
+
packages : Dict[str, str], default: {}
|
804
|
+
Packages to use for this step. The key is the name of the package
|
805
|
+
and the value is the version to use.
|
806
|
+
python : str, optional, default: None
|
807
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
808
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
776
809
|
"""
|
777
810
|
...
|
778
811
|
|
779
812
|
@typing.overload
|
780
|
-
def
|
813
|
+
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]]]:
|
781
814
|
"""
|
782
|
-
Specifies
|
783
|
-
|
784
|
-
This decorator is useful if this step may hang indefinitely.
|
785
|
-
|
786
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
787
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
788
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
815
|
+
Specifies the Conda environment for the step.
|
789
816
|
|
790
|
-
|
791
|
-
|
817
|
+
Information in this decorator will augment any
|
818
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
819
|
+
you can use `@conda_base` to set packages required by all
|
820
|
+
steps and use `@conda` to specify step-specific overrides.
|
792
821
|
|
793
822
|
Parameters
|
794
823
|
----------
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
824
|
+
packages : Dict[str, str], default {}
|
825
|
+
Packages to use for this step. The key is the name of the package
|
826
|
+
and the value is the version to use.
|
827
|
+
libraries : Dict[str, str], default {}
|
828
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
829
|
+
python : str, optional, default None
|
830
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
831
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
832
|
+
disabled : bool, default False
|
833
|
+
If set to True, disables @conda.
|
834
|
+
"""
|
835
|
+
...
|
836
|
+
|
804
837
|
@typing.overload
|
805
|
-
def
|
838
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
806
839
|
...
|
807
840
|
|
808
841
|
@typing.overload
|
809
|
-
def
|
842
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
810
843
|
...
|
811
844
|
|
812
|
-
def
|
845
|
+
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):
|
813
846
|
"""
|
814
|
-
Specifies
|
815
|
-
|
816
|
-
This decorator is useful if this step may hang indefinitely.
|
817
|
-
|
818
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
819
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
820
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
847
|
+
Specifies the Conda environment for the step.
|
821
848
|
|
822
|
-
|
823
|
-
|
849
|
+
Information in this decorator will augment any
|
850
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
851
|
+
you can use `@conda_base` to set packages required by all
|
852
|
+
steps and use `@conda` to specify step-specific overrides.
|
824
853
|
|
825
854
|
Parameters
|
826
855
|
----------
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
856
|
+
packages : Dict[str, str], default {}
|
857
|
+
Packages to use for this step. The key is the name of the package
|
858
|
+
and the value is the version to use.
|
859
|
+
libraries : Dict[str, str], default {}
|
860
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
861
|
+
python : str, optional, default None
|
862
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
863
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
864
|
+
disabled : bool, default False
|
865
|
+
If set to True, disables @conda.
|
833
866
|
"""
|
834
867
|
...
|
835
868
|
|
@@ -884,6 +917,23 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
884
917
|
"""
|
885
918
|
...
|
886
919
|
|
920
|
+
@typing.overload
|
921
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
922
|
+
"""
|
923
|
+
Internal decorator to support Fast bakery
|
924
|
+
"""
|
925
|
+
...
|
926
|
+
|
927
|
+
@typing.overload
|
928
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
929
|
+
...
|
930
|
+
|
931
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
932
|
+
"""
|
933
|
+
Internal decorator to support Fast bakery
|
934
|
+
"""
|
935
|
+
...
|
936
|
+
|
887
937
|
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]]]:
|
888
938
|
"""
|
889
939
|
Specifies that this step should execute on Kubernetes.
|
@@ -951,104 +1001,140 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
951
1001
|
...
|
952
1002
|
|
953
1003
|
@typing.overload
|
954
|
-
def
|
1004
|
+
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]]]:
|
955
1005
|
"""
|
956
|
-
|
1006
|
+
Enables loading / saving of models within a step.
|
957
1007
|
|
958
|
-
Information in this decorator will augment any
|
959
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
960
|
-
you can use `@pypi_base` to set packages required by all
|
961
|
-
steps and use `@pypi` to specify step-specific overrides.
|
962
1008
|
|
963
1009
|
Parameters
|
964
1010
|
----------
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
1011
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
1012
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
1013
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
1014
|
+
- `current.checkpoint`
|
1015
|
+
- `current.model`
|
1016
|
+
- `current.huggingface_hub`
|
1017
|
+
|
1018
|
+
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
|
1019
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
1020
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
1021
|
+
|
1022
|
+
temp_dir_root : str, default: None
|
1023
|
+
The root directory under which `current.model.loaded` will store loaded models
|
1024
|
+
|
1025
|
+
|
1026
|
+
|
971
1027
|
"""
|
972
1028
|
...
|
973
1029
|
|
974
1030
|
@typing.overload
|
975
|
-
def
|
1031
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
976
1032
|
...
|
977
1033
|
|
978
1034
|
@typing.overload
|
979
|
-
def
|
1035
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
980
1036
|
...
|
981
1037
|
|
982
|
-
def
|
1038
|
+
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):
|
983
1039
|
"""
|
984
|
-
|
1040
|
+
Enables loading / saving of models within a step.
|
985
1041
|
|
986
|
-
Information in this decorator will augment any
|
987
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
988
|
-
you can use `@pypi_base` to set packages required by all
|
989
|
-
steps and use `@pypi` to specify step-specific overrides.
|
990
1042
|
|
991
1043
|
Parameters
|
992
1044
|
----------
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
1045
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
1046
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
1047
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
1048
|
+
- `current.checkpoint`
|
1049
|
+
- `current.model`
|
1050
|
+
- `current.huggingface_hub`
|
1051
|
+
|
1052
|
+
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
|
1053
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
1054
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
1055
|
+
|
1056
|
+
temp_dir_root : str, default: None
|
1057
|
+
The root directory under which `current.model.loaded` will store loaded models
|
1058
|
+
|
1059
|
+
|
1060
|
+
|
999
1061
|
"""
|
1000
1062
|
...
|
1001
1063
|
|
1002
|
-
|
1003
|
-
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]]]:
|
1064
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1004
1065
|
"""
|
1005
|
-
|
1006
|
-
to a step needs to be retried.
|
1066
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
1007
1067
|
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1068
|
+
Parameters
|
1069
|
+
----------
|
1070
|
+
temp_dir_root : str, optional
|
1071
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
1011
1072
|
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1073
|
+
|
1074
|
+
"""
|
1075
|
+
...
|
1076
|
+
|
1077
|
+
@typing.overload
|
1078
|
+
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]]]:
|
1079
|
+
"""
|
1080
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1081
|
+
the execution of a step.
|
1015
1082
|
|
1016
1083
|
Parameters
|
1017
1084
|
----------
|
1018
|
-
|
1019
|
-
|
1020
|
-
minutes_between_retries : int, default 2
|
1021
|
-
Number of minutes between retries.
|
1085
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1086
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1022
1087
|
"""
|
1023
1088
|
...
|
1024
1089
|
|
1025
1090
|
@typing.overload
|
1026
|
-
def
|
1091
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1027
1092
|
...
|
1028
1093
|
|
1029
1094
|
@typing.overload
|
1030
|
-
def
|
1095
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1031
1096
|
...
|
1032
1097
|
|
1033
|
-
def
|
1098
|
+
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]]] = []):
|
1034
1099
|
"""
|
1035
|
-
Specifies
|
1036
|
-
|
1100
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1101
|
+
the execution of a step.
|
1037
1102
|
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1103
|
+
Parameters
|
1104
|
+
----------
|
1105
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1106
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1107
|
+
"""
|
1108
|
+
...
|
1109
|
+
|
1110
|
+
@typing.overload
|
1111
|
+
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]]]:
|
1112
|
+
"""
|
1113
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1041
1114
|
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1115
|
+
Parameters
|
1116
|
+
----------
|
1117
|
+
vars : Dict[str, str], default {}
|
1118
|
+
Dictionary of environment variables to set.
|
1119
|
+
"""
|
1120
|
+
...
|
1121
|
+
|
1122
|
+
@typing.overload
|
1123
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1124
|
+
...
|
1125
|
+
|
1126
|
+
@typing.overload
|
1127
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1128
|
+
...
|
1129
|
+
|
1130
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1131
|
+
"""
|
1132
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1045
1133
|
|
1046
1134
|
Parameters
|
1047
1135
|
----------
|
1048
|
-
|
1049
|
-
|
1050
|
-
minutes_between_retries : int, default 2
|
1051
|
-
Number of minutes between retries.
|
1136
|
+
vars : Dict[str, str], default {}
|
1137
|
+
Dictionary of environment variables to set.
|
1052
1138
|
"""
|
1053
1139
|
...
|
1054
1140
|
|
@@ -1102,195 +1188,310 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1102
1188
|
...
|
1103
1189
|
|
1104
1190
|
@typing.overload
|
1105
|
-
def
|
1191
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1106
1192
|
"""
|
1107
|
-
|
1108
|
-
|
1109
|
-
Parameters
|
1110
|
-
----------
|
1111
|
-
vars : Dict[str, str], default {}
|
1112
|
-
Dictionary of environment variables to set.
|
1193
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1194
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1113
1195
|
"""
|
1114
1196
|
...
|
1115
1197
|
|
1116
1198
|
@typing.overload
|
1117
|
-
def
|
1199
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1118
1200
|
...
|
1119
1201
|
|
1120
|
-
|
1121
|
-
|
1202
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1203
|
+
"""
|
1204
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1205
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1206
|
+
"""
|
1122
1207
|
...
|
1123
1208
|
|
1124
|
-
def
|
1209
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1125
1210
|
"""
|
1126
|
-
Specifies
|
1211
|
+
Specifies what flows belong to the same project.
|
1212
|
+
|
1213
|
+
A project-specific namespace is created for all flows that
|
1214
|
+
use the same `@project(name)`.
|
1127
1215
|
|
1128
1216
|
Parameters
|
1129
1217
|
----------
|
1130
|
-
|
1131
|
-
|
1218
|
+
name : str
|
1219
|
+
Project name. Make sure that the name is unique amongst all
|
1220
|
+
projects that use the same production scheduler. The name may
|
1221
|
+
contain only lowercase alphanumeric characters and underscores.
|
1222
|
+
|
1223
|
+
|
1132
1224
|
"""
|
1133
1225
|
...
|
1134
1226
|
|
1135
|
-
|
1136
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1137
|
-
"""
|
1138
|
-
Internal decorator to support Fast bakery
|
1227
|
+
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]]:
|
1139
1228
|
"""
|
1140
|
-
|
1141
|
-
|
1142
|
-
@typing.overload
|
1143
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1144
|
-
...
|
1145
|
-
|
1146
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1147
|
-
"""
|
1148
|
-
Internal decorator to support Fast bakery
|
1149
|
-
"""
|
1150
|
-
...
|
1151
|
-
|
1152
|
-
@typing.overload
|
1153
|
-
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]]]:
|
1154
|
-
"""
|
1155
|
-
Specifies the Conda environment for the step.
|
1156
|
-
|
1157
|
-
Information in this decorator will augment any
|
1158
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1159
|
-
you can use `@conda_base` to set packages required by all
|
1160
|
-
steps and use `@conda` to specify step-specific overrides.
|
1229
|
+
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.
|
1230
|
+
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.
|
1161
1231
|
|
1162
1232
|
Parameters
|
1163
1233
|
----------
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1234
|
+
timeout : int
|
1235
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1236
|
+
poke_interval : int
|
1237
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1238
|
+
mode : str
|
1239
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1240
|
+
exponential_backoff : bool
|
1241
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1242
|
+
pool : str
|
1243
|
+
the slot pool this task should run in,
|
1244
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1245
|
+
soft_fail : bool
|
1246
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1247
|
+
name : str
|
1248
|
+
Name of the sensor on Airflow
|
1249
|
+
description : str
|
1250
|
+
Description of sensor in the Airflow UI
|
1251
|
+
external_dag_id : str
|
1252
|
+
The dag_id that contains the task you want to wait for.
|
1253
|
+
external_task_ids : List[str]
|
1254
|
+
The list of task_ids that you want to wait for.
|
1255
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1256
|
+
allowed_states : List[str]
|
1257
|
+
Iterable of allowed states, (Default: ['success'])
|
1258
|
+
failed_states : List[str]
|
1259
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1260
|
+
execution_delta : datetime.timedelta
|
1261
|
+
time difference with the previous execution to look at,
|
1262
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1263
|
+
check_existence: bool
|
1264
|
+
Set to True to check if the external task exists or check if
|
1265
|
+
the DAG to wait for exists. (Default: True)
|
1174
1266
|
"""
|
1175
1267
|
...
|
1176
1268
|
|
1177
|
-
|
1178
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1179
|
-
...
|
1180
|
-
|
1181
|
-
@typing.overload
|
1182
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1183
|
-
...
|
1184
|
-
|
1185
|
-
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):
|
1269
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1186
1270
|
"""
|
1187
|
-
|
1271
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1188
1272
|
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1273
|
+
User code call
|
1274
|
+
-----------
|
1275
|
+
@nim(
|
1276
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1277
|
+
backend='managed'
|
1278
|
+
)
|
1279
|
+
|
1280
|
+
Valid backend options
|
1281
|
+
---------------------
|
1282
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1283
|
+
- 🚧 'dataplane': Run in your account.
|
1284
|
+
|
1285
|
+
Valid model options
|
1286
|
+
----------------
|
1287
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1288
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1289
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1193
1290
|
|
1194
1291
|
Parameters
|
1195
1292
|
----------
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1201
|
-
python : str, optional, default None
|
1202
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1203
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1204
|
-
disabled : bool, default False
|
1205
|
-
If set to True, disables @conda.
|
1293
|
+
models: list[NIM]
|
1294
|
+
List of NIM containers running models in sidecars.
|
1295
|
+
backend: str
|
1296
|
+
Compute provider to run the NIM container.
|
1206
1297
|
"""
|
1207
1298
|
...
|
1208
1299
|
|
1209
1300
|
@typing.overload
|
1210
|
-
def
|
1301
|
+
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]]:
|
1211
1302
|
"""
|
1212
|
-
Specifies the
|
1303
|
+
Specifies the event(s) that this flow depends on.
|
1304
|
+
|
1305
|
+
```
|
1306
|
+
@trigger(event='foo')
|
1307
|
+
```
|
1308
|
+
or
|
1309
|
+
```
|
1310
|
+
@trigger(events=['foo', 'bar'])
|
1311
|
+
```
|
1312
|
+
|
1313
|
+
Additionally, you can specify the parameter mappings
|
1314
|
+
to map event payload to Metaflow parameters for the flow.
|
1315
|
+
```
|
1316
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1317
|
+
```
|
1318
|
+
or
|
1319
|
+
```
|
1320
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1321
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1322
|
+
```
|
1323
|
+
|
1324
|
+
'parameters' can also be a list of strings and tuples like so:
|
1325
|
+
```
|
1326
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1327
|
+
```
|
1328
|
+
This is equivalent to:
|
1329
|
+
```
|
1330
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1331
|
+
```
|
1213
1332
|
|
1214
|
-
Use `@pypi_base` to set common packages required by all
|
1215
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1216
1333
|
Parameters
|
1217
1334
|
----------
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1335
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1336
|
+
Event dependency for this flow.
|
1337
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1338
|
+
Events dependency for this flow.
|
1339
|
+
options : Dict[str, Any], default {}
|
1340
|
+
Backend-specific configuration for tuning eventing behavior.
|
1341
|
+
|
1342
|
+
|
1224
1343
|
"""
|
1225
1344
|
...
|
1226
1345
|
|
1227
1346
|
@typing.overload
|
1228
|
-
def
|
1347
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1229
1348
|
...
|
1230
1349
|
|
1231
|
-
def
|
1350
|
+
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] = {}):
|
1232
1351
|
"""
|
1233
|
-
Specifies the
|
1352
|
+
Specifies the event(s) that this flow depends on.
|
1353
|
+
|
1354
|
+
```
|
1355
|
+
@trigger(event='foo')
|
1356
|
+
```
|
1357
|
+
or
|
1358
|
+
```
|
1359
|
+
@trigger(events=['foo', 'bar'])
|
1360
|
+
```
|
1361
|
+
|
1362
|
+
Additionally, you can specify the parameter mappings
|
1363
|
+
to map event payload to Metaflow parameters for the flow.
|
1364
|
+
```
|
1365
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1366
|
+
```
|
1367
|
+
or
|
1368
|
+
```
|
1369
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1370
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1371
|
+
```
|
1372
|
+
|
1373
|
+
'parameters' can also be a list of strings and tuples like so:
|
1374
|
+
```
|
1375
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1376
|
+
```
|
1377
|
+
This is equivalent to:
|
1378
|
+
```
|
1379
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1380
|
+
```
|
1234
1381
|
|
1235
|
-
Use `@pypi_base` to set common packages required by all
|
1236
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1237
1382
|
Parameters
|
1238
1383
|
----------
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1384
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1385
|
+
Event dependency for this flow.
|
1386
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1387
|
+
Events dependency for this flow.
|
1388
|
+
options : Dict[str, Any], default {}
|
1389
|
+
Backend-specific configuration for tuning eventing behavior.
|
1390
|
+
|
1391
|
+
|
1245
1392
|
"""
|
1246
1393
|
...
|
1247
1394
|
|
1248
1395
|
@typing.overload
|
1249
|
-
def
|
1396
|
+
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]]:
|
1250
1397
|
"""
|
1251
|
-
Specifies the
|
1252
|
-
|
1398
|
+
Specifies the flow(s) that this flow depends on.
|
1399
|
+
|
1400
|
+
```
|
1401
|
+
@trigger_on_finish(flow='FooFlow')
|
1402
|
+
```
|
1403
|
+
or
|
1404
|
+
```
|
1405
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1406
|
+
```
|
1407
|
+
This decorator respects the @project decorator and triggers the flow
|
1408
|
+
when upstream runs within the same namespace complete successfully
|
1409
|
+
|
1410
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1411
|
+
by specifying the fully qualified project_flow_name.
|
1412
|
+
```
|
1413
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1414
|
+
```
|
1415
|
+
or
|
1416
|
+
```
|
1417
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1418
|
+
```
|
1419
|
+
|
1420
|
+
You can also specify just the project or project branch (other values will be
|
1421
|
+
inferred from the current project or project branch):
|
1422
|
+
```
|
1423
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1424
|
+
```
|
1425
|
+
|
1426
|
+
Note that `branch` is typically one of:
|
1427
|
+
- `prod`
|
1428
|
+
- `user.bob`
|
1429
|
+
- `test.my_experiment`
|
1430
|
+
- `prod.staging`
|
1253
1431
|
|
1254
1432
|
Parameters
|
1255
1433
|
----------
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
specified by this expression.
|
1265
|
-
timezone : str, optional, default None
|
1266
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1267
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1434
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1435
|
+
Upstream flow dependency for this flow.
|
1436
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1437
|
+
Upstream flow dependencies for this flow.
|
1438
|
+
options : Dict[str, Any], default {}
|
1439
|
+
Backend-specific configuration for tuning eventing behavior.
|
1440
|
+
|
1441
|
+
|
1268
1442
|
"""
|
1269
1443
|
...
|
1270
1444
|
|
1271
1445
|
@typing.overload
|
1272
|
-
def
|
1446
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1273
1447
|
...
|
1274
1448
|
|
1275
|
-
def
|
1449
|
+
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] = {}):
|
1276
1450
|
"""
|
1277
|
-
Specifies the
|
1278
|
-
|
1451
|
+
Specifies the flow(s) that this flow depends on.
|
1452
|
+
|
1453
|
+
```
|
1454
|
+
@trigger_on_finish(flow='FooFlow')
|
1455
|
+
```
|
1456
|
+
or
|
1457
|
+
```
|
1458
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1459
|
+
```
|
1460
|
+
This decorator respects the @project decorator and triggers the flow
|
1461
|
+
when upstream runs within the same namespace complete successfully
|
1462
|
+
|
1463
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1464
|
+
by specifying the fully qualified project_flow_name.
|
1465
|
+
```
|
1466
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1467
|
+
```
|
1468
|
+
or
|
1469
|
+
```
|
1470
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1471
|
+
```
|
1472
|
+
|
1473
|
+
You can also specify just the project or project branch (other values will be
|
1474
|
+
inferred from the current project or project branch):
|
1475
|
+
```
|
1476
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1477
|
+
```
|
1478
|
+
|
1479
|
+
Note that `branch` is typically one of:
|
1480
|
+
- `prod`
|
1481
|
+
- `user.bob`
|
1482
|
+
- `test.my_experiment`
|
1483
|
+
- `prod.staging`
|
1279
1484
|
|
1280
1485
|
Parameters
|
1281
1486
|
----------
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
specified by this expression.
|
1291
|
-
timezone : str, optional, default None
|
1292
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1293
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1487
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1488
|
+
Upstream flow dependency for this flow.
|
1489
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1490
|
+
Upstream flow dependencies for this flow.
|
1491
|
+
options : Dict[str, Any], default {}
|
1492
|
+
Backend-specific configuration for tuning eventing behavior.
|
1493
|
+
|
1494
|
+
|
1294
1495
|
"""
|
1295
1496
|
...
|
1296
1497
|
|
@@ -1331,209 +1532,103 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1331
1532
|
Parameters
|
1332
1533
|
----------
|
1333
1534
|
packages : Dict[str, str], default {}
|
1334
|
-
Packages to use for this flow. The key is the name of the package
|
1335
|
-
and the value is the version to use.
|
1336
|
-
libraries : Dict[str, str], default {}
|
1337
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1338
|
-
python : str, optional, default None
|
1339
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1340
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1341
|
-
disabled : bool, default False
|
1342
|
-
If set to True, disables Conda.
|
1343
|
-
"""
|
1344
|
-
...
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
User code call
|
1351
|
-
-----------
|
1352
|
-
@nim(
|
1353
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1354
|
-
backend='managed'
|
1355
|
-
)
|
1356
|
-
|
1357
|
-
Valid backend options
|
1358
|
-
---------------------
|
1359
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
1360
|
-
- 🚧 'dataplane': Run in your account.
|
1361
|
-
|
1362
|
-
Valid model options
|
1363
|
-
----------------
|
1364
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
1365
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
1366
|
-
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1367
|
-
|
1368
|
-
Parameters
|
1369
|
-
----------
|
1370
|
-
models: list[NIM]
|
1371
|
-
List of NIM containers running models in sidecars.
|
1372
|
-
backend: str
|
1373
|
-
Compute provider to run the NIM container.
|
1374
|
-
"""
|
1375
|
-
...
|
1376
|
-
|
1377
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1378
|
-
"""
|
1379
|
-
Specifies what flows belong to the same project.
|
1380
|
-
|
1381
|
-
A project-specific namespace is created for all flows that
|
1382
|
-
use the same `@project(name)`.
|
1383
|
-
|
1384
|
-
Parameters
|
1385
|
-
----------
|
1386
|
-
name : str
|
1387
|
-
Project name. Make sure that the name is unique amongst all
|
1388
|
-
projects that use the same production scheduler. The name may
|
1389
|
-
contain only lowercase alphanumeric characters and underscores.
|
1390
|
-
|
1391
|
-
|
1392
|
-
"""
|
1393
|
-
...
|
1394
|
-
|
1395
|
-
@typing.overload
|
1396
|
-
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]]:
|
1397
|
-
"""
|
1398
|
-
Specifies the flow(s) that this flow depends on.
|
1399
|
-
|
1400
|
-
```
|
1401
|
-
@trigger_on_finish(flow='FooFlow')
|
1402
|
-
```
|
1403
|
-
or
|
1404
|
-
```
|
1405
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1406
|
-
```
|
1407
|
-
This decorator respects the @project decorator and triggers the flow
|
1408
|
-
when upstream runs within the same namespace complete successfully
|
1409
|
-
|
1410
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1411
|
-
by specifying the fully qualified project_flow_name.
|
1412
|
-
```
|
1413
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1414
|
-
```
|
1415
|
-
or
|
1416
|
-
```
|
1417
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1418
|
-
```
|
1419
|
-
|
1420
|
-
You can also specify just the project or project branch (other values will be
|
1421
|
-
inferred from the current project or project branch):
|
1422
|
-
```
|
1423
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1424
|
-
```
|
1425
|
-
|
1426
|
-
Note that `branch` is typically one of:
|
1427
|
-
- `prod`
|
1428
|
-
- `user.bob`
|
1429
|
-
- `test.my_experiment`
|
1430
|
-
- `prod.staging`
|
1535
|
+
Packages to use for this flow. The key is the name of the package
|
1536
|
+
and the value is the version to use.
|
1537
|
+
libraries : Dict[str, str], default {}
|
1538
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1539
|
+
python : str, optional, default None
|
1540
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1541
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1542
|
+
disabled : bool, default False
|
1543
|
+
If set to True, disables Conda.
|
1544
|
+
"""
|
1545
|
+
...
|
1546
|
+
|
1547
|
+
@typing.overload
|
1548
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1549
|
+
"""
|
1550
|
+
Specifies the PyPI packages for all steps of the flow.
|
1431
1551
|
|
1552
|
+
Use `@pypi_base` to set common packages required by all
|
1553
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1432
1554
|
Parameters
|
1433
1555
|
----------
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1556
|
+
packages : Dict[str, str], default: {}
|
1557
|
+
Packages to use for this flow. The key is the name of the package
|
1558
|
+
and the value is the version to use.
|
1559
|
+
python : str, optional, default: None
|
1560
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1561
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1442
1562
|
"""
|
1443
1563
|
...
|
1444
1564
|
|
1445
1565
|
@typing.overload
|
1446
|
-
def
|
1566
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1447
1567
|
...
|
1448
1568
|
|
1449
|
-
def
|
1569
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1450
1570
|
"""
|
1451
|
-
Specifies the
|
1452
|
-
|
1453
|
-
```
|
1454
|
-
@trigger_on_finish(flow='FooFlow')
|
1455
|
-
```
|
1456
|
-
or
|
1457
|
-
```
|
1458
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1459
|
-
```
|
1460
|
-
This decorator respects the @project decorator and triggers the flow
|
1461
|
-
when upstream runs within the same namespace complete successfully
|
1462
|
-
|
1463
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1464
|
-
by specifying the fully qualified project_flow_name.
|
1465
|
-
```
|
1466
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1467
|
-
```
|
1468
|
-
or
|
1469
|
-
```
|
1470
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1471
|
-
```
|
1472
|
-
|
1473
|
-
You can also specify just the project or project branch (other values will be
|
1474
|
-
inferred from the current project or project branch):
|
1475
|
-
```
|
1476
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1477
|
-
```
|
1478
|
-
|
1479
|
-
Note that `branch` is typically one of:
|
1480
|
-
- `prod`
|
1481
|
-
- `user.bob`
|
1482
|
-
- `test.my_experiment`
|
1483
|
-
- `prod.staging`
|
1571
|
+
Specifies the PyPI packages for all steps of the flow.
|
1484
1572
|
|
1573
|
+
Use `@pypi_base` to set common packages required by all
|
1574
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1485
1575
|
Parameters
|
1486
1576
|
----------
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1577
|
+
packages : Dict[str, str], default: {}
|
1578
|
+
Packages to use for this flow. The key is the name of the package
|
1579
|
+
and the value is the version to use.
|
1580
|
+
python : str, optional, default: None
|
1581
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1582
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1583
|
+
"""
|
1584
|
+
...
|
1585
|
+
|
1586
|
+
@typing.overload
|
1587
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1588
|
+
"""
|
1589
|
+
Specifies the times when the flow should be run when running on a
|
1590
|
+
production scheduler.
|
1494
1591
|
|
1592
|
+
Parameters
|
1593
|
+
----------
|
1594
|
+
hourly : bool, default False
|
1595
|
+
Run the workflow hourly.
|
1596
|
+
daily : bool, default True
|
1597
|
+
Run the workflow daily.
|
1598
|
+
weekly : bool, default False
|
1599
|
+
Run the workflow weekly.
|
1600
|
+
cron : str, optional, default None
|
1601
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1602
|
+
specified by this expression.
|
1603
|
+
timezone : str, optional, default None
|
1604
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1605
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1495
1606
|
"""
|
1496
1607
|
...
|
1497
1608
|
|
1498
|
-
|
1609
|
+
@typing.overload
|
1610
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1611
|
+
...
|
1612
|
+
|
1613
|
+
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):
|
1499
1614
|
"""
|
1500
|
-
|
1501
|
-
|
1615
|
+
Specifies the times when the flow should be run when running on a
|
1616
|
+
production scheduler.
|
1502
1617
|
|
1503
1618
|
Parameters
|
1504
1619
|
----------
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1518
|
-
name : str
|
1519
|
-
Name of the sensor on Airflow
|
1520
|
-
description : str
|
1521
|
-
Description of sensor in the Airflow UI
|
1522
|
-
external_dag_id : str
|
1523
|
-
The dag_id that contains the task you want to wait for.
|
1524
|
-
external_task_ids : List[str]
|
1525
|
-
The list of task_ids that you want to wait for.
|
1526
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1527
|
-
allowed_states : List[str]
|
1528
|
-
Iterable of allowed states, (Default: ['success'])
|
1529
|
-
failed_states : List[str]
|
1530
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1531
|
-
execution_delta : datetime.timedelta
|
1532
|
-
time difference with the previous execution to look at,
|
1533
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1534
|
-
check_existence: bool
|
1535
|
-
Set to True to check if the external task exists or check if
|
1536
|
-
the DAG to wait for exists. (Default: True)
|
1620
|
+
hourly : bool, default False
|
1621
|
+
Run the workflow hourly.
|
1622
|
+
daily : bool, default True
|
1623
|
+
Run the workflow daily.
|
1624
|
+
weekly : bool, default False
|
1625
|
+
Run the workflow weekly.
|
1626
|
+
cron : str, optional, default None
|
1627
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1628
|
+
specified by this expression.
|
1629
|
+
timezone : str, optional, default None
|
1630
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1631
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1537
1632
|
"""
|
1538
1633
|
...
|
1539
1634
|
|
@@ -1579,101 +1674,6 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1579
1674
|
"""
|
1580
1675
|
...
|
1581
1676
|
|
1582
|
-
@typing.overload
|
1583
|
-
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]]:
|
1584
|
-
"""
|
1585
|
-
Specifies the event(s) that this flow depends on.
|
1586
|
-
|
1587
|
-
```
|
1588
|
-
@trigger(event='foo')
|
1589
|
-
```
|
1590
|
-
or
|
1591
|
-
```
|
1592
|
-
@trigger(events=['foo', 'bar'])
|
1593
|
-
```
|
1594
|
-
|
1595
|
-
Additionally, you can specify the parameter mappings
|
1596
|
-
to map event payload to Metaflow parameters for the flow.
|
1597
|
-
```
|
1598
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1599
|
-
```
|
1600
|
-
or
|
1601
|
-
```
|
1602
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1603
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1604
|
-
```
|
1605
|
-
|
1606
|
-
'parameters' can also be a list of strings and tuples like so:
|
1607
|
-
```
|
1608
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1609
|
-
```
|
1610
|
-
This is equivalent to:
|
1611
|
-
```
|
1612
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1613
|
-
```
|
1614
|
-
|
1615
|
-
Parameters
|
1616
|
-
----------
|
1617
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1618
|
-
Event dependency for this flow.
|
1619
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1620
|
-
Events dependency for this flow.
|
1621
|
-
options : Dict[str, Any], default {}
|
1622
|
-
Backend-specific configuration for tuning eventing behavior.
|
1623
|
-
|
1624
|
-
|
1625
|
-
"""
|
1626
|
-
...
|
1627
|
-
|
1628
|
-
@typing.overload
|
1629
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1630
|
-
...
|
1631
|
-
|
1632
|
-
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] = {}):
|
1633
|
-
"""
|
1634
|
-
Specifies the event(s) that this flow depends on.
|
1635
|
-
|
1636
|
-
```
|
1637
|
-
@trigger(event='foo')
|
1638
|
-
```
|
1639
|
-
or
|
1640
|
-
```
|
1641
|
-
@trigger(events=['foo', 'bar'])
|
1642
|
-
```
|
1643
|
-
|
1644
|
-
Additionally, you can specify the parameter mappings
|
1645
|
-
to map event payload to Metaflow parameters for the flow.
|
1646
|
-
```
|
1647
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1648
|
-
```
|
1649
|
-
or
|
1650
|
-
```
|
1651
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1652
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1653
|
-
```
|
1654
|
-
|
1655
|
-
'parameters' can also be a list of strings and tuples like so:
|
1656
|
-
```
|
1657
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1658
|
-
```
|
1659
|
-
This is equivalent to:
|
1660
|
-
```
|
1661
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1662
|
-
```
|
1663
|
-
|
1664
|
-
Parameters
|
1665
|
-
----------
|
1666
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1667
|
-
Event dependency for this flow.
|
1668
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1669
|
-
Events dependency for this flow.
|
1670
|
-
options : Dict[str, Any], default {}
|
1671
|
-
Backend-specific configuration for tuning eventing behavior.
|
1672
|
-
|
1673
|
-
|
1674
|
-
"""
|
1675
|
-
...
|
1676
|
-
|
1677
1677
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1678
1678
|
"""
|
1679
1679
|
Switch namespace to the one provided.
|