experimaestro 2.0.0a3__py3-none-any.whl → 2.0.0a4__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 experimaestro might be problematic. Click here for more details.

@@ -16,7 +16,7 @@ from experimaestro.utils import logger
16
16
  from experimaestro.locking import Lock
17
17
  from experimaestro.tokens import Token
18
18
  from experimaestro.utils.asyncio import asyncThreadcheck
19
- import pkg_resources
19
+ from importlib.metadata import entry_points
20
20
 
21
21
 
22
22
  class RedirectType(enum.Enum):
@@ -101,7 +101,7 @@ class Process:
101
101
  """Get a handler"""
102
102
  if Process.HANDLERS is None:
103
103
  Process.HANDLERS = {}
104
- for ep in pkg_resources.iter_entry_points(group="experimaestro.process"):
104
+ for ep in entry_points(group="experimaestro.process"):
105
105
  logging.debug("Adding process handler for type %s", ep.name)
106
106
  handler = ep.load()
107
107
  Process.HANDLERS[ep.name] = handler
@@ -214,6 +214,31 @@ class ConfigInformation:
214
214
  # Not an argument, bypass
215
215
  return object.__getattribute__(self.pyobject, name)
216
216
 
217
+ @staticmethod
218
+ def is_generated_value(argument, value):
219
+ if argument.ignore_generated:
220
+ return False
221
+
222
+ if value is None:
223
+ return False
224
+
225
+ if isinstance(value, (int, str, float, bool, Path)):
226
+ return False
227
+
228
+ if isinstance(value, ConfigMixin):
229
+ return value.__xpm__._generated_values and value.__xpm__.task is None
230
+
231
+ if isinstance(value, list):
232
+ return any(ConfigInformation.is_generated_value(argument, x) for x in value)
233
+
234
+ if isinstance(value, dict):
235
+ return any(
236
+ ConfigInformation.is_generated_value(argument, x)
237
+ for x in value.values()
238
+ )
239
+
240
+ assert False, f"Cannot handle values of type {type(value)}"
241
+
217
242
  def set(self, k, v, bypass=False):
218
243
  from experimaestro.generators import Generator
219
244
 
@@ -233,12 +258,7 @@ class ConfigInformation:
233
258
  try:
234
259
  argument = self.xpmtype.arguments.get(k, None)
235
260
  if argument:
236
- if (
237
- isinstance(v, ConfigMixin)
238
- and v.__xpm__._generated_values
239
- and v.__xpm__.task is None
240
- and not argument.ignore_generated
241
- ):
261
+ if ConfigInformation.is_generated_value(argument, v):
242
262
  raise AttributeError(
243
263
  f"Cannot set {k} to a configuration with generated values. "
244
264
  "Here is the list of paths to help you: "
@@ -373,9 +393,7 @@ class ConfigInformation:
373
393
  if generated_keys := [
374
394
  k
375
395
  for k, v in self.values.items()
376
- if isinstance(v, Config)
377
- and v.__xpm__.task is None
378
- and v.__xpm__._generated_values
396
+ if ConfigInformation.is_generated_value(self.xpmtype.arguments[k], v)
379
397
  ]:
380
398
  raise AttributeError(
381
399
  "Cannot seal a configuration with generated values:"
@@ -926,6 +944,7 @@ class ConfigInformation:
926
944
  "workspace": str(context.workspace.path.absolute()),
927
945
  "tags": {key: value for key, value in self.tags().items()},
928
946
  "version": 2,
947
+ "experimaestro": experimaestro.__version__,
929
948
  "objects": self.__get_objects__([], context),
930
949
  },
931
950
  out,
@@ -1 +1,18 @@
1
- from .base import *
1
+ from .base import Scheduler, Listener
2
+ from .workspace import Workspace, RunMode
3
+ from .experiment import experiment, FailedExperiment
4
+ from .jobs import Job, JobState, JobFailureStatus, JobDependency, JobContext
5
+
6
+ __all__ = [
7
+ "Scheduler",
8
+ "Listener",
9
+ "Workspace",
10
+ "RunMode",
11
+ "experiment",
12
+ "FailedExperiment",
13
+ "Job",
14
+ "JobState",
15
+ "JobFailureStatus",
16
+ "JobDependency",
17
+ "JobContext",
18
+ ]