Public Member Functions | Static Public Attributes | Static Private Attributes | List of all members
nova_h5_metadata.NovaH5 Class Reference
Inheritance diagram for nova_h5_metadata.NovaH5:

Public Member Functions

def getMetadataFile (self, filestate)
 
def extract (self, filestate, args, kwargs)
 

Static Public Attributes

string name = "nova-h5"
 

Static Private Attributes

int _concurrent_limit = 4
 

Detailed Description

Definition at line 20 of file nova_h5_metadata.py.

Member Function Documentation

def nova_h5_metadata.NovaH5.extract (   self,
  filestate,
  args,
  kwargs 
)

Definition at line 36 of file nova_h5_metadata.py.

References nova_h5_metadata._createMetadata(), nova_h5_metadata.NovaH5.getMetadataFile(), and nova_art_metadata.NovaArt.getMetadataFile().

36  def extract( self, filestate, *args, **kwargs):
37  group = 'nova'
38  try:
39  jsonfilename = yield self.getMetadataFile(filestate)
40  if jsonfilename:
41  jsonfile = yield threads.deferToThread(open, jsonfilename)
42  md = _createMetadata(filestate.getFileName(), group, filestate.getFileSize())
43  log.msg("Using metadata file %s for %s" % (jsonfilename, filestate.getFileName()))
44  if md:
45  defer.returnValue(md)
46 
47  except Exception as e:
48  print e
49  print 'Exception reading json file, falling back to direct extraction'
50 
51  # find the executable on the path
52  md = _createMetadata(filestate.getFileName(), group, filestate.getFileSize())
53  defer.returnValue(md)
54 
def _createMetadata(filename, group, filesizebytes)
def extract(self, filestate, args, kwargs)
def getMetadataFile(self, filestate)
def nova_h5_metadata.NovaH5.getMetadataFile (   self,
  filestate 
)

Definition at line 25 of file nova_h5_metadata.py.

Referenced by nova_ntuple_metadata.NovaNTuple.extract(), nova_h5_metadata.NovaH5.extract(), and nova_text_metadata.NovaText.extract().

25  def getMetadataFile(self, filestate):
26  jsonName = filestate.getLocalFilePath()
27 
28  if not '.h5' in jsonName: return
29  jsonName = jsonName.replace('.h5', '.json')
30 
31  exists = yield self._checkmdfile(jsonName, filestate)
32  if not exists: return
33  defer.returnValue(jsonName)
34 
def getMetadataFile(self, filestate)

Member Data Documentation

int nova_h5_metadata.NovaH5._concurrent_limit = 4
staticprivate

Definition at line 22 of file nova_h5_metadata.py.

string nova_h5_metadata.NovaH5.name = "nova-h5"
static

The documentation for this class was generated from the following file: