ob-metaflow-stubs 6.0.3.105__py2.py3-none-any.whl → 6.0.3.106rc1__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 +455 -455
- metaflow-stubs/cards.pyi +3 -3
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/clone_util.pyi +1 -1
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +55 -55
- metaflow-stubs/mflog/mflog.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +1 -1
- 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 +3 -3
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
- 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 +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
- 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 +4 -4
- metaflow-stubs/plugins/cards/card_client.pyi +1 -1
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- 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 +1 -1
- 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 +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
- 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 +1 -1
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/tag_cli.pyi +3 -3
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
- 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 +2 -2
- 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 +3 -3
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- {ob_metaflow_stubs-6.0.3.105.dist-info → ob_metaflow_stubs-6.0.3.106rc1.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.106rc1.dist-info/RECORD +140 -0
- ob_metaflow_stubs-6.0.3.105.dist-info/RECORD +0 -140
- {ob_metaflow_stubs-6.0.3.105.dist-info → ob_metaflow_stubs-6.0.3.106rc1.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.105.dist-info → ob_metaflow_stubs-6.0.3.106rc1.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
-
# Generated on 2024-10-
|
4
|
+
# Generated on 2024-10-07T18:32:56.944750 #
|
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_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
13
|
+
import metaflow._vendor.click.types
|
11
14
|
import metaflow.metaflow_current
|
15
|
+
import metaflow.parameters
|
16
|
+
import metaflow.client.core
|
12
17
|
import typing
|
18
|
+
import metaflow.datastore.inputs
|
13
19
|
import metaflow.flowspec
|
14
|
-
import datetime
|
15
20
|
import metaflow.events
|
16
|
-
import
|
17
|
-
import metaflow.datastore.inputs
|
18
|
-
import metaflow.parameters
|
19
|
-
import metaflow.runner.metaflow_runner
|
20
|
-
import metaflow.client.core
|
21
|
-
import metaflow._vendor.click.types
|
21
|
+
import datetime
|
22
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
23
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
24
24
|
|
@@ -513,216 +513,82 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
513
513
|
...
|
514
514
|
|
515
515
|
@typing.overload
|
516
|
-
def
|
516
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
517
517
|
"""
|
518
|
-
|
519
|
-
|
520
|
-
Information in this decorator will augment any
|
521
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
522
|
-
you can use `@pypi_base` to set packages required by all
|
523
|
-
steps and use `@pypi` to specify step-specific overrides.
|
524
|
-
|
525
|
-
Parameters
|
526
|
-
----------
|
527
|
-
packages : Dict[str, str], default: {}
|
528
|
-
Packages to use for this step. The key is the name of the package
|
529
|
-
and the value is the version to use.
|
530
|
-
python : str, optional, default: None
|
531
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
532
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
518
|
+
Decorator prototype for all step decorators. This function gets specialized
|
519
|
+
and imported for all decorators types by _import_plugin_decorators().
|
533
520
|
"""
|
534
521
|
...
|
535
522
|
|
536
523
|
@typing.overload
|
537
|
-
def
|
538
|
-
...
|
539
|
-
|
540
|
-
@typing.overload
|
541
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
542
|
-
...
|
543
|
-
|
544
|
-
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):
|
545
|
-
"""
|
546
|
-
Specifies the PyPI packages for the step.
|
547
|
-
|
548
|
-
Information in this decorator will augment any
|
549
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
550
|
-
you can use `@pypi_base` to set packages required by all
|
551
|
-
steps and use `@pypi` to specify step-specific overrides.
|
552
|
-
|
553
|
-
Parameters
|
554
|
-
----------
|
555
|
-
packages : Dict[str, str], default: {}
|
556
|
-
Packages to use for this step. The key is the name of the package
|
557
|
-
and the value is the version to use.
|
558
|
-
python : str, optional, default: None
|
559
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
560
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
561
|
-
"""
|
524
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
562
525
|
...
|
563
526
|
|
564
|
-
|
565
|
-
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]]]:
|
527
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
566
528
|
"""
|
567
|
-
|
568
|
-
|
569
|
-
Information in this decorator will augment any
|
570
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
571
|
-
you can use `@conda_base` to set packages required by all
|
572
|
-
steps and use `@conda` to specify step-specific overrides.
|
573
|
-
|
574
|
-
Parameters
|
575
|
-
----------
|
576
|
-
packages : Dict[str, str], default {}
|
577
|
-
Packages to use for this step. The key is the name of the package
|
578
|
-
and the value is the version to use.
|
579
|
-
libraries : Dict[str, str], default {}
|
580
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
581
|
-
python : str, optional, default None
|
582
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
583
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
584
|
-
disabled : bool, default False
|
585
|
-
If set to True, disables @conda.
|
529
|
+
Decorator prototype for all step decorators. This function gets specialized
|
530
|
+
and imported for all decorators types by _import_plugin_decorators().
|
586
531
|
"""
|
587
532
|
...
|
588
533
|
|
589
534
|
@typing.overload
|
590
|
-
def
|
591
|
-
...
|
592
|
-
|
593
|
-
@typing.overload
|
594
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
595
|
-
...
|
596
|
-
|
597
|
-
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):
|
535
|
+
def checkpoint(*, load_policy: str = "fresh", temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
598
536
|
"""
|
599
|
-
|
537
|
+
Enables checkpointing for a step.
|
600
538
|
|
601
|
-
Information in this decorator will augment any
|
602
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
603
|
-
you can use `@conda_base` to set packages required by all
|
604
|
-
steps and use `@conda` to specify step-specific overrides.
|
605
539
|
|
606
540
|
Parameters
|
607
541
|
----------
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
"""
|
619
|
-
...
|
620
|
-
|
621
|
-
@typing.overload
|
622
|
-
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]]]:
|
623
|
-
"""
|
624
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
542
|
+
load_policy : str, default: "fresh"
|
543
|
+
The policy for loading the checkpoint. The following policies are supported:
|
544
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
545
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
546
|
+
will be loaded at the start of the task.
|
547
|
+
- "none": Do not load any checkpoint
|
548
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
549
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
550
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
551
|
+
created within the task will be loaded when the task is retries execution on failure.
|
625
552
|
|
626
|
-
|
553
|
+
temp_dir_root : str, default: None
|
554
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
627
555
|
|
628
|
-
Parameters
|
629
|
-
----------
|
630
|
-
type : str, default 'default'
|
631
|
-
Card type.
|
632
|
-
id : str, optional, default None
|
633
|
-
If multiple cards are present, use this id to identify this card.
|
634
|
-
options : Dict[str, Any], default {}
|
635
|
-
Options passed to the card. The contents depend on the card type.
|
636
|
-
timeout : int, default 45
|
637
|
-
Interrupt reporting if it takes more than this many seconds.
|
638
556
|
|
639
557
|
|
640
558
|
"""
|
641
559
|
...
|
642
560
|
|
643
561
|
@typing.overload
|
644
|
-
def
|
562
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
645
563
|
...
|
646
564
|
|
647
565
|
@typing.overload
|
648
|
-
def
|
649
|
-
...
|
650
|
-
|
651
|
-
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):
|
652
|
-
"""
|
653
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
654
|
-
|
655
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
656
|
-
|
657
|
-
Parameters
|
658
|
-
----------
|
659
|
-
type : str, default 'default'
|
660
|
-
Card type.
|
661
|
-
id : str, optional, default None
|
662
|
-
If multiple cards are present, use this id to identify this card.
|
663
|
-
options : Dict[str, Any], default {}
|
664
|
-
Options passed to the card. The contents depend on the card type.
|
665
|
-
timeout : int, default 45
|
666
|
-
Interrupt reporting if it takes more than this many seconds.
|
667
|
-
|
668
|
-
|
669
|
-
"""
|
566
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
670
567
|
...
|
671
568
|
|
672
|
-
|
673
|
-
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]]]:
|
569
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
|
674
570
|
"""
|
675
|
-
|
676
|
-
|
677
|
-
This decorator is useful if this step may hang indefinitely.
|
678
|
-
|
679
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
680
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
681
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
571
|
+
Enables checkpointing for a step.
|
682
572
|
|
683
|
-
Note that all the values specified in parameters are added together so if you specify
|
684
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
685
573
|
|
686
574
|
Parameters
|
687
575
|
----------
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
699
|
-
...
|
700
|
-
|
701
|
-
@typing.overload
|
702
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
703
|
-
...
|
704
|
-
|
705
|
-
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):
|
706
|
-
"""
|
707
|
-
Specifies a timeout for your step.
|
576
|
+
load_policy : str, default: "fresh"
|
577
|
+
The policy for loading the checkpoint. The following policies are supported:
|
578
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
579
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
580
|
+
will be loaded at the start of the task.
|
581
|
+
- "none": Do not load any checkpoint
|
582
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
583
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
584
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
585
|
+
created within the task will be loaded when the task is retries execution on failure.
|
708
586
|
|
709
|
-
|
587
|
+
temp_dir_root : str, default: None
|
588
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
710
589
|
|
711
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
712
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
713
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
714
590
|
|
715
|
-
Note that all the values specified in parameters are added together so if you specify
|
716
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
717
591
|
|
718
|
-
Parameters
|
719
|
-
----------
|
720
|
-
seconds : int, default 0
|
721
|
-
Number of seconds to wait prior to timing out.
|
722
|
-
minutes : int, default 0
|
723
|
-
Number of minutes to wait prior to timing out.
|
724
|
-
hours : int, default 0
|
725
|
-
Number of hours to wait prior to timing out.
|
726
592
|
"""
|
727
593
|
...
|
728
594
|
|
@@ -793,132 +659,123 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
793
659
|
...
|
794
660
|
|
795
661
|
@typing.overload
|
796
|
-
def
|
662
|
+
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]]]:
|
797
663
|
"""
|
798
|
-
Specifies
|
799
|
-
to a step needs to be retried.
|
664
|
+
Specifies a timeout for your step.
|
800
665
|
|
801
|
-
This decorator is useful
|
802
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
803
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
666
|
+
This decorator is useful if this step may hang indefinitely.
|
804
667
|
|
805
|
-
This can be used in conjunction with the `@
|
806
|
-
|
807
|
-
|
668
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
669
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
670
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
671
|
+
|
672
|
+
Note that all the values specified in parameters are added together so if you specify
|
673
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
808
674
|
|
809
675
|
Parameters
|
810
676
|
----------
|
811
|
-
|
812
|
-
Number of
|
813
|
-
|
814
|
-
Number of minutes
|
677
|
+
seconds : int, default 0
|
678
|
+
Number of seconds to wait prior to timing out.
|
679
|
+
minutes : int, default 0
|
680
|
+
Number of minutes to wait prior to timing out.
|
681
|
+
hours : int, default 0
|
682
|
+
Number of hours to wait prior to timing out.
|
815
683
|
"""
|
816
684
|
...
|
817
685
|
|
818
686
|
@typing.overload
|
819
|
-
def
|
687
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
820
688
|
...
|
821
689
|
|
822
690
|
@typing.overload
|
823
|
-
def
|
691
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
824
692
|
...
|
825
693
|
|
826
|
-
def
|
694
|
+
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):
|
827
695
|
"""
|
828
|
-
Specifies
|
829
|
-
to a step needs to be retried.
|
696
|
+
Specifies a timeout for your step.
|
830
697
|
|
831
|
-
This decorator is useful
|
832
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
833
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
698
|
+
This decorator is useful if this step may hang indefinitely.
|
834
699
|
|
835
|
-
This can be used in conjunction with the `@
|
836
|
-
|
837
|
-
|
700
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
701
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
702
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
703
|
+
|
704
|
+
Note that all the values specified in parameters are added together so if you specify
|
705
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
838
706
|
|
839
707
|
Parameters
|
840
708
|
----------
|
841
|
-
|
842
|
-
Number of
|
843
|
-
|
844
|
-
Number of minutes
|
709
|
+
seconds : int, default 0
|
710
|
+
Number of seconds to wait prior to timing out.
|
711
|
+
minutes : int, default 0
|
712
|
+
Number of minutes to wait prior to timing out.
|
713
|
+
hours : int, default 0
|
714
|
+
Number of hours to wait prior to timing out.
|
845
715
|
"""
|
846
716
|
...
|
847
717
|
|
848
718
|
@typing.overload
|
849
|
-
def
|
719
|
+
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]]]:
|
850
720
|
"""
|
851
|
-
Specifies
|
852
|
-
|
853
|
-
Use `@resources` to specify the resource requirements
|
854
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
855
|
-
|
856
|
-
You can choose the compute layer on the command line by executing e.g.
|
857
|
-
```
|
858
|
-
python myflow.py run --with batch
|
859
|
-
```
|
860
|
-
or
|
861
|
-
```
|
862
|
-
python myflow.py run --with kubernetes
|
863
|
-
```
|
864
|
-
which executes the flow on the desired system using the
|
865
|
-
requirements specified in `@resources`.
|
721
|
+
Specifies environment variables to be set prior to the execution of a step.
|
866
722
|
|
867
723
|
Parameters
|
868
724
|
----------
|
869
|
-
|
870
|
-
|
871
|
-
gpu : int, default 0
|
872
|
-
Number of GPUs required for this step.
|
873
|
-
disk : int, optional, default None
|
874
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
875
|
-
memory : int, default 4096
|
876
|
-
Memory size (in MB) required for this step.
|
877
|
-
shared_memory : int, optional, default None
|
878
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
879
|
-
This parameter maps to the `--shm-size` option in Docker.
|
725
|
+
vars : Dict[str, str], default {}
|
726
|
+
Dictionary of environment variables to set.
|
880
727
|
"""
|
881
728
|
...
|
882
729
|
|
883
730
|
@typing.overload
|
884
|
-
def
|
731
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
885
732
|
...
|
886
733
|
|
887
734
|
@typing.overload
|
888
|
-
def
|
735
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
889
736
|
...
|
890
737
|
|
891
|
-
def
|
738
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
892
739
|
"""
|
893
|
-
Specifies
|
740
|
+
Specifies environment variables to be set prior to the execution of a step.
|
894
741
|
|
895
|
-
|
896
|
-
|
742
|
+
Parameters
|
743
|
+
----------
|
744
|
+
vars : Dict[str, str], default {}
|
745
|
+
Dictionary of environment variables to set.
|
746
|
+
"""
|
747
|
+
...
|
748
|
+
|
749
|
+
@typing.overload
|
750
|
+
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]]]:
|
751
|
+
"""
|
752
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
753
|
+
the execution of a step.
|
897
754
|
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
755
|
+
Parameters
|
756
|
+
----------
|
757
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
758
|
+
List of secret specs, defining how the secrets are to be retrieved
|
759
|
+
"""
|
760
|
+
...
|
761
|
+
|
762
|
+
@typing.overload
|
763
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
764
|
+
...
|
765
|
+
|
766
|
+
@typing.overload
|
767
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
768
|
+
...
|
769
|
+
|
770
|
+
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]]] = []):
|
771
|
+
"""
|
772
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
773
|
+
the execution of a step.
|
908
774
|
|
909
775
|
Parameters
|
910
776
|
----------
|
911
|
-
|
912
|
-
|
913
|
-
gpu : int, default 0
|
914
|
-
Number of GPUs required for this step.
|
915
|
-
disk : int, optional, default None
|
916
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
917
|
-
memory : int, default 4096
|
918
|
-
Memory size (in MB) required for this step.
|
919
|
-
shared_memory : int, optional, default None
|
920
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
921
|
-
This parameter maps to the `--shm-size` option in Docker.
|
777
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
778
|
+
List of secret specs, defining how the secrets are to be retrieved
|
922
779
|
"""
|
923
780
|
...
|
924
781
|
|
@@ -972,111 +829,110 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
972
829
|
...
|
973
830
|
|
974
831
|
@typing.overload
|
975
|
-
def
|
832
|
+
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]]]:
|
976
833
|
"""
|
977
|
-
|
834
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
835
|
+
|
836
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
978
837
|
|
979
838
|
Parameters
|
980
839
|
----------
|
981
|
-
|
982
|
-
|
840
|
+
type : str, default 'default'
|
841
|
+
Card type.
|
842
|
+
id : str, optional, default None
|
843
|
+
If multiple cards are present, use this id to identify this card.
|
844
|
+
options : Dict[str, Any], default {}
|
845
|
+
Options passed to the card. The contents depend on the card type.
|
846
|
+
timeout : int, default 45
|
847
|
+
Interrupt reporting if it takes more than this many seconds.
|
848
|
+
|
849
|
+
|
983
850
|
"""
|
984
851
|
...
|
985
852
|
|
986
853
|
@typing.overload
|
987
|
-
def
|
854
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
988
855
|
...
|
989
856
|
|
990
857
|
@typing.overload
|
991
|
-
def
|
858
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
992
859
|
...
|
993
860
|
|
994
|
-
def
|
861
|
+
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):
|
995
862
|
"""
|
996
|
-
|
863
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
864
|
+
|
865
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
997
866
|
|
998
867
|
Parameters
|
999
868
|
----------
|
1000
|
-
|
1001
|
-
|
869
|
+
type : str, default 'default'
|
870
|
+
Card type.
|
871
|
+
id : str, optional, default None
|
872
|
+
If multiple cards are present, use this id to identify this card.
|
873
|
+
options : Dict[str, Any], default {}
|
874
|
+
Options passed to the card. The contents depend on the card type.
|
875
|
+
timeout : int, default 45
|
876
|
+
Interrupt reporting if it takes more than this many seconds.
|
877
|
+
|
878
|
+
|
1002
879
|
"""
|
1003
880
|
...
|
1004
881
|
|
1005
882
|
@typing.overload
|
1006
|
-
def
|
883
|
+
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]]]:
|
1007
884
|
"""
|
1008
|
-
|
885
|
+
Specifies the Conda environment for the step.
|
1009
886
|
|
887
|
+
Information in this decorator will augment any
|
888
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
889
|
+
you can use `@conda_base` to set packages required by all
|
890
|
+
steps and use `@conda` to specify step-specific overrides.
|
1010
891
|
|
1011
892
|
Parameters
|
1012
893
|
----------
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
temp_dir_root : str, default: None
|
1025
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
894
|
+
packages : Dict[str, str], default {}
|
895
|
+
Packages to use for this step. The key is the name of the package
|
896
|
+
and the value is the version to use.
|
897
|
+
libraries : Dict[str, str], default {}
|
898
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
899
|
+
python : str, optional, default None
|
900
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
901
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
902
|
+
disabled : bool, default False
|
903
|
+
If set to True, disables @conda.
|
1029
904
|
"""
|
1030
905
|
...
|
1031
906
|
|
1032
907
|
@typing.overload
|
1033
|
-
def
|
908
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1034
909
|
...
|
1035
910
|
|
1036
911
|
@typing.overload
|
1037
|
-
def
|
912
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1038
913
|
...
|
1039
914
|
|
1040
|
-
def
|
915
|
+
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):
|
1041
916
|
"""
|
1042
|
-
|
917
|
+
Specifies the Conda environment for the step.
|
1043
918
|
|
919
|
+
Information in this decorator will augment any
|
920
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
921
|
+
you can use `@conda_base` to set packages required by all
|
922
|
+
steps and use `@conda` to specify step-specific overrides.
|
1044
923
|
|
1045
924
|
Parameters
|
1046
925
|
----------
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
temp_dir_root : str, default: None
|
1059
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
"""
|
1064
|
-
...
|
1065
|
-
|
1066
|
-
@typing.overload
|
1067
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1068
|
-
"""
|
1069
|
-
Internal decorator to support Fast bakery
|
1070
|
-
"""
|
1071
|
-
...
|
1072
|
-
|
1073
|
-
@typing.overload
|
1074
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1075
|
-
...
|
1076
|
-
|
1077
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1078
|
-
"""
|
1079
|
-
Internal decorator to support Fast bakery
|
926
|
+
packages : Dict[str, str], default {}
|
927
|
+
Packages to use for this step. The key is the name of the package
|
928
|
+
and the value is the version to use.
|
929
|
+
libraries : Dict[str, str], default {}
|
930
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
931
|
+
python : str, optional, default None
|
932
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
933
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
934
|
+
disabled : bool, default False
|
935
|
+
If set to True, disables @conda.
|
1080
936
|
"""
|
1081
937
|
...
|
1082
938
|
|
@@ -1142,149 +998,198 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1142
998
|
...
|
1143
999
|
|
1144
1000
|
@typing.overload
|
1145
|
-
def
|
1001
|
+
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]]]:
|
1146
1002
|
"""
|
1147
|
-
|
1148
|
-
|
1003
|
+
Specifies the number of times the task corresponding
|
1004
|
+
to a step needs to be retried.
|
1005
|
+
|
1006
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1007
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1008
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1009
|
+
|
1010
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1011
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1012
|
+
ensuring that the flow execution can continue.
|
1013
|
+
|
1014
|
+
Parameters
|
1015
|
+
----------
|
1016
|
+
times : int, default 3
|
1017
|
+
Number of times to retry this task.
|
1018
|
+
minutes_between_retries : int, default 2
|
1019
|
+
Number of minutes between retries.
|
1149
1020
|
"""
|
1150
1021
|
...
|
1151
1022
|
|
1152
1023
|
@typing.overload
|
1153
|
-
def
|
1024
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1154
1025
|
...
|
1155
1026
|
|
1156
|
-
|
1027
|
+
@typing.overload
|
1028
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1029
|
+
...
|
1030
|
+
|
1031
|
+
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):
|
1157
1032
|
"""
|
1158
|
-
|
1159
|
-
|
1033
|
+
Specifies the number of times the task corresponding
|
1034
|
+
to a step needs to be retried.
|
1035
|
+
|
1036
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1037
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1038
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1039
|
+
|
1040
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1041
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1042
|
+
ensuring that the flow execution can continue.
|
1043
|
+
|
1044
|
+
Parameters
|
1045
|
+
----------
|
1046
|
+
times : int, default 3
|
1047
|
+
Number of times to retry this task.
|
1048
|
+
minutes_between_retries : int, default 2
|
1049
|
+
Number of minutes between retries.
|
1160
1050
|
"""
|
1161
1051
|
...
|
1162
1052
|
|
1163
1053
|
@typing.overload
|
1164
|
-
def
|
1054
|
+
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]]]:
|
1165
1055
|
"""
|
1166
|
-
Specifies
|
1167
|
-
|
1056
|
+
Specifies the PyPI packages for the step.
|
1057
|
+
|
1058
|
+
Information in this decorator will augment any
|
1059
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1060
|
+
you can use `@pypi_base` to set packages required by all
|
1061
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1168
1062
|
|
1169
1063
|
Parameters
|
1170
1064
|
----------
|
1171
|
-
|
1172
|
-
|
1065
|
+
packages : Dict[str, str], default: {}
|
1066
|
+
Packages to use for this step. The key is the name of the package
|
1067
|
+
and the value is the version to use.
|
1068
|
+
python : str, optional, default: None
|
1069
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1070
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1173
1071
|
"""
|
1174
1072
|
...
|
1175
1073
|
|
1176
1074
|
@typing.overload
|
1177
|
-
def
|
1075
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1178
1076
|
...
|
1179
1077
|
|
1180
1078
|
@typing.overload
|
1181
|
-
def
|
1079
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1182
1080
|
...
|
1183
1081
|
|
1184
|
-
def
|
1082
|
+
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):
|
1185
1083
|
"""
|
1186
|
-
Specifies
|
1187
|
-
|
1084
|
+
Specifies the PyPI packages for the step.
|
1085
|
+
|
1086
|
+
Information in this decorator will augment any
|
1087
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1088
|
+
you can use `@pypi_base` to set packages required by all
|
1089
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1188
1090
|
|
1189
1091
|
Parameters
|
1190
1092
|
----------
|
1191
|
-
|
1192
|
-
|
1093
|
+
packages : Dict[str, str], default: {}
|
1094
|
+
Packages to use for this step. The key is the name of the package
|
1095
|
+
and the value is the version to use.
|
1096
|
+
python : str, optional, default: None
|
1097
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1098
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1193
1099
|
"""
|
1194
1100
|
...
|
1195
1101
|
|
1196
1102
|
@typing.overload
|
1197
|
-
def
|
1103
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1198
1104
|
"""
|
1199
|
-
|
1105
|
+
Internal decorator to support Fast bakery
|
1106
|
+
"""
|
1107
|
+
...
|
1108
|
+
|
1109
|
+
@typing.overload
|
1110
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1111
|
+
...
|
1112
|
+
|
1113
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1114
|
+
"""
|
1115
|
+
Internal decorator to support Fast bakery
|
1116
|
+
"""
|
1117
|
+
...
|
1118
|
+
|
1119
|
+
@typing.overload
|
1120
|
+
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]]]:
|
1121
|
+
"""
|
1122
|
+
Specifies the resources needed when executing this step.
|
1200
1123
|
|
1201
|
-
|
1202
|
-
|
1203
|
-
```
|
1204
|
-
or
|
1205
|
-
```
|
1206
|
-
@trigger(events=['foo', 'bar'])
|
1207
|
-
```
|
1124
|
+
Use `@resources` to specify the resource requirements
|
1125
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1208
1126
|
|
1209
|
-
|
1210
|
-
to map event payload to Metaflow parameters for the flow.
|
1127
|
+
You can choose the compute layer on the command line by executing e.g.
|
1211
1128
|
```
|
1212
|
-
|
1129
|
+
python myflow.py run --with batch
|
1213
1130
|
```
|
1214
1131
|
or
|
1215
1132
|
```
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
'parameters' can also be a list of strings and tuples like so:
|
1221
|
-
```
|
1222
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1223
|
-
```
|
1224
|
-
This is equivalent to:
|
1225
|
-
```
|
1226
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1227
|
-
```
|
1228
|
-
|
1229
|
-
Parameters
|
1230
|
-
----------
|
1231
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1232
|
-
Event dependency for this flow.
|
1233
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1234
|
-
Events dependency for this flow.
|
1235
|
-
options : Dict[str, Any], default {}
|
1236
|
-
Backend-specific configuration for tuning eventing behavior.
|
1237
|
-
|
1133
|
+
python myflow.py run --with kubernetes
|
1134
|
+
```
|
1135
|
+
which executes the flow on the desired system using the
|
1136
|
+
requirements specified in `@resources`.
|
1238
1137
|
|
1138
|
+
Parameters
|
1139
|
+
----------
|
1140
|
+
cpu : int, default 1
|
1141
|
+
Number of CPUs required for this step.
|
1142
|
+
gpu : int, default 0
|
1143
|
+
Number of GPUs required for this step.
|
1144
|
+
disk : int, optional, default None
|
1145
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1146
|
+
memory : int, default 4096
|
1147
|
+
Memory size (in MB) required for this step.
|
1148
|
+
shared_memory : int, optional, default None
|
1149
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1150
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1239
1151
|
"""
|
1240
1152
|
...
|
1241
1153
|
|
1242
1154
|
@typing.overload
|
1243
|
-
def
|
1155
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1244
1156
|
...
|
1245
1157
|
|
1246
|
-
|
1158
|
+
@typing.overload
|
1159
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1160
|
+
...
|
1161
|
+
|
1162
|
+
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):
|
1247
1163
|
"""
|
1248
|
-
Specifies the
|
1164
|
+
Specifies the resources needed when executing this step.
|
1249
1165
|
|
1250
|
-
|
1251
|
-
|
1252
|
-
```
|
1253
|
-
or
|
1254
|
-
```
|
1255
|
-
@trigger(events=['foo', 'bar'])
|
1256
|
-
```
|
1166
|
+
Use `@resources` to specify the resource requirements
|
1167
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1257
1168
|
|
1258
|
-
|
1259
|
-
to map event payload to Metaflow parameters for the flow.
|
1169
|
+
You can choose the compute layer on the command line by executing e.g.
|
1260
1170
|
```
|
1261
|
-
|
1171
|
+
python myflow.py run --with batch
|
1262
1172
|
```
|
1263
1173
|
or
|
1264
1174
|
```
|
1265
|
-
|
1266
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1267
|
-
```
|
1268
|
-
|
1269
|
-
'parameters' can also be a list of strings and tuples like so:
|
1270
|
-
```
|
1271
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1272
|
-
```
|
1273
|
-
This is equivalent to:
|
1274
|
-
```
|
1275
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1175
|
+
python myflow.py run --with kubernetes
|
1276
1176
|
```
|
1177
|
+
which executes the flow on the desired system using the
|
1178
|
+
requirements specified in `@resources`.
|
1277
1179
|
|
1278
1180
|
Parameters
|
1279
1181
|
----------
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1182
|
+
cpu : int, default 1
|
1183
|
+
Number of CPUs required for this step.
|
1184
|
+
gpu : int, default 0
|
1185
|
+
Number of GPUs required for this step.
|
1186
|
+
disk : int, optional, default None
|
1187
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1188
|
+
memory : int, default 4096
|
1189
|
+
Memory size (in MB) required for this step.
|
1190
|
+
shared_memory : int, optional, default None
|
1191
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1192
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1288
1193
|
"""
|
1289
1194
|
...
|
1290
1195
|
|
@@ -1380,51 +1285,41 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
|
|
1380
1285
|
...
|
1381
1286
|
|
1382
1287
|
@typing.overload
|
1383
|
-
def
|
1288
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1384
1289
|
"""
|
1385
|
-
Specifies the
|
1386
|
-
|
1387
|
-
Use `@conda_base` to set common libraries required by all
|
1388
|
-
steps and use `@conda` to specify step-specific additions.
|
1290
|
+
Specifies the PyPI packages for all steps of the flow.
|
1389
1291
|
|
1292
|
+
Use `@pypi_base` to set common packages required by all
|
1293
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1390
1294
|
Parameters
|
1391
1295
|
----------
|
1392
|
-
packages : Dict[str, str], default {}
|
1296
|
+
packages : Dict[str, str], default: {}
|
1393
1297
|
Packages to use for this flow. The key is the name of the package
|
1394
1298
|
and the value is the version to use.
|
1395
|
-
|
1396
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1397
|
-
python : str, optional, default None
|
1299
|
+
python : str, optional, default: None
|
1398
1300
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1399
1301
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1400
|
-
disabled : bool, default False
|
1401
|
-
If set to True, disables Conda.
|
1402
1302
|
"""
|
1403
1303
|
...
|
1404
1304
|
|
1405
1305
|
@typing.overload
|
1406
|
-
def
|
1306
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1407
1307
|
...
|
1408
1308
|
|
1409
|
-
def
|
1309
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1410
1310
|
"""
|
1411
|
-
Specifies the
|
1412
|
-
|
1413
|
-
Use `@conda_base` to set common libraries required by all
|
1414
|
-
steps and use `@conda` to specify step-specific additions.
|
1311
|
+
Specifies the PyPI packages for all steps of the flow.
|
1415
1312
|
|
1313
|
+
Use `@pypi_base` to set common packages required by all
|
1314
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1416
1315
|
Parameters
|
1417
1316
|
----------
|
1418
|
-
packages : Dict[str, str], default {}
|
1317
|
+
packages : Dict[str, str], default: {}
|
1419
1318
|
Packages to use for this flow. The key is the name of the package
|
1420
1319
|
and the value is the version to use.
|
1421
|
-
|
1422
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1423
|
-
python : str, optional, default None
|
1320
|
+
python : str, optional, default: None
|
1424
1321
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1425
1322
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1426
|
-
disabled : bool, default False
|
1427
|
-
If set to True, disables Conda.
|
1428
1323
|
"""
|
1429
1324
|
...
|
1430
1325
|
|
@@ -1573,6 +1468,55 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1573
1468
|
"""
|
1574
1469
|
...
|
1575
1470
|
|
1471
|
+
@typing.overload
|
1472
|
+
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]]:
|
1473
|
+
"""
|
1474
|
+
Specifies the Conda environment for all steps of the flow.
|
1475
|
+
|
1476
|
+
Use `@conda_base` to set common libraries required by all
|
1477
|
+
steps and use `@conda` to specify step-specific additions.
|
1478
|
+
|
1479
|
+
Parameters
|
1480
|
+
----------
|
1481
|
+
packages : Dict[str, str], default {}
|
1482
|
+
Packages to use for this flow. The key is the name of the package
|
1483
|
+
and the value is the version to use.
|
1484
|
+
libraries : Dict[str, str], default {}
|
1485
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1486
|
+
python : str, optional, default None
|
1487
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1488
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1489
|
+
disabled : bool, default False
|
1490
|
+
If set to True, disables Conda.
|
1491
|
+
"""
|
1492
|
+
...
|
1493
|
+
|
1494
|
+
@typing.overload
|
1495
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1496
|
+
...
|
1497
|
+
|
1498
|
+
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):
|
1499
|
+
"""
|
1500
|
+
Specifies the Conda environment for all steps of the flow.
|
1501
|
+
|
1502
|
+
Use `@conda_base` to set common libraries required by all
|
1503
|
+
steps and use `@conda` to specify step-specific additions.
|
1504
|
+
|
1505
|
+
Parameters
|
1506
|
+
----------
|
1507
|
+
packages : Dict[str, str], default {}
|
1508
|
+
Packages to use for this flow. The key is the name of the package
|
1509
|
+
and the value is the version to use.
|
1510
|
+
libraries : Dict[str, str], default {}
|
1511
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1512
|
+
python : str, optional, default None
|
1513
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1514
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1515
|
+
disabled : bool, default False
|
1516
|
+
If set to True, disables Conda.
|
1517
|
+
"""
|
1518
|
+
...
|
1519
|
+
|
1576
1520
|
@typing.overload
|
1577
1521
|
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]]:
|
1578
1522
|
"""
|
@@ -1623,41 +1567,97 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1623
1567
|
...
|
1624
1568
|
|
1625
1569
|
@typing.overload
|
1626
|
-
def
|
1570
|
+
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]]:
|
1627
1571
|
"""
|
1628
|
-
Specifies the
|
1572
|
+
Specifies the event(s) that this flow depends on.
|
1573
|
+
|
1574
|
+
```
|
1575
|
+
@trigger(event='foo')
|
1576
|
+
```
|
1577
|
+
or
|
1578
|
+
```
|
1579
|
+
@trigger(events=['foo', 'bar'])
|
1580
|
+
```
|
1581
|
+
|
1582
|
+
Additionally, you can specify the parameter mappings
|
1583
|
+
to map event payload to Metaflow parameters for the flow.
|
1584
|
+
```
|
1585
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1586
|
+
```
|
1587
|
+
or
|
1588
|
+
```
|
1589
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1590
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1591
|
+
```
|
1592
|
+
|
1593
|
+
'parameters' can also be a list of strings and tuples like so:
|
1594
|
+
```
|
1595
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1596
|
+
```
|
1597
|
+
This is equivalent to:
|
1598
|
+
```
|
1599
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1600
|
+
```
|
1629
1601
|
|
1630
|
-
Use `@pypi_base` to set common packages required by all
|
1631
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1632
1602
|
Parameters
|
1633
1603
|
----------
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1604
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1605
|
+
Event dependency for this flow.
|
1606
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1607
|
+
Events dependency for this flow.
|
1608
|
+
options : Dict[str, Any], default {}
|
1609
|
+
Backend-specific configuration for tuning eventing behavior.
|
1610
|
+
|
1611
|
+
|
1640
1612
|
"""
|
1641
1613
|
...
|
1642
1614
|
|
1643
1615
|
@typing.overload
|
1644
|
-
def
|
1616
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1645
1617
|
...
|
1646
1618
|
|
1647
|
-
def
|
1619
|
+
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] = {}):
|
1648
1620
|
"""
|
1649
|
-
Specifies the
|
1621
|
+
Specifies the event(s) that this flow depends on.
|
1622
|
+
|
1623
|
+
```
|
1624
|
+
@trigger(event='foo')
|
1625
|
+
```
|
1626
|
+
or
|
1627
|
+
```
|
1628
|
+
@trigger(events=['foo', 'bar'])
|
1629
|
+
```
|
1630
|
+
|
1631
|
+
Additionally, you can specify the parameter mappings
|
1632
|
+
to map event payload to Metaflow parameters for the flow.
|
1633
|
+
```
|
1634
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1635
|
+
```
|
1636
|
+
or
|
1637
|
+
```
|
1638
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1639
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1640
|
+
```
|
1641
|
+
|
1642
|
+
'parameters' can also be a list of strings and tuples like so:
|
1643
|
+
```
|
1644
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1645
|
+
```
|
1646
|
+
This is equivalent to:
|
1647
|
+
```
|
1648
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1649
|
+
```
|
1650
1650
|
|
1651
|
-
Use `@pypi_base` to set common packages required by all
|
1652
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1653
1651
|
Parameters
|
1654
1652
|
----------
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1653
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1654
|
+
Event dependency for this flow.
|
1655
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1656
|
+
Events dependency for this flow.
|
1657
|
+
options : Dict[str, Any], default {}
|
1658
|
+
Backend-specific configuration for tuning eventing behavior.
|
1659
|
+
|
1660
|
+
|
1661
1661
|
"""
|
1662
1662
|
...
|
1663
1663
|
|