Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caching specification to file to ensure readability of distributed files #242

Merged
merged 1 commit into from
Nov 11, 2017

Conversation

jcfr
Copy link
Collaborator

@jcfr jcfr commented Nov 11, 2017

NWB files contain a currently freeform area in /general/specifications for storing
specifications. To ease use of the specification data it is now possible to:

  • Assign a neurodata_type to /general/specifications and create a custom NWBContainer
    class to manage specifications.

  • Create a new neurodata_type to be stored in /general/specifications to structure the
    storage of namespace and associated specification files rather than requiring that specs
    be stored in a single dataset

  • Automatically write all specs used by (or registered with) PyNWB to the NWB file when a
    file is written. This will help ensure that the spec for all objects are always stored
    in the file.

  • Add ability to use use specifications (including custom extensions) from the HDF5 directly
    on read. We possibly need an option here to allow the user decide whether to use specs from
    the HDF5 file or the specs currently registered with PyNWB.

See #44, #108

More specifically, this commit adds:

  • class for loading namespace
  • class for writing namespace
  • tooling to h5tools for caching spec to file
  • getter for FORMIO source
  • return of registered types to SpecCatalog.auto_register
  • tracking of type sources in NamespaceCatalog
  • class for building specification files to NamespaceBuilder
  • requirement that spec files be in the same directory as namespace file
  • getters for NamespaceCatalog to BuildManager
  • tracking of overridden specs
  • ability to read/write specs to/from HDF5 file
  • reference-to-reference write
  • roundtrip test for caching spec to hdf5 file
  • add roundtrip test for caching spec

This commit also implements the following changes:

  • make dataset fill methods classmethods
  • make Spec and Namespace catalogs maintain specs and namespaces with OrderedDict
  • require parent spec be passed in, rather than parent spec nam
  • import SpecNamespace to h5tools
  • fix bug when showing default strings in signature
  • allow string to be passed into BaseStorageSpec when extending
  • refactor caching of spec
  • import HDF5 spec reader/writer classes to package-level
  • use unittest2 instead of unittest for integration.test_io
  • import spec reader/writer abstract classes to form.spec subpackage
  • deploy spec caching feature

@jcfr jcfr mentioned this pull request Nov 11, 2017
5 tasks
@jcfr jcfr force-pushed the enh-cache_spec-conslidated branch 2 times, most recently from 419d983 to a5e26a7 Compare November 11, 2017 16:10
@codecov-io
Copy link

codecov-io commented Nov 11, 2017

Codecov Report

Merging #242 into dev will decrease coverage by 0.86%.
The diff coverage is 41.34%.

Impacted file tree graph

@@            Coverage Diff            @@
##              dev    #242      +/-   ##
=========================================
- Coverage   56.06%   55.2%   -0.87%     
=========================================
  Files          56      56              
  Lines        5105    5355     +250     
=========================================
+ Hits         2862    2956      +94     
- Misses       2243    2399     +156
Flag Coverage Δ
#form 55.2% <41.34%> (-0.87%) ⬇️
#integration 55.2% <41.34%> (-0.87%) ⬇️
#pynwb 55.2% <41.34%> (-0.87%) ⬇️
Impacted Files Coverage Δ
src/pynwb/form/spec/catalog.py 87.32% <100%> (+0.96%) ⬆️
src/pynwb/form/utils.py 81.59% <100%> (+0.25%) ⬆️
src/pynwb/form/spec/__init__.py 100% <100%> (ø) ⬆️
src/pynwb/form/backends/hdf5/__init__.py 100% <100%> (ø) ⬆️
src/pynwb/form/spec/spec.py 68.77% <18.46%> (-6%) ⬇️
src/pynwb/form/backends/hdf5/h5tools.py 14.64% <20.43%> (+2.25%) ⬆️
src/pynwb/form/build/map.py 35.26% <50%> (+0.09%) ⬆️
src/pynwb/form/backends/io.py 52.63% <50%> (-0.15%) ⬇️
src/pynwb/form/spec/namespace.py 80.53% <76%> (-3.6%) ⬇️
src/pynwb/form/spec/write.py 81.39% <86.11%> (+2.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fbb4e65...41dd48e. Read the comment docs.

…d files

NWB files contain a currently freeform area in ``/general/specifications`` for storing
specifications. To ease use of the specification data it is now possible to:

* Assign a neurodata_type to ``/general/specifications`` and create a custom ``NWBContainer``
  class to manage specifications.

* Create a new neurodata_type to be stored in ``/general/specifications`` to structure the
  storage of namespace and associated specification files rather than requiring that specs
  be stored in a single dataset

* Automatically write all specs used by (or registered with) PyNWB to the NWB file when a
  file is written. This will help ensure that the spec for all objects are always stored
  in the file.

* Add ability to use use specifications (including custom extensions) from the HDF5 directly
  on read. We possibly need an option here to allow the user decide whether to use specs from
  the HDF5 file or the specs currently registered with PyNWB.

See #44, #108

More specifically, this commit adds:
* class for loading namespace
* class for writing namespace
* tooling to ``h5tools`` for caching spec to file
* getter for ``FORMIO`` source
* return of registered types to ``SpecCatalog.auto_register``
* tracking of type sources in ``NamespaceCatalog``
* class for building specification files to ``NamespaceBuilder``
* requirement that spec files be in the same directory as namespace file
* getters for ``NamespaceCatalog`` to ``BuildManager``
* tracking of overridden specs
* ability to read/write specs to/from HDF5 file
* reference-to-reference write
* roundtrip test for caching spec to hdf5 file
* add roundtrip test for caching spec

This commit also implements the following changes:
* make dataset fill methods classmethods
* make ``Spec`` and ``Namespace`` catalogs maintain specs and namespaces with OrderedDict
* require parent spec be passed in, rather than parent spec nam
* import ``SpecNamespace`` to ``h5tools``
* fix bug when showing default strings in signature
* allow string to be passed into ``BaseStorageSpec`` when extending
* refactor caching of spec
* import HDF5 spec reader/writer classes to package-level
* use ``unittest2`` instead of ``unittest`` for ``integration.test_io``
* import spec reader/writer abstract classes to ``form.spec`` subpackage
* deploy spec caching feature
@jcfr jcfr merged commit 4220402 into dev Nov 11, 2017
@jcfr jcfr deleted the enh-cache_spec-conslidated branch November 11, 2017 18:52
jcfr added a commit that referenced this pull request Nov 11, 2017
It will be re-enabled while addressing issue #247:

 test_write_cache_spec failure on python 3.5 following integration of #242
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants