##// END OF EJS Templates
Fix Read function for CLI 'schain xml'
George Yong -
r1184:d00a3ddd0dd0
parent child
Show More
@@ -275,7 +275,7 class ParameterConf():
275 275 parmElement.set('name', self.name)
276 276 parmElement.set('value', self.value)
277 277 parmElement.set('format', self.format)
278
278
279 279 def readXml(self, parmElement):
280 280
281 281 self.id = parmElement.get('id')
@@ -289,7 +289,7 class ParameterConf():
289 289
290 290 def printattr(self):
291 291
292 print('Parameter[%s]: name = %s, value = %s, format = %s' % (self.id, self.name, self.value, self.format))
292 print('Parameter[%s]: name = %s, value = %s, format = %s, project_id = %s' % (self.id, self.name, self.value, self.format, self.project_id))
293 293
294 294 class OperationConf():
295 295
@@ -422,12 +422,13 class OperationConf():
422 422 for parmConfObj in self.parmConfObjList:
423 423 parmConfObj.makeXml(opElement)
424 424
425 def readXml(self, opElement):
425 def readXml(self, opElement, project_id):
426 426
427 427 self.id = opElement.get('id')
428 428 self.name = opElement.get('name')
429 429 self.type = opElement.get('type')
430 430 self.priority = opElement.get('priority')
431 self.project_id = str(project_id) #yong
431 432
432 433 # Compatible with old signal chain version
433 434 # Use of 'run' method instead 'init'
@@ -453,11 +454,12 class OperationConf():
453 454
454 455 def printattr(self):
455 456
456 print('%s[%s]: name = %s, type = %s, priority = %s' % (self.ELEMENTNAME,
457 print('%s[%s]: name = %s, type = %s, priority = %s, project_id = %s' % (self.ELEMENTNAME,
457 458 self.id,
458 459 self.name,
459 460 self.type,
460 self.priority))
461 self.priority,
462 self.project_id))
461 463
462 464 for parmConfObj in self.parmConfObjList:
463 465 parmConfObj.printattr()
@@ -465,7 +467,7 class OperationConf():
465 467 def createObject(self):
466 468
467 469 className = eval(self.name)
468
470
469 471 if self.type == 'other':
470 472 opObj = className()
471 473 elif self.type == 'external':
@@ -634,12 +636,13 class ProcUnitConf():
634 636 for opConfObj in self.opConfObjList:
635 637 opConfObj.makeXml(procUnitElement)
636 638
637 def readXml(self, upElement):
639 def readXml(self, upElement, project_id):
638 640
639 641 self.id = upElement.get('id')
640 642 self.name = upElement.get('name')
641 643 self.datatype = upElement.get('datatype')
642 644 self.inputId = upElement.get('inputId')
645 self.project_id = str(project_id)
643 646
644 647 if self.ELEMENTNAME == 'ReadUnit':
645 648 self.datatype = self.datatype.replace('Reader', '')
@@ -656,16 +659,17 class ProcUnitConf():
656 659
657 660 for opElement in opElementList:
658 661 opConfObj = OperationConf()
659 opConfObj.readXml(opElement)
662 opConfObj.readXml(opElement, project_id)
660 663 self.opConfObjList.append(opConfObj)
661 664
662 665 def printattr(self):
663 666
664 print('%s[%s]: name = %s, datatype = %s, inputId = %s' % (self.ELEMENTNAME,
667 print('%s[%s]: name = %s, datatype = %s, inputId = %s, project_id = %s' % (self.ELEMENTNAME,
665 668 self.id,
666 669 self.name,
667 670 self.datatype,
668 self.inputId))
671 self.inputId,
672 self.project_id))
669 673
670 674 for opConfObj in self.opConfObjList:
671 675 opConfObj.printattr()
@@ -846,11 +850,12 class ReadUnitConf(ProcUnitConf):
846 850
847 851 return opObj
848 852
849 def readXml(self, upElement):
853 def readXml(self, upElement, project_id):
850 854
851 855 self.id = upElement.get('id')
852 856 self.name = upElement.get('name')
853 857 self.datatype = upElement.get('datatype')
858 self.project_id = str(project_id) #yong
854 859
855 860 if self.ELEMENTNAME == 'ReadUnit':
856 861 self.datatype = self.datatype.replace('Reader', '')
@@ -861,7 +866,7 class ReadUnitConf(ProcUnitConf):
861 866
862 867 for opElement in opElementList:
863 868 opConfObj = OperationConf()
864 opConfObj.readXml(opElement)
869 opConfObj.readXml(opElement, project_id)
865 870 self.opConfObjList.append(opConfObj)
866 871
867 872 if opConfObj.name == 'run':
@@ -1109,7 +1114,7 class Project(Process):
1109 1114
1110 1115 for readUnitElement in readUnitElementList:
1111 1116 readUnitConfObj = ReadUnitConf()
1112 readUnitConfObj.readXml(readUnitElement)
1117 readUnitConfObj.readXml(readUnitElement, self.id)
1113 1118 self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj
1114 1119
1115 1120 procUnitElementList = self.projectElement.iter(
@@ -1117,7 +1122,7 class Project(Process):
1117 1122
1118 1123 for procUnitElement in procUnitElementList:
1119 1124 procUnitConfObj = ProcUnitConf()
1120 procUnitConfObj.readXml(procUnitElement)
1125 procUnitConfObj.readXml(procUnitElement, self.id)
1121 1126 self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj
1122 1127
1123 1128 self.filename = abs_file
@@ -1126,9 +1131,10 class Project(Process):
1126 1131
1127 1132 def __str__(self):
1128 1133
1129 print('Project[%s]: name = %s, description = %s' % (self.id,
1134 print('Project[%s]: name = %s, description = %s, project_id = %s' % (self.id,
1130 1135 self.name,
1131 self.description))
1136 self.description,
1137 self.project_id))
1132 1138
1133 1139 for procUnitConfObj in self.procUnitConfObjDict.values():
1134 1140 print(procUnitConfObj)
General Comments 0
You need to be logged in to leave comments. Login now