ob-metaflow 2.12.26.1__py2.py3-none-any.whl → 2.12.30.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ob-metaflow might be problematic. Click here for more details.
- metaflow/__init__.py +2 -3
- metaflow/cli.py +31 -4
- metaflow/client/core.py +78 -40
- metaflow/clone_util.py +1 -1
- metaflow/cmd/develop/stub_generator.py +623 -233
- metaflow/datastore/task_datastore.py +1 -1
- metaflow/extension_support/plugins.py +1 -0
- metaflow/flowspec.py +2 -2
- metaflow/includefile.py +8 -14
- metaflow/{metadata → metadata_provider}/metadata.py +6 -0
- metaflow/metaflow_config.py +4 -7
- metaflow/metaflow_current.py +1 -1
- metaflow/parameters.py +3 -0
- metaflow/plugins/__init__.py +12 -8
- metaflow/plugins/airflow/airflow_cli.py +5 -0
- metaflow/plugins/airflow/airflow_decorator.py +1 -1
- metaflow/plugins/argo/argo_workflows_cli.py +3 -3
- metaflow/plugins/argo/argo_workflows_decorator.py +1 -1
- metaflow/plugins/argo/argo_workflows_deployer.py +77 -363
- metaflow/plugins/argo/argo_workflows_deployer_objects.py +381 -0
- metaflow/plugins/aws/batch/batch_cli.py +1 -1
- metaflow/plugins/aws/batch/batch_decorator.py +2 -2
- metaflow/plugins/aws/step_functions/step_functions_cli.py +9 -2
- metaflow/plugins/aws/step_functions/step_functions_decorator.py +1 -1
- metaflow/plugins/aws/step_functions/step_functions_deployer.py +65 -224
- metaflow/plugins/aws/step_functions/step_functions_deployer_objects.py +236 -0
- metaflow/plugins/azure/includefile_support.py +2 -0
- metaflow/plugins/cards/card_cli.py +3 -2
- metaflow/plugins/cards/card_modules/components.py +9 -9
- metaflow/plugins/cards/card_server.py +39 -14
- metaflow/plugins/datatools/local.py +2 -0
- metaflow/plugins/datatools/s3/s3.py +2 -0
- metaflow/plugins/env_escape/__init__.py +3 -3
- metaflow/plugins/gcp/includefile_support.py +3 -0
- metaflow/plugins/kubernetes/kubernetes_cli.py +1 -1
- metaflow/plugins/kubernetes/kubernetes_decorator.py +5 -4
- metaflow/plugins/kubernetes/kubernetes_jobsets.py +1 -4
- metaflow/plugins/{metadata → metadata_providers}/local.py +2 -2
- metaflow/plugins/{metadata → metadata_providers}/service.py +2 -2
- metaflow/plugins/parallel_decorator.py +1 -1
- metaflow/plugins/pypi/conda_decorator.py +1 -1
- metaflow/plugins/resources_decorator.py +2 -2
- metaflow/plugins/tag_cli.py +1 -4
- metaflow/plugins/test_unbounded_foreach_decorator.py +1 -1
- metaflow/runner/click_api.py +4 -0
- metaflow/runner/deployer.py +134 -303
- metaflow/runner/deployer_impl.py +167 -0
- metaflow/runner/metaflow_runner.py +14 -12
- metaflow/runner/nbdeploy.py +12 -13
- metaflow/runner/nbrun.py +3 -3
- metaflow/runner/utils.py +55 -8
- metaflow/runtime.py +1 -1
- metaflow/system/system_logger.py +1 -19
- metaflow/system/system_monitor.py +0 -24
- metaflow/task.py +32 -26
- metaflow/version.py +1 -1
- {ob_metaflow-2.12.26.1.dist-info → ob_metaflow-2.12.30.1.dist-info}/METADATA +2 -2
- {ob_metaflow-2.12.26.1.dist-info → ob_metaflow-2.12.30.1.dist-info}/RECORD +66 -63
- {ob_metaflow-2.12.26.1.dist-info → ob_metaflow-2.12.30.1.dist-info}/WHEEL +1 -1
- /metaflow/{metadata → metadata_provider}/__init__.py +0 -0
- /metaflow/{metadata → metadata_provider}/heartbeat.py +0 -0
- /metaflow/{metadata → metadata_provider}/util.py +0 -0
- /metaflow/plugins/{metadata → metadata_providers}/__init__.py +0 -0
- {ob_metaflow-2.12.26.1.dist-info → ob_metaflow-2.12.30.1.dist-info}/LICENSE +0 -0
- {ob_metaflow-2.12.26.1.dist-info → ob_metaflow-2.12.30.1.dist-info}/entry_points.txt +0 -0
- {ob_metaflow-2.12.26.1.dist-info → ob_metaflow-2.12.30.1.dist-info}/top_level.txt +0 -0
metaflow/__init__.py
CHANGED
|
@@ -101,9 +101,7 @@ from .metaflow_current import current
|
|
|
101
101
|
# Flow spec
|
|
102
102
|
from .flowspec import FlowSpec
|
|
103
103
|
|
|
104
|
-
from .parameters import Parameter, JSONTypeClass
|
|
105
|
-
|
|
106
|
-
JSONType = JSONTypeClass()
|
|
104
|
+
from .parameters import Parameter, JSONTypeClass, JSONType
|
|
107
105
|
|
|
108
106
|
# data layer
|
|
109
107
|
# For historical reasons, we make metaflow.plugins.datatools accessible as
|
|
@@ -149,6 +147,7 @@ if sys.version_info >= (3, 7):
|
|
|
149
147
|
from .runner.metaflow_runner import Runner
|
|
150
148
|
from .runner.nbrun import NBRunner
|
|
151
149
|
from .runner.deployer import Deployer
|
|
150
|
+
from .runner.deployer import DeployedFlow
|
|
152
151
|
from .runner.nbdeploy import NBDeployer
|
|
153
152
|
|
|
154
153
|
__ext_tl_modules__ = []
|
metaflow/cli.py
CHANGED
|
@@ -701,12 +701,12 @@ def resume(
|
|
|
701
701
|
runtime.persist_constants()
|
|
702
702
|
|
|
703
703
|
if runner_attribute_file:
|
|
704
|
-
with open(runner_attribute_file, "w") as f:
|
|
704
|
+
with open(runner_attribute_file, "w", encoding="utf-8") as f:
|
|
705
705
|
json.dump(
|
|
706
706
|
{
|
|
707
707
|
"run_id": runtime.run_id,
|
|
708
708
|
"flow_name": obj.flow.name,
|
|
709
|
-
"metadata":
|
|
709
|
+
"metadata": obj.metadata.metadata_str(),
|
|
710
710
|
},
|
|
711
711
|
f,
|
|
712
712
|
)
|
|
@@ -716,6 +716,20 @@ def resume(
|
|
|
716
716
|
if runtime.should_skip_clone_only_execution():
|
|
717
717
|
return
|
|
718
718
|
|
|
719
|
+
current._update_env(
|
|
720
|
+
{
|
|
721
|
+
"run_id": runtime.run_id,
|
|
722
|
+
}
|
|
723
|
+
)
|
|
724
|
+
_system_logger.log_event(
|
|
725
|
+
level="info",
|
|
726
|
+
module="metaflow.resume",
|
|
727
|
+
name="start",
|
|
728
|
+
payload={
|
|
729
|
+
"msg": "Resuming run",
|
|
730
|
+
},
|
|
731
|
+
)
|
|
732
|
+
|
|
719
733
|
with runtime.run_heartbeat():
|
|
720
734
|
if clone_only:
|
|
721
735
|
runtime.clone_original_run()
|
|
@@ -775,16 +789,29 @@ def run(
|
|
|
775
789
|
write_file(run_id_file, runtime.run_id)
|
|
776
790
|
|
|
777
791
|
obj.flow._set_constants(obj.graph, kwargs)
|
|
792
|
+
current._update_env(
|
|
793
|
+
{
|
|
794
|
+
"run_id": runtime.run_id,
|
|
795
|
+
}
|
|
796
|
+
)
|
|
797
|
+
_system_logger.log_event(
|
|
798
|
+
level="info",
|
|
799
|
+
module="metaflow.run",
|
|
800
|
+
name="start",
|
|
801
|
+
payload={
|
|
802
|
+
"msg": "Starting run",
|
|
803
|
+
},
|
|
804
|
+
)
|
|
778
805
|
runtime.print_workflow_info()
|
|
779
806
|
runtime.persist_constants()
|
|
780
807
|
|
|
781
808
|
if runner_attribute_file:
|
|
782
|
-
with open(runner_attribute_file, "w") as f:
|
|
809
|
+
with open(runner_attribute_file, "w", encoding="utf-8") as f:
|
|
783
810
|
json.dump(
|
|
784
811
|
{
|
|
785
812
|
"run_id": runtime.run_id,
|
|
786
813
|
"flow_name": obj.flow.name,
|
|
787
|
-
"metadata":
|
|
814
|
+
"metadata": obj.metadata.metadata_str(),
|
|
788
815
|
},
|
|
789
816
|
f,
|
|
790
817
|
)
|
metaflow/client/core.py
CHANGED
|
@@ -16,6 +16,7 @@ from typing import (
|
|
|
16
16
|
List,
|
|
17
17
|
NamedTuple,
|
|
18
18
|
Optional,
|
|
19
|
+
TYPE_CHECKING,
|
|
19
20
|
Tuple,
|
|
20
21
|
)
|
|
21
22
|
|
|
@@ -37,6 +38,9 @@ from metaflow.util import cached_property, is_stringish, resolve_identity, to_un
|
|
|
37
38
|
from ..info_file import INFO_FILE
|
|
38
39
|
from .filecache import FileCache
|
|
39
40
|
|
|
41
|
+
if TYPE_CHECKING:
|
|
42
|
+
from metaflow.metadata_provider import MetadataProvider
|
|
43
|
+
|
|
40
44
|
try:
|
|
41
45
|
# python2
|
|
42
46
|
import cPickle as pickle
|
|
@@ -82,28 +86,16 @@ def metadata(ms: str) -> str:
|
|
|
82
86
|
get_metadata()).
|
|
83
87
|
"""
|
|
84
88
|
global current_metadata
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
else:
|
|
96
|
-
metadata_type = "local"
|
|
97
|
-
res = [m for m in METADATA_PROVIDERS if m.TYPE == metadata_type]
|
|
98
|
-
if not res:
|
|
99
|
-
print(
|
|
100
|
-
"Cannot find a '%s' metadata provider -- "
|
|
101
|
-
"try specifying one explicitly using <type>@<info>",
|
|
102
|
-
metadata_type,
|
|
103
|
-
)
|
|
104
|
-
return get_metadata()
|
|
105
|
-
current_metadata = res[0]
|
|
106
|
-
current_metadata.INFO = ms
|
|
89
|
+
provider, info = _metadata(ms)
|
|
90
|
+
if provider is None:
|
|
91
|
+
print(
|
|
92
|
+
"Cannot find a metadata provider -- "
|
|
93
|
+
"try specifying one explicitly using <type>@<info>",
|
|
94
|
+
)
|
|
95
|
+
return get_metadata()
|
|
96
|
+
current_metadata = provider
|
|
97
|
+
if info:
|
|
98
|
+
current_metadata.INFO = info
|
|
107
99
|
return get_metadata()
|
|
108
100
|
|
|
109
101
|
|
|
@@ -127,7 +119,7 @@ def get_metadata() -> str:
|
|
|
127
119
|
"""
|
|
128
120
|
if current_metadata is False:
|
|
129
121
|
default_metadata()
|
|
130
|
-
return
|
|
122
|
+
return current_metadata.metadata_str()
|
|
131
123
|
|
|
132
124
|
|
|
133
125
|
def default_metadata() -> str:
|
|
@@ -151,7 +143,7 @@ def default_metadata() -> str:
|
|
|
151
143
|
if default:
|
|
152
144
|
current_metadata = default[0]
|
|
153
145
|
else:
|
|
154
|
-
from metaflow.plugins.
|
|
146
|
+
from metaflow.plugins.metadata_providers import LocalMetadataProvider
|
|
155
147
|
|
|
156
148
|
current_metadata = LocalMetadataProvider
|
|
157
149
|
return get_metadata()
|
|
@@ -268,9 +260,16 @@ class MetaflowObject(object):
|
|
|
268
260
|
_object: Optional["MetaflowObject"] = None,
|
|
269
261
|
_parent: Optional["MetaflowObject"] = None,
|
|
270
262
|
_namespace_check: bool = True,
|
|
263
|
+
_metaflow: Optional["Metaflow"] = None,
|
|
271
264
|
_current_namespace: Optional[str] = None,
|
|
265
|
+
_current_metadata: Optional[str] = None,
|
|
272
266
|
):
|
|
273
|
-
|
|
267
|
+
# the default namespace is activated lazily at the first
|
|
268
|
+
# get_namespace(). The other option of activating
|
|
269
|
+
# the namespace at the import time is problematic, since there
|
|
270
|
+
# may be other modules that alter environment variables etc.
|
|
271
|
+
# which may affect the namespace setting.
|
|
272
|
+
self._metaflow = Metaflow(_current_metadata) or _metaflow
|
|
274
273
|
self._parent = _parent
|
|
275
274
|
self._path_components = None
|
|
276
275
|
self._attempt = attempt
|
|
@@ -390,6 +389,7 @@ class MetaflowObject(object):
|
|
|
390
389
|
attempt=self._attempt,
|
|
391
390
|
_object=obj,
|
|
392
391
|
_parent=self,
|
|
392
|
+
_metaflow=self._metaflow,
|
|
393
393
|
_namespace_check=self._namespace_check,
|
|
394
394
|
_current_namespace=(
|
|
395
395
|
self._current_namespace if self._namespace_check else None
|
|
@@ -505,6 +505,7 @@ class MetaflowObject(object):
|
|
|
505
505
|
attempt=self._attempt,
|
|
506
506
|
_object=obj,
|
|
507
507
|
_parent=self,
|
|
508
|
+
_metaflow=self._metaflow,
|
|
508
509
|
_namespace_check=self._namespace_check,
|
|
509
510
|
_current_namespace=(
|
|
510
511
|
self._current_namespace if self._namespace_check else None
|
|
@@ -552,7 +553,25 @@ class MetaflowObject(object):
|
|
|
552
553
|
_current_namespace=ns,
|
|
553
554
|
)
|
|
554
555
|
|
|
555
|
-
|
|
556
|
+
def _unpickle_21227(self, data):
|
|
557
|
+
if len(data) != 5:
|
|
558
|
+
raise MetaflowInternalError(
|
|
559
|
+
"Unexpected size of array: {}".format(len(data))
|
|
560
|
+
)
|
|
561
|
+
pathspec, attempt, md, ns, namespace_check = data
|
|
562
|
+
self.__init__(
|
|
563
|
+
pathspec=pathspec,
|
|
564
|
+
attempt=attempt,
|
|
565
|
+
_namespace_check=namespace_check,
|
|
566
|
+
_current_metadata=md,
|
|
567
|
+
_current_namespace=ns,
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
_UNPICKLE_FUNC = {
|
|
571
|
+
"2.8.4": _unpickle_284,
|
|
572
|
+
"2.12.4": _unpickle_2124,
|
|
573
|
+
"2.12.27": _unpickle_21227,
|
|
574
|
+
}
|
|
556
575
|
|
|
557
576
|
def __setstate__(self, state):
|
|
558
577
|
"""
|
|
@@ -595,10 +614,11 @@ class MetaflowObject(object):
|
|
|
595
614
|
# checking for the namespace even after unpickling since we will know which
|
|
596
615
|
# namespace to check.
|
|
597
616
|
return {
|
|
598
|
-
"version": "2.12.
|
|
617
|
+
"version": "2.12.27",
|
|
599
618
|
"data": [
|
|
600
619
|
self.pathspec,
|
|
601
620
|
self._attempt,
|
|
621
|
+
self._metaflow.metadata.metadata_str(),
|
|
602
622
|
self._current_namespace,
|
|
603
623
|
self._namespace_check,
|
|
604
624
|
],
|
|
@@ -2288,17 +2308,16 @@ class Metaflow(object):
|
|
|
2288
2308
|
if it has at least one run in the namespace.
|
|
2289
2309
|
"""
|
|
2290
2310
|
|
|
2291
|
-
def __init__(self):
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
self.metadata = current_metadata
|
|
2311
|
+
def __init__(self, _current_metadata: Optional[str] = None):
|
|
2312
|
+
if _current_metadata:
|
|
2313
|
+
provider, info = _metadata(_current_metadata)
|
|
2314
|
+
self.metadata = provider
|
|
2315
|
+
if info:
|
|
2316
|
+
self.metadata.INFO = info
|
|
2317
|
+
else:
|
|
2318
|
+
if current_metadata is False:
|
|
2319
|
+
default_metadata()
|
|
2320
|
+
self.metadata = current_metadata
|
|
2302
2321
|
|
|
2303
2322
|
@property
|
|
2304
2323
|
def flows(self) -> List[Flow]:
|
|
@@ -2335,7 +2354,7 @@ class Metaflow(object):
|
|
|
2335
2354
|
all_flows = all_flows if all_flows else []
|
|
2336
2355
|
for flow in all_flows:
|
|
2337
2356
|
try:
|
|
2338
|
-
v = Flow(_object=flow)
|
|
2357
|
+
v = Flow(_object=flow, _metaflow=self)
|
|
2339
2358
|
yield v
|
|
2340
2359
|
except MetaflowNamespaceMismatch:
|
|
2341
2360
|
continue
|
|
@@ -2359,7 +2378,26 @@ class Metaflow(object):
|
|
|
2359
2378
|
Flow
|
|
2360
2379
|
Flow with the given name.
|
|
2361
2380
|
"""
|
|
2362
|
-
return Flow(name)
|
|
2381
|
+
return Flow(name, _metaflow=self)
|
|
2382
|
+
|
|
2383
|
+
|
|
2384
|
+
def _metadata(ms: str) -> Tuple[Optional["MetadataProvider"], Optional[str]]:
|
|
2385
|
+
infos = ms.split("@", 1)
|
|
2386
|
+
types = [m.TYPE for m in METADATA_PROVIDERS]
|
|
2387
|
+
if infos[0] in types:
|
|
2388
|
+
provider = [m for m in METADATA_PROVIDERS if m.TYPE == infos[0]][0]
|
|
2389
|
+
if len(infos) > 1:
|
|
2390
|
+
return provider, infos[1]
|
|
2391
|
+
return provider, None
|
|
2392
|
+
# Deduce from ms; if starts with http, use service or else use local
|
|
2393
|
+
if ms.startswith("http"):
|
|
2394
|
+
metadata_type = "service"
|
|
2395
|
+
else:
|
|
2396
|
+
metadata_type = "local"
|
|
2397
|
+
res = [m for m in METADATA_PROVIDERS if m.TYPE == metadata_type]
|
|
2398
|
+
if not res:
|
|
2399
|
+
return None, None
|
|
2400
|
+
return res[0], ms
|
|
2363
2401
|
|
|
2364
2402
|
|
|
2365
2403
|
_CLASSES["flow"] = Flow
|
metaflow/clone_util.py
CHANGED