ceci 2.1__tar.gz → 2.2__tar.gz

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.
Files changed (85) hide show
  1. {ceci-2.1 → ceci-2.2}/PKG-INFO +1 -1
  2. {ceci-2.1 → ceci-2.2}/ceci/_version.py +2 -2
  3. {ceci-2.1 → ceci-2.2}/ceci/config.py +41 -0
  4. {ceci-2.1 → ceci-2.2}/ceci/pipeline.py +10 -5
  5. {ceci-2.1 → ceci-2.2}/ceci/stage.py +19 -19
  6. {ceci-2.1 → ceci-2.2}/ceci.egg-info/PKG-INFO +1 -1
  7. {ceci-2.1 → ceci-2.2}/tests/test_stage.py +1 -1
  8. {ceci-2.1 → ceci-2.2}/.coveragerc +0 -0
  9. {ceci-2.1 → ceci-2.2}/.github/workflows/ci.yml +0 -0
  10. {ceci-2.1 → ceci-2.2}/.github/workflows/publish.yml +0 -0
  11. {ceci-2.1 → ceci-2.2}/.gitignore +0 -0
  12. {ceci-2.1 → ceci-2.2}/.pylintrc +0 -0
  13. {ceci-2.1 → ceci-2.2}/LICENSE +0 -0
  14. {ceci-2.1 → ceci-2.2}/README.md +0 -0
  15. {ceci-2.1 → ceci-2.2}/ceci/__init__.py +0 -0
  16. {ceci-2.1 → ceci-2.2}/ceci/__main__.py +0 -0
  17. {ceci-2.1 → ceci-2.2}/ceci/errors.py +0 -0
  18. {ceci-2.1 → ceci-2.2}/ceci/main.py +0 -0
  19. {ceci-2.1 → ceci-2.2}/ceci/minirunner.py +0 -0
  20. {ceci-2.1 → ceci-2.2}/ceci/monitor.py +0 -0
  21. {ceci-2.1 → ceci-2.2}/ceci/sites/__init__.py +0 -0
  22. {ceci-2.1 → ceci-2.2}/ceci/sites/ccin2p3.py +0 -0
  23. {ceci-2.1 → ceci-2.2}/ceci/sites/local.py +0 -0
  24. {ceci-2.1 → ceci-2.2}/ceci/sites/nersc.py +0 -0
  25. {ceci-2.1 → ceci-2.2}/ceci/sites/site.py +0 -0
  26. {ceci-2.1 → ceci-2.2}/ceci/tools/__init__.py +0 -0
  27. {ceci-2.1 → ceci-2.2}/ceci/tools/ancestors.py +0 -0
  28. {ceci-2.1 → ceci-2.2}/ceci/update_pipelines_for_ceci_2.py +0 -0
  29. {ceci-2.1 → ceci-2.2}/ceci/utils.py +0 -0
  30. {ceci-2.1 → ceci-2.2}/ceci.egg-info/SOURCES.txt +0 -0
  31. {ceci-2.1 → ceci-2.2}/ceci.egg-info/dependency_links.txt +0 -0
  32. {ceci-2.1 → ceci-2.2}/ceci.egg-info/entry_points.txt +0 -0
  33. {ceci-2.1 → ceci-2.2}/ceci.egg-info/requires.txt +0 -0
  34. {ceci-2.1 → ceci-2.2}/ceci.egg-info/top_level.txt +0 -0
  35. {ceci-2.1 → ceci-2.2}/ceci.png +0 -0
  36. {ceci-2.1 → ceci-2.2}/ceci_example/__init__.py +0 -0
  37. {ceci-2.1 → ceci-2.2}/ceci_example/__main__.py +0 -0
  38. {ceci-2.1 → ceci-2.2}/ceci_example/example_stages.py +0 -0
  39. {ceci-2.1 → ceci-2.2}/ceci_example/types.py +0 -0
  40. {ceci-2.1 → ceci-2.2}/ceci_example_namespace/example_stages.py +0 -0
  41. {ceci-2.1 → ceci-2.2}/do_cover.sh +0 -0
  42. {ceci-2.1 → ceci-2.2}/docs/Makefile +0 -0
  43. {ceci-2.1 → ceci-2.2}/docs/conf.py +0 -0
  44. {ceci-2.1 → ceci-2.2}/docs/config.rst +0 -0
  45. {ceci-2.1 → ceci-2.2}/docs/config2.rst +0 -0
  46. {ceci-2.1 → ceci-2.2}/docs/index.rst +0 -0
  47. {ceci-2.1 → ceci-2.2}/docs/installation.rst +0 -0
  48. {ceci-2.1 → ceci-2.2}/docs/launchers.rst +0 -0
  49. {ceci-2.1 → ceci-2.2}/docs/logo.png +0 -0
  50. {ceci-2.1 → ceci-2.2}/docs/overview.rst +0 -0
  51. {ceci-2.1 → ceci-2.2}/docs/sites.rst +0 -0
  52. {ceci-2.1 → ceci-2.2}/docs/stages.rst +0 -0
  53. {ceci-2.1 → ceci-2.2}/docs/tutorial.rst +0 -0
  54. {ceci-2.1 → ceci-2.2}/nb/ceci_interactive_example.ipynb +0 -0
  55. {ceci-2.1 → ceci-2.2}/pyproject.toml +0 -0
  56. {ceci-2.1 → ceci-2.2}/setup.cfg +0 -0
  57. {ceci-2.1 → ceci-2.2}/setup.py +0 -0
  58. {ceci-2.1 → ceci-2.2}/tests/__init__.py +0 -0
  59. {ceci-2.1 → ceci-2.2}/tests/config.yml +0 -0
  60. {ceci-2.1 → ceci-2.2}/tests/config_nm.yml +0 -0
  61. {ceci-2.1 → ceci-2.2}/tests/create_registry_entries.py +0 -0
  62. {ceci-2.1 → ceci-2.2}/tests/inputs/dm.txt +0 -0
  63. {ceci-2.1 → ceci-2.2}/tests/inputs/fiducial_cosmology.txt +0 -0
  64. {ceci-2.1 → ceci-2.2}/tests/test.hdf5 +0 -0
  65. {ceci-2.1 → ceci-2.2}/tests/test.yml +0 -0
  66. {ceci-2.1 → ceci-2.2}/tests/test_cmd.py +0 -0
  67. {ceci-2.1 → ceci-2.2}/tests/test_dask.py +0 -0
  68. {ceci-2.1 → ceci-2.2}/tests/test_dataregistry.yml +0 -0
  69. {ceci-2.1 → ceci-2.2}/tests/test_executables.py +0 -0
  70. {ceci-2.1 → ceci-2.2}/tests/test_flow_chart.py +0 -0
  71. {ceci-2.1 → ceci-2.2}/tests/test_helpers.py +0 -0
  72. {ceci-2.1 → ceci-2.2}/tests/test_interactive.py +0 -0
  73. {ceci-2.1 → ceci-2.2}/tests/test_main.py +0 -0
  74. {ceci-2.1 → ceci-2.2}/tests/test_minirunner.py +0 -0
  75. {ceci-2.1 → ceci-2.2}/tests/test_monitor.py +0 -0
  76. {ceci-2.1 → ceci-2.2}/tests/test_namespace.yml +0 -0
  77. {ceci-2.1 → ceci-2.2}/tests/test_pipeline.py +0 -0
  78. {ceci-2.1 → ceci-2.2}/tests/test_python_paths.py +0 -0
  79. {ceci-2.1 → ceci-2.2}/tests/test_site.py +0 -0
  80. {ceci-2.1 → ceci-2.2}/tests/test_snapshot.py +0 -0
  81. {ceci-2.1 → ceci-2.2}/tests/test_update_script.py +0 -0
  82. {ceci-2.1 → ceci-2.2}/tests/test_utils.py +0 -0
  83. {ceci-2.1 → ceci-2.2}/tests/update_test_files/config.yml +0 -0
  84. {ceci-2.1 → ceci-2.2}/tests/update_test_files/pipeline1.yml +0 -0
  85. {ceci-2.1 → ceci-2.2}/tests/update_test_files/pipeline2.yml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ceci
3
- Version: 2.1
3
+ Version: 2.2
4
4
  Summary: Lightweight pipeline engine for LSST DESC
5
5
  Author: Joe Zuntz
6
6
  License: BSD 3-Clause License
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '2.1'
16
- __version_tuple__ = version_tuple = (2, 1)
15
+ __version__ = version = '2.2'
16
+ __version_tuple__ = version_tuple = (2, 2)
@@ -88,6 +88,10 @@ class StageParameter:
88
88
  self._required = self._default is None
89
89
  self._value = cast_value(self._dtype, self._default)
90
90
 
91
+ def __repr__(self):
92
+ req_str = 'required' if self.required else 'optional'
93
+ return f"Parameter({self.msg}, type: {self.dtype}, default: {self.default} [{req_str}])"
94
+
91
95
  @property
92
96
  def value(self):
93
97
  """Return the value"""
@@ -138,6 +142,27 @@ class StageParameter:
138
142
  self._default = default
139
143
  self.set_to_default()
140
144
 
145
+ def numpy_style_help_text(self):
146
+ """Create a docstring followwing numpy style guidelines"""
147
+ s = ""
148
+ if self._dtype is None:
149
+ s += "[type not specified] "
150
+ else:
151
+ s += f"[{self._dtype.__name__}] "
152
+ if self._required:
153
+ s += "(required)"
154
+ else:
155
+ # truncate long dicts
156
+ if isinstance(self._default, dict) and len(self._default) > 10:
157
+ s += "(default={...})"
158
+ # truncate long lists
159
+ elif isinstance(self._default, list) and len(self._default) > 10:
160
+ s += "(default=[...])"
161
+ else:
162
+ s += f"default={self._default}"
163
+ s += f"\n {self._help}"
164
+ return s
165
+
141
166
 
142
167
  class StageConfig(dict):
143
168
  """A small class to manage a dictionary of configuration parameters with basic type checking"""
@@ -279,3 +304,19 @@ class StageConfig(dict):
279
304
  if isinstance(attr, StageParameter):
280
305
  return attr.dtype
281
306
  return type(attr)
307
+
308
+ def numpy_style_help_text(self):
309
+ """Create a docstring followwing numpy style guidelines"""
310
+ if not self:
311
+ return "<This class has no configuration options>"
312
+ s = []
313
+ for key, val in dict.items(self):
314
+ if isinstance(val, StageConfig):
315
+ val = val[key]
316
+ if isinstance(val, StageParameter):
317
+ s.append(f"{key}: {val.numpy_style_help_text()}")
318
+ elif isinstance(val, type):
319
+ s.append(f"{key}: {val.__name__}] (required)")
320
+ else:
321
+ s.append(f"{key}: {type(val).__name__}] (default={val})")
322
+ return '\n\n'.join(s)
@@ -524,18 +524,23 @@ class Pipeline:
524
524
  else:
525
525
  raise ValueError("Must specify either id or name in registry lookup")
526
526
 
527
+ # Whatever the lookup, we always require a dataset which has not beed deleted or replaced
528
+ status_filter = registry.Query.gen_filter("dataset.status", "==", 1)
529
+
527
530
  # Main finder method
528
- results = registry.Query.find_datasets(["dataset.dataset_id"], [filter])
531
+ results = registry.Query.find_datasets(["dataset.dataset_id"], [filter, status_filter])
529
532
 
530
533
  # Check that we find exactly one dataset matching the query
531
- results = list(results)
532
- if len(results) == 0:
534
+ if not results:
533
535
  raise ValueError(f"Could not find any dataset matching {info} in registry")
534
- elif len(results) > 1:
536
+
537
+ results = results['dataset.dataset_id']
538
+
539
+ if len(results) > 1:
535
540
  raise ValueError(f"Found multiple datasets matching {info} in registry")
536
541
 
537
542
  # Get the absolute path
538
- return registry.Query.get_dataset_absolute_path(results[0].dataset_id)
543
+ return registry.Query.get_dataset_absolute_path(results[0])
539
544
 
540
545
 
541
546
  def process_overall_inputs(self, inputs):
@@ -153,13 +153,13 @@ class PipelineStage:
153
153
  Subclasses must implemented this method.
154
154
  """
155
155
  raise NotImplementedError("run")
156
-
156
+
157
157
  def validate(self):
158
158
  """Check that the inputs actually have the data needed for execution,
159
159
  This is called before the run method. It is an optional stage, meant
160
160
  for checking that the input to the stage is actual in the form and
161
161
  shape needed before an expensive run is executed."""
162
- pass
162
+ pass
163
163
 
164
164
  def load_configs(self, args):
165
165
  """
@@ -356,11 +356,11 @@ class PipelineStage:
356
356
  if stage_is_complete and cls.config_options:
357
357
  config_text = cls._describe_configuration_text()
358
358
  if cls.__doc__ is None:
359
- cls.__doc__ = f"Stage {cls.name}\n\nConfiguration Parameters:\n{config_text}"
359
+ cls.__doc__ = f"Stage {cls.name}\n\nParameters\n----------\n{config_text}"
360
360
  else:
361
361
  # strip any existing configuration text from parent classes that is at the end of the doctring
362
- cls.__doc__ = cls.__doc__.split("Configuration Parameters:")[0]
363
- cls.__doc__ += f"\n\nConfiguration Parameters:\n{config_text}"
362
+ cls.__doc__ = cls.__doc__.split("Parameters")[0]
363
+ cls.__doc__ += f"\n\nParameters\n----------\n{config_text}"
364
364
 
365
365
  # Register the class
366
366
  if stage_is_complete:
@@ -436,24 +436,24 @@ class PipelineStage:
436
436
  s = []
437
437
  if cls.config_options is None:
438
438
  return "<This class has no configuration options>"
439
+
439
440
  for name, val in cls.config_options.items():
441
+ if isinstance(val, StageConfig):
442
+ val = val[name]
440
443
  if isinstance(val, StageParameter):
441
- if val.required:
442
- if val.dtype is None:
443
- txt = f"[type not specified]: {val._help} (required)"
444
- else:
445
- txt = f"[{val.dtype.__name__}]: {val._help} (required)"
446
- else:
447
- if val.dtype is None:
448
- txt = f"[type not specified]: {val._help} (default={val.default})"
449
- else:
450
- txt = f"[{val.dtype.__name__}]: {val._help} (default={val.default})"
444
+ s.append(f"{name}: {val.numpy_style_help_text()}")
451
445
  elif isinstance(val, type):
452
- txt = f"[{val.__name__}]: (required)"
446
+ s.append(f"{name}: {val.__name__}] (required)")
453
447
  else:
454
- txt = f"[{type(val).__name__}]: (default={val})"
455
- s.append(f"{name} {txt} ")
456
- return '\n'.join(s)
448
+ s.append(f"{name}: {type(val).__name__}] (default={val})")
449
+
450
+ for input_ in cls.inputs:
451
+ s.append(f"{input_[0]}: {input_[1].__name__} (INPUT)")
452
+ for output_ in cls.outputs:
453
+ s.append(f"{output_[0]}: {output_[1].__name__} (OUTPUT)")
454
+
455
+ return '\n\n'.join(s)
456
+
457
457
 
458
458
  @classmethod
459
459
  def usage(cls): # pragma: no cover
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ceci
3
- Version: 2.1
3
+ Version: 2.2
4
4
  Summary: Lightweight pipeline engine for LSST DESC
5
5
  Author: Joe Zuntz
6
6
  License: BSD 3-Clause License
@@ -149,7 +149,7 @@ def test_parameter():
149
149
  assert stage_1.config.b == 'puffins are not extinct?'
150
150
  assert 1 in stage_1.config.c
151
151
  assert len(stage_1.config.d) == 0
152
- assert "c [list]: a list (default=[1, 2, 3])" in stage_1.__doc__
152
+ assert "[list] default=[1, 2, 3]" in stage_1.__doc__
153
153
  stage_1.describe_configuration()
154
154
 
155
155
  cmd = "TestStage", "--a", "6", "--b", "puffins are not extinct?", "--inp", "dummy"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes