jobflow 0.1.10__py3-none-any.whl → 0.1.11__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.
jobflow/core/flow.py CHANGED
@@ -140,7 +140,7 @@ class Flow(MSONable):
140
140
  self.uuid = uuid
141
141
  self.hosts = hosts or []
142
142
 
143
- self._jobs: tuple[Flow | Job, ...] = tuple()
143
+ self._jobs: tuple[Flow | Job, ...] = ()
144
144
  self.add_jobs(jobs)
145
145
  self.output = output
146
146
 
jobflow/core/job.py CHANGED
@@ -324,7 +324,7 @@ class Job(MSONable):
324
324
 
325
325
  from jobflow.utils.find import contains_flow_or_job
326
326
 
327
- function_args = tuple() if function_args is None else function_args
327
+ function_args = () if function_args is None else function_args
328
328
  function_kwargs = {} if function_kwargs is None else function_kwargs
329
329
  uuid = suuid() if uuid is None else uuid
330
330
  metadata = {} if metadata is None else metadata
@@ -585,12 +585,14 @@ class Job(MSONable):
585
585
  pass_manager_config(response.replace, passed_config)
586
586
 
587
587
  try:
588
- output = jsanitize(response.output, strict=True, enum_values=True)
589
- except AttributeError:
588
+ output = jsanitize(
589
+ response.output, strict=True, enum_values=True, allow_bson=True
590
+ )
591
+ except AttributeError as err:
590
592
  raise RuntimeError(
591
593
  "Job output contained an object that is not MSONable and therefore "
592
594
  "could not be serialized."
593
- )
595
+ ) from err
594
596
 
595
597
  save = {k: "output" if v is True else v for k, v in self._kwargs.items()}
596
598
  data = {
@@ -905,12 +907,12 @@ class Job(MSONable):
905
907
  from jobflow.utils.dict_mods import apply_mod
906
908
 
907
909
  if dynamic:
908
- dict_input = dict(
909
- update=update,
910
- name_filter=name_filter,
911
- function_filter=function_filter,
912
- dict_mod=dict_mod,
913
- )
910
+ dict_input = {
911
+ "update": update,
912
+ "name_filter": name_filter,
913
+ "function_filter": function_filter,
914
+ "dict_mod": dict_mod,
915
+ }
914
916
  self.metadata_updates.append(dict_input)
915
917
 
916
918
  # unwrap the functions in case the job is a decorated one
@@ -1014,12 +1016,12 @@ class Job(MSONable):
1014
1016
  only be set for the `test_job` and not for the generated Jobs.
1015
1017
  """
1016
1018
  if dynamic:
1017
- dict_input = dict(
1018
- config=config,
1019
- name_filter=name_filter,
1020
- function_filter=function_filter,
1021
- attributes=attributes,
1022
- )
1019
+ dict_input = {
1020
+ "config": config,
1021
+ "name_filter": name_filter,
1022
+ "function_filter": function_filter,
1023
+ "attributes": attributes,
1024
+ }
1023
1025
  self.config_updates.append(dict_input)
1024
1026
 
1025
1027
  # unwrap the functions in case the job is a decorated one
jobflow/core/reference.py CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import contextlib
5
6
  import typing
6
7
  from typing import Any, Sequence
7
8
 
@@ -93,7 +94,7 @@ class OutputReference(MSONable):
93
94
  def __init__(
94
95
  self,
95
96
  uuid: str,
96
- attributes: tuple[tuple[str, Any], ...] = tuple(),
97
+ attributes: tuple[tuple[str, Any], ...] = (),
97
98
  output_schema: type[BaseModel] | None = None,
98
99
  ):
99
100
  super().__init__()
@@ -157,12 +158,10 @@ class OutputReference(MSONable):
157
158
  index = None if result is None else result["index"]
158
159
 
159
160
  if index is not None and index not in cache[self.uuid]:
160
- try:
161
+ with contextlib.suppress(ValueError):
161
162
  cache[self.uuid][index] = store.get_output(
162
163
  self.uuid, which="last", load=True, on_missing=on_missing
163
164
  )
164
- except ValueError:
165
- pass
166
165
 
167
166
  if on_missing == OnMissing.ERROR and index not in cache[self.uuid]:
168
167
  istr = f" ({index})" if index is not None else ""
@@ -390,9 +389,9 @@ def find_and_get_references(arg: Any) -> tuple[OutputReference, ...]:
390
389
 
391
390
  elif isinstance(arg, (float, int, str, bool)):
392
391
  # argument is a primitive, we won't find a reference here
393
- return tuple()
392
+ return ()
394
393
 
395
- arg = jsanitize(arg, strict=True, enum_values=True)
394
+ arg = jsanitize(arg, strict=True, enum_values=True, allow_bson=True)
396
395
 
397
396
  # recursively find any reference classes
398
397
  locations = find_key_value(arg, "@class", "OutputReference")
@@ -449,7 +448,7 @@ def find_and_resolve_references(
449
448
  return arg
450
449
 
451
450
  # serialize the argument to a dictionary
452
- encoded_arg = jsanitize(arg, strict=True, enum_values=True)
451
+ encoded_arg = jsanitize(arg, strict=True, enum_values=True, allow_bson=True)
453
452
 
454
453
  # recursively find any reference classes
455
454
  locations = find_key_value(encoded_arg, "@class", "OutputReference")
jobflow/core/store.py CHANGED
@@ -210,7 +210,7 @@ class JobStore(Store):
210
210
  properties=["blob_uuid", "data"],
211
211
  )
212
212
  object_map = {o["blob_uuid"]: o["data"] for o in objects}
213
- inserts = {tuple(l): object_map[o] for o, l in object_info.items()}
213
+ inserts = {tuple(v): object_map[k] for k, v in object_info.items()}
214
214
  to_insert.update(inserts)
215
215
 
216
216
  update_in_dictionary(doc, to_insert)
@@ -737,7 +737,7 @@ def _filter_blobs(
737
737
  from collections import defaultdict
738
738
 
739
739
  def _group_blobs(infos, locs):
740
- grouped = defaultdict(lambda: (list(), list()))
740
+ grouped = defaultdict(lambda: ([], []))
741
741
  for info, loc in zip(infos, locs):
742
742
  grouped[info["store"]][0].append(info)
743
743
  grouped[info["store"]][1].append(loc)
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jobflow
3
- Version: 0.1.10
3
+ Version: 0.1.11
4
4
  Summary: jobflow is a library for writing computational workflows
5
5
  Author-email: Alex Ganose <alexganose@gmail.com>
6
6
  License: modified BSD
7
7
  Project-URL: homepage, https://materialsproject.github.io/jobflow/
8
- Project-URL: repository, https://github.com/hackingmaterials/jobflow
8
+ Project-URL: repository, https://github.com/materialsproject/jobflow
9
9
  Project-URL: documentation, https://materialsproject.github.io/jobflow/
10
10
  Project-URL: changelog, https://github.com/materialsproject/jobflow/blob/main/CHANGELOG.md
11
11
  Keywords: high-throughput,workflow
@@ -37,7 +37,7 @@ Requires-Dist: sphinx (==6.1.3) ; extra == 'docs'
37
37
  Requires-Dist: furo (==2022.12.7) ; extra == 'docs'
38
38
  Requires-Dist: myst-parser (==1.0.0) ; extra == 'docs'
39
39
  Requires-Dist: ipython (==8.11.0) ; extra == 'docs'
40
- Requires-Dist: nbsphinx (==0.8.12) ; extra == 'docs'
40
+ Requires-Dist: nbsphinx (==0.9.0) ; extra == 'docs'
41
41
  Requires-Dist: autodoc-pydantic (==1.8.0) ; extra == 'docs'
42
42
  Provides-Extra: fireworks
43
43
  Requires-Dist: FireWorks ; extra == 'fireworks'
@@ -46,7 +46,7 @@ Requires-Dist: monty (==2022.9.9) ; extra == 'strict'
46
46
  Requires-Dist: networkx (==3.0) ; extra == 'strict'
47
47
  Requires-Dist: pydash (==6.0.2) ; extra == 'strict'
48
48
  Requires-Dist: maggma (==0.50.3) ; extra == 'strict'
49
- Requires-Dist: pydantic (==1.10.5) ; extra == 'strict'
49
+ Requires-Dist: pydantic (==1.10.6) ; extra == 'strict'
50
50
  Requires-Dist: PyYAML (==6.0) ; extra == 'strict'
51
51
  Requires-Dist: FireWorks (==2.0.3) ; extra == 'strict'
52
52
  Requires-Dist: matplotlib (==3.7.1) ; extra == 'strict'
@@ -137,7 +137,7 @@ the jobs is determined automatically and can be visualised using the flow graph.
137
137
 
138
138
  ## Installation
139
139
 
140
- The jobflow is a Python 3.7+ library and can be installed using pip.
140
+ The jobflow is a Python 3.8+ library and can be installed using pip.
141
141
 
142
142
  ```bash
143
143
  pip install jobflow
@@ -3,12 +3,12 @@ jobflow/_version.py,sha256=ERuIgO0lzbMrVMSXNAE55GxFc5JHDdf1CW7GtoXJ67Q,206
3
3
  jobflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  jobflow/settings.py,sha256=JHyTq9AOzMjSN5ohpLeooMLM0ddO2nPMuHuOyH62X6E,4908
5
5
  jobflow/core/__init__.py,sha256=3sx5t1Gysejc4c_fPrhvCjPUg0p_384Zko8ms2c_NnY,98
6
- jobflow/core/flow.py,sha256=tniQlN5cCWk8-6yC7rmL85y43PVCo8JdoIGY_CYSe1Y,25113
7
- jobflow/core/job.py,sha256=KqAl8XqJL1rGg395DG6vbvt6vm05mOqN3qum9yvhs7Y,45417
6
+ jobflow/core/flow.py,sha256=b2XRc8Qvf2c5eXOyi2MP0_NEb6nKuN0QuOnyiGypvSI,25108
7
+ jobflow/core/job.py,sha256=TVbx5XRQx1axGFwUZbRODbmZoVLdbM95xAaAdpFIGbM,45491
8
8
  jobflow/core/maker.py,sha256=4y76hHopYbV5HjjhHZRkRpdv8yCOuxfIdSXG_hLcY_0,11234
9
- jobflow/core/reference.py,sha256=6f-nlhT77YKYG_DNuu4QNbRMKpgbCRiwSa3BV1Ar5nM,16378
9
+ jobflow/core/reference.py,sha256=xb9AtRyZ11AkLNQCy4OlZ1xf6O84lIybrVesTrNsVCE,16401
10
10
  jobflow/core/state.py,sha256=5LWKTAiYEkUWuFEZNeLtRZ0KCR3qMwZYJRN03zOM4X0,760
11
- jobflow/core/store.py,sha256=b8nMme_f4WWJsGL8b4z_eScD21ncSp_rhkOV7hqFqsY,26391
11
+ jobflow/core/store.py,sha256=YKS06FJqK4wx1F8YuJWnXC51yTaL5zD2ZqFFN9U8VSQ,26383
12
12
  jobflow/managers/__init__.py,sha256=KkA5cVDe2os2_2aTa8eiB9SnkGLZNybcci-Lo4tbaWM,55
13
13
  jobflow/managers/fireworks.py,sha256=7O6g23fnr9VBTGAy8h9OR_P9D2KvuQ7-XYTi0O0sqB4,5941
14
14
  jobflow/managers/local.py,sha256=z8Ae-a_rUKqnCLsBAM9UIz0xZfCT3AxUWTxJQEf4Er4,4372
@@ -19,8 +19,8 @@ jobflow/utils/find.py,sha256=VRqdDAnx-RavNvdVJ7TVEfvnBIkKR2HhHyOy7lh1QC8,5556
19
19
  jobflow/utils/graph.py,sha256=T7M5gOeAxK4CaAynepY11ysEp5Q6ccJ62ZJ4nCFZeVQ,4578
20
20
  jobflow/utils/log.py,sha256=dNIOvhApCtW7z1OamLlUmg6TL4mDXOQ0yFQxD8AM0Lk,725
21
21
  jobflow/utils/uuid.py,sha256=lVgo8e8gUB7HLSR0H_9uZH-OPkVBaOT39atAnNKYAaI,268
22
- jobflow-0.1.10.dist-info/LICENSE,sha256=jUEiENfZNQZh9RE9ixtUWgVkLRD85ScZ6iv1WREf19w,2418
23
- jobflow-0.1.10.dist-info/METADATA,sha256=xfUn0qP66T5Yyybv8Ty2K-wM6xY9pYGYZ5neuI00WcM,8815
24
- jobflow-0.1.10.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
25
- jobflow-0.1.10.dist-info/top_level.txt,sha256=IanNooU88OupQPDrWnT0rbL3E27P2wEy7Jsfx9_j8zc,8
26
- jobflow-0.1.10.dist-info/RECORD,,
22
+ jobflow-0.1.11.dist-info/LICENSE,sha256=jUEiENfZNQZh9RE9ixtUWgVkLRD85ScZ6iv1WREf19w,2418
23
+ jobflow-0.1.11.dist-info/METADATA,sha256=P3zSomFDef_b3DmPltaNidz_NqBDK-nUr1QxsfLvXAE,8814
24
+ jobflow-0.1.11.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
25
+ jobflow-0.1.11.dist-info/top_level.txt,sha256=IanNooU88OupQPDrWnT0rbL3E27P2wEy7Jsfx9_j8zc,8
26
+ jobflow-0.1.11.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.38.4)
2
+ Generator: bdist_wheel (0.40.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5