[Gug-cvs] gug/gug/common jsdl.py,1.10,1.11 idstore.py,1.5,1.6
Status: Planning
Brought to you by:
szferi
From: Adrian T. <cs...@us...> - 2007-09-27 10:36:32
|
Update of /cvsroot/gug/gug/gug/common In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv23476/gug/common Modified Files: jsdl.py idstore.py Log Message: Adding Decision Maker module It is Integrated into the following services: Sched, CM, StM Index: idstore.py =================================================================== RCS file: /cvsroot/gug/gug/gug/common/idstore.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** idstore.py 30 Jan 2007 18:27:47 -0000 1.5 --- idstore.py 27 Sep 2007 10:36:03 -0000 1.6 *************** *** 8,12 **** import os ! class IDStore: def __init__(self, dirname): --- 8,55 ---- import os ! ! class AbstractQueue: ! '''Abstract Queue base class for services queue handling''' ! def __init__(self): ! self._ids = [] ! ! def add(self, value): ! self._ids.append(value) ! self.commit(self._ids.index(value)) ! ! def add_with_id(self, id, value): ! try: ! self._ids[id] = value ! return True ! except: ! return False ! ! def commit(self, id): ! return id < len(self._ids) ! ! def delete(self, id): ! del self._ids[id] ! self.commit(self._ids.index(value)) ! ! def delete_by_value(self, value): ! self._ids.remove(value) ! ! def get(self, id): ! return self._ids[id] ! ! def get_all(self): ! return self._ids ! ! def get_id(self, value): ! return self._ids.index(value) ! ! def select(self, filter): ! return [v for v in self._ids if v in filter] ! ! def select_by_id_list(self, ids): ! return [v for v in self._ids if self._ids.index(v) in ids] ! ! ! class IDStore(AbstractQueue): def __init__(self, dirname): *************** *** 60,66 **** --- 103,119 ---- self.commit(id['grid_id']) + def add_with_id(self, id, value): + value['grid_id'] = id + self.add(value) + def get(self, grid_id): return self._ids[grid_id] + def get_all(self): + return self._ids.values() + + def get_id(self, value): + return value.get('grid_id', None) + def delete(self, grid_id): try: *************** *** 70,73 **** --- 123,129 ---- pass self.commit(grid_id) + + def delete_by_value(self, value): + self.delete(value['grid_id']) def select(self, filter): Index: jsdl.py =================================================================== RCS file: /cvsroot/gug/gug/gug/common/jsdl.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** jsdl.py 30 Apr 2007 20:21:51 -0000 1.10 --- jsdl.py 27 Sep 2007 10:36:03 -0000 1.11 *************** *** 159,160 **** --- 159,191 ---- return False, '' + + def get_staging_info(jsdl_doc): + stageins = {} + stageouts = {} + try: + jsdl = SimpleXML(memory = jsdl_doc) + except SimpleXMLError, error: + log.error('JSDL parse error (%s)' % nice_exception(error)) + return {} + #path= '/jsdl:JobDefinition/jsdl:JobDescription/jsdl:DataStaging' + nss = { 'jsdl' : "http://schemas.ggf.org/jsdl/2005/11/jsdl", \ + 'jsdl-posix' : "http://schemas.ggf.org/jsdl/2005/06/jsdl-posix", \ + 'jsdl-hpcpa' : 'http://schemas.ogf.org/jsdl/2006/07/jsdl-hpcpa',\ + 'jsdl-gug' : 'http://gug.grid.niif.hu/jsdl/2005/11/jsdl-gug' } + try: + staging = jsdl.get_dictionaries('//jsdl:DataStaging', nss = nss) + for stage in staging: + if stage.has_key('jsdl:FileName'): + if stage.has_key('jsdl:Source'): + stageins[stage['jsdl:FileName']] = \ + stage['jsdl:Source'] + if stage.has_key('jsdl:Target'): + stageouts[stage['jsdl:FileName']] = \ + stage['jsdl:Target'] + # XXX: more specified excpetion handling required + except Exception, error: + log.error() + stageins = {} + stageouts = {} + + return stageins, stageouts |