ob-metaflow 2.12.27.1__py2.py3-none-any.whl → 2.12.30.2__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.

Files changed (63) hide show
  1. metaflow/__init__.py +2 -3
  2. metaflow/cli.py +27 -0
  3. metaflow/client/core.py +2 -2
  4. metaflow/clone_util.py +1 -1
  5. metaflow/cmd/develop/stub_generator.py +623 -233
  6. metaflow/datastore/task_datastore.py +1 -1
  7. metaflow/extension_support/plugins.py +1 -0
  8. metaflow/flowspec.py +2 -2
  9. metaflow/includefile.py +8 -14
  10. metaflow/metaflow_config.py +4 -7
  11. metaflow/metaflow_current.py +1 -1
  12. metaflow/parameters.py +3 -0
  13. metaflow/plugins/__init__.py +12 -8
  14. metaflow/plugins/airflow/airflow_cli.py +5 -0
  15. metaflow/plugins/airflow/airflow_decorator.py +1 -1
  16. metaflow/plugins/argo/argo_workflows_decorator.py +1 -1
  17. metaflow/plugins/argo/argo_workflows_deployer.py +77 -363
  18. metaflow/plugins/argo/argo_workflows_deployer_objects.py +381 -0
  19. metaflow/plugins/aws/batch/batch_cli.py +1 -1
  20. metaflow/plugins/aws/batch/batch_decorator.py +2 -2
  21. metaflow/plugins/aws/step_functions/step_functions_cli.py +7 -0
  22. metaflow/plugins/aws/step_functions/step_functions_decorator.py +1 -1
  23. metaflow/plugins/aws/step_functions/step_functions_deployer.py +65 -224
  24. metaflow/plugins/aws/step_functions/step_functions_deployer_objects.py +236 -0
  25. metaflow/plugins/azure/includefile_support.py +2 -0
  26. metaflow/plugins/cards/card_cli.py +3 -2
  27. metaflow/plugins/cards/card_modules/components.py +9 -9
  28. metaflow/plugins/cards/card_server.py +39 -14
  29. metaflow/plugins/datatools/local.py +2 -0
  30. metaflow/plugins/datatools/s3/s3.py +2 -0
  31. metaflow/plugins/env_escape/__init__.py +3 -3
  32. metaflow/plugins/gcp/includefile_support.py +3 -0
  33. metaflow/plugins/kubernetes/kubernetes_cli.py +1 -1
  34. metaflow/plugins/kubernetes/kubernetes_decorator.py +5 -4
  35. metaflow/plugins/kubernetes/kubernetes_jobsets.py +43 -28
  36. metaflow/plugins/{metadata → metadata_providers}/local.py +2 -2
  37. metaflow/plugins/{metadata → metadata_providers}/service.py +2 -2
  38. metaflow/plugins/parallel_decorator.py +1 -1
  39. metaflow/plugins/pypi/conda_decorator.py +1 -1
  40. metaflow/plugins/test_unbounded_foreach_decorator.py +1 -1
  41. metaflow/runner/click_api.py +4 -0
  42. metaflow/runner/deployer.py +134 -303
  43. metaflow/runner/deployer_impl.py +167 -0
  44. metaflow/runner/metaflow_runner.py +10 -9
  45. metaflow/runner/nbdeploy.py +12 -13
  46. metaflow/runner/nbrun.py +3 -3
  47. metaflow/runner/utils.py +55 -8
  48. metaflow/runtime.py +1 -1
  49. metaflow/system/system_logger.py +1 -19
  50. metaflow/system/system_monitor.py +0 -24
  51. metaflow/task.py +5 -8
  52. metaflow/version.py +1 -1
  53. {ob_metaflow-2.12.27.1.dist-info → ob_metaflow-2.12.30.2.dist-info}/METADATA +2 -2
  54. {ob_metaflow-2.12.27.1.dist-info → ob_metaflow-2.12.30.2.dist-info}/RECORD +63 -60
  55. {ob_metaflow-2.12.27.1.dist-info → ob_metaflow-2.12.30.2.dist-info}/WHEEL +1 -1
  56. /metaflow/{metadata → metadata_provider}/__init__.py +0 -0
  57. /metaflow/{metadata → metadata_provider}/heartbeat.py +0 -0
  58. /metaflow/{metadata → metadata_provider}/metadata.py +0 -0
  59. /metaflow/{metadata → metadata_provider}/util.py +0 -0
  60. /metaflow/plugins/{metadata → metadata_providers}/__init__.py +0 -0
  61. {ob_metaflow-2.12.27.1.dist-info → ob_metaflow-2.12.30.2.dist-info}/LICENSE +0 -0
  62. {ob_metaflow-2.12.27.1.dist-info → ob_metaflow-2.12.30.2.dist-info}/entry_points.txt +0 -0
  63. {ob_metaflow-2.12.27.1.dist-info → ob_metaflow-2.12.30.2.dist-info}/top_level.txt +0 -0
@@ -81,6 +81,8 @@ class Local(object):
81
81
  In the future, we may want to allow it to be used in a way similar to the S3() client.
82
82
  """
83
83
 
84
+ TYPE = "local"
85
+
84
86
  @staticmethod
85
87
  def _makedirs(path):
86
88
  try:
@@ -504,6 +504,8 @@ class S3(object):
504
504
  If `run` is not specified, use this as the S3 prefix.
505
505
  """
506
506
 
507
+ TYPE = "s3"
508
+
507
509
  @classmethod
508
510
  def get_root_from_config(cls, echo, create_on_absent=True):
509
511
  return DATATOOLS_S3ROOT
@@ -124,9 +124,9 @@ def load():
124
124
  cur_path = os.path.dirname(__file__)
125
125
  sys.path = [p for p in old_paths if p != cur_path]
126
126
  # Handle special case where we launch a shell (including with a command)
127
- # and we are in the CWD (searched if '' is the first element of sys.path)
128
- if cur_path == os.getcwd() and sys.path[0] == '':
129
- sys.path = sys.path[1:]
127
+ # and we are in the CWD (searched if '' is present in sys.path)
128
+ if cur_path == os.getcwd() and '' in sys.path:
129
+ sys.path.remove("")
130
130
 
131
131
  # Remove the module (this file) to reload it properly. Do *NOT* update sys.modules but
132
132
  # modify directly since it may be referenced elsewhere
@@ -8,6 +8,9 @@ from metaflow.exception import MetaflowException, MetaflowInternalError
8
8
 
9
9
 
10
10
  class GS(object):
11
+
12
+ TYPE = "gs"
13
+
11
14
  @classmethod
12
15
  def get_root_from_config(cls, echo, create_on_absent=True):
13
16
  from metaflow.metaflow_config import DATATOOLS_GSROOT
@@ -9,7 +9,7 @@ import metaflow.tracing as tracing
9
9
  from metaflow import JSONTypeClass, util
10
10
  from metaflow._vendor import click
11
11
  from metaflow.exception import METAFLOW_EXIT_DISALLOW_RETRY, MetaflowException
12
- from metaflow.metadata.util import sync_local_metadata_from_datastore
12
+ from metaflow.metadata_provider.util import sync_local_metadata_from_datastore
13
13
  from metaflow.metaflow_config import DATASTORE_LOCAL_DIR, KUBERNETES_LABELS
14
14
  from metaflow.mflog import TASK_LOG_SOURCE
15
15
  from metaflow.unbounded_foreach import UBF_CONTROL, UBF_TASK
@@ -7,8 +7,8 @@ import time
7
7
  from metaflow import current
8
8
  from metaflow.decorators import StepDecorator
9
9
  from metaflow.exception import MetaflowException
10
- from metaflow.metadata import MetaDatum
11
- from metaflow.metadata.util import sync_local_metadata_to_datastore
10
+ from metaflow.metadata_provider import MetaDatum
11
+ from metaflow.metadata_provider.util import sync_local_metadata_to_datastore
12
12
  from metaflow.metaflow_config import (
13
13
  DATASTORE_LOCAL_DIR,
14
14
  KUBERNETES_CONTAINER_IMAGE,
@@ -75,8 +75,9 @@ class KubernetesDecorator(StepDecorator):
75
75
  in Metaflow configuration.
76
76
  node_selector: Union[Dict[str,str], str], optional, default None
77
77
  Kubernetes node selector(s) to apply to the pod running the task.
78
- Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
79
- or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
78
+ Can be passed in as a comma separated string of values e.g.
79
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
80
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
80
81
  namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
81
82
  Kubernetes namespace to use when launching pod in Kubernetes.
82
83
  gpu : int, optional, default None
@@ -4,7 +4,6 @@ import math
4
4
  import random
5
5
  import time
6
6
  from collections import namedtuple
7
-
8
7
  from metaflow.exception import MetaflowException
9
8
  from metaflow.metaflow_config import KUBERNETES_JOBSET_GROUP, KUBERNETES_JOBSET_VERSION
10
9
  from metaflow.tracing import inject_tracing_vars
@@ -320,33 +319,49 @@ class RunningJobSet(object):
320
319
  def kill(self):
321
320
  plural = "jobsets"
322
321
  client = self._client.get()
323
- # Get the jobset
324
- with client.ApiClient() as api_client:
325
- api_instance = client.CustomObjectsApi(api_client)
326
- try:
327
- obj = api_instance.get_namespaced_custom_object(
328
- group=self._group,
329
- version=self._version,
330
- namespace=self._namespace,
331
- plural=plural,
332
- name=self._name,
333
- )
334
-
335
- # Suspend the jobset
336
- obj["spec"]["suspend"] = True
337
-
338
- api_instance.replace_namespaced_custom_object(
339
- group=self._group,
340
- version=self._version,
341
- namespace=self._namespace,
342
- plural=plural,
343
- name=obj["metadata"]["name"],
344
- body=obj,
345
- )
346
- except Exception as e:
347
- raise KubernetesJobsetException(
348
- "Exception when suspending existing jobset: %s\n" % e
349
- )
322
+ try:
323
+ # Killing the control pod will trigger the jobset to mark everything as failed.
324
+ # Since jobsets have a successPolicy set to `All` which ensures that everything has
325
+ # to succeed for the jobset to succeed.
326
+ from kubernetes.stream import stream
327
+
328
+ control_pod = self._fetch_pod()
329
+ stream(
330
+ client.CoreV1Api().connect_get_namespaced_pod_exec,
331
+ name=control_pod["metadata"]["name"],
332
+ namespace=control_pod["metadata"]["namespace"],
333
+ command=[
334
+ "/bin/sh",
335
+ "-c",
336
+ "/sbin/killall5",
337
+ ],
338
+ stderr=True,
339
+ stdin=False,
340
+ stdout=True,
341
+ tty=False,
342
+ )
343
+ except Exception as e:
344
+ with client.ApiClient() as api_client:
345
+ # If we are unable to kill the control pod then
346
+ # Delete the jobset to kill the subsequent pods.
347
+ # There are a few reasons for deleting a jobset to kill it :
348
+ # 1. Jobset has a `suspend` attribute to suspend it's execution, but this
349
+ # doesn't play nicely when jobsets are deployed with other components like kueue.
350
+ # 2. Jobset doesn't play nicely when we mutate status
351
+ # 3. Deletion is a gaurenteed way of removing any pods.
352
+ api_instance = client.CustomObjectsApi(api_client)
353
+ try:
354
+ api_instance.delete_namespaced_custom_object(
355
+ group=self._group,
356
+ version=self._version,
357
+ namespace=self._namespace,
358
+ plural=plural,
359
+ name=self._name,
360
+ )
361
+ except Exception as e:
362
+ raise KubernetesJobsetException(
363
+ "Exception when deleting existing jobset: %s\n" % e
364
+ )
350
365
 
351
366
  @property
352
367
  def id(self):
@@ -8,9 +8,9 @@ import time
8
8
  from collections import namedtuple
9
9
 
10
10
  from metaflow.exception import MetaflowInternalError, MetaflowTaggingError
11
- from metaflow.metadata.metadata import ObjectOrder
11
+ from metaflow.metadata_provider.metadata import ObjectOrder
12
12
  from metaflow.metaflow_config import DATASTORE_LOCAL_DIR
13
- from metaflow.metadata import MetadataProvider
13
+ from metaflow.metadata_provider import MetadataProvider
14
14
  from metaflow.tagging_util import MAX_USER_TAG_SET_SIZE, validate_tags
15
15
 
16
16
 
@@ -14,8 +14,8 @@ from metaflow.metaflow_config import (
14
14
  SERVICE_HEADERS,
15
15
  SERVICE_URL,
16
16
  )
17
- from metaflow.metadata import MetadataProvider
18
- from metaflow.metadata.heartbeat import HB_URL_KEY
17
+ from metaflow.metadata_provider import MetadataProvider
18
+ from metaflow.metadata_provider.heartbeat import HB_URL_KEY
19
19
  from metaflow.sidecar import Message, MessageTypes, Sidecar
20
20
 
21
21
  from metaflow.util import version_parse
@@ -2,7 +2,7 @@ from collections import namedtuple
2
2
  from metaflow.decorators import StepDecorator
3
3
  from metaflow.unbounded_foreach import UBF_CONTROL, CONTROL_TASK_TAG
4
4
  from metaflow.exception import MetaflowException
5
- from metaflow.metadata import MetaDatum
5
+ from metaflow.metadata_provider import MetaDatum
6
6
  from metaflow.metaflow_current import current, Parallel
7
7
  import os
8
8
  import sys
@@ -8,7 +8,7 @@ import tempfile
8
8
 
9
9
  from metaflow.decorators import FlowDecorator, StepDecorator
10
10
  from metaflow.extension_support import EXT_PKG
11
- from metaflow.metadata import MetaDatum
11
+ from metaflow.metadata_provider import MetaDatum
12
12
  from metaflow.metaflow_environment import InvalidEnvironmentException
13
13
  from metaflow.util import get_metaflow_root
14
14
 
@@ -15,7 +15,7 @@ from metaflow.unbounded_foreach import (
15
15
  CONTROL_TASK_TAG,
16
16
  )
17
17
  from metaflow.util import to_unicode
18
- from metaflow.metadata import MetaDatum
18
+ from metaflow.metadata_provider import MetaDatum
19
19
 
20
20
 
21
21
  class InternalTestUnboundedForeachInput(UnboundedForeachInput):
@@ -193,6 +193,10 @@ class MetaflowAPI(object):
193
193
  def chain(self):
194
194
  return self._chain
195
195
 
196
+ @property
197
+ def name(self):
198
+ return self._API_NAME
199
+
196
200
  @classmethod
197
201
  def from_cli(cls, flow_file: str, cli_collection: Callable) -> Callable:
198
202
  flow_cls = extract_flow_class_from_file(flow_file)