@@ -32,6 +32,9 def multiSchain(child, nProcess=cpu_count(), startDate=None, endDate=None, recei | |||
|
32 | 32 | nFiles = None |
|
33 | 33 | processes = [] |
|
34 | 34 | |
|
35 | ||
|
36 | ||
|
37 | ||
|
35 | 38 | dt1 = datetime.datetime.strptime(startDate, '%Y/%m/%d') |
|
36 | 39 | dt2 = datetime.datetime.strptime(endDate, '%Y/%m/%d') |
|
37 | 40 | days = (dt2 - dt1).days |
@@ -47,29 +50,24 def multiSchain(child, nProcess=cpu_count(), startDate=None, endDate=None, recei | |||
|
47 | 50 | nFiles = q.get() |
|
48 | 51 | firstProcess.terminate() |
|
49 | 52 | skip = int(math.ceil(nFiles/nProcess)) |
|
50 |
|
|
|
51 | while True: | |
|
52 | processes.append(Process(target=child, args=(cursor, skip, q, dt))) | |
|
53 | processes[cursor].start() | |
|
54 | if nFiles < cursor*skip: | |
|
55 | break | |
|
56 | cursor += 1 | |
|
57 | except KeyboardInterrupt: | |
|
53 | while True: | |
|
54 | processes.append(Process(target=child, args=(cursor, skip, q, dt))) | |
|
55 | processes[cursor].start() | |
|
56 | if nFiles < cursor*skip: | |
|
57 | break | |
|
58 | cursor += 1 | |
|
59 | ||
|
60 | def beforeExit(exctype, value, trace): | |
|
58 | 61 | for process in processes: |
|
59 | 62 | process.terminate() |
|
60 | 63 | process.join() |
|
61 | for process in processes: | |
|
62 | process.join() | |
|
63 | # process.terminate() | |
|
64 | sleep(3) | |
|
64 | sys.excepthook = beforeExit | |
|
65 | 65 | |
|
66 | try: | |
|
67 | while True: | |
|
68 | pass | |
|
69 | except KeyboardInterrupt: | |
|
70 | 66 | for process in processes: |
|
71 | process.terminate() | |
|
72 | 67 | process.join() |
|
68 | process.terminate() | |
|
69 | ||
|
70 | ||
|
73 | 71 | |
|
74 | 72 | class ParameterConf(): |
|
75 | 73 | |
@@ -438,8 +436,8 class OperationConf(): | |||
|
438 | 436 | |
|
439 | 437 | def createObject(self, plotter_queue=None): |
|
440 | 438 | |
|
441 | ||
|
442 |
if self.type == 'self': |
|
|
439 | ||
|
440 | if self.type == 'self': | |
|
443 | 441 | raise ValueError, "This operation type cannot be created" |
|
444 | 442 | |
|
445 | 443 | if self.type == 'plotter': |
@@ -450,10 +448,10 class OperationConf(): | |||
|
450 | 448 | opObj = Plotter(self.name, plotter_queue) |
|
451 | 449 | |
|
452 | 450 | if self.type == 'external' or self.type == 'other': |
|
453 | ||
|
451 | ||
|
454 | 452 | className = eval(self.name) |
|
455 | 453 | kwargs = self.getKwargs() |
|
456 | ||
|
454 | ||
|
457 | 455 | opObj = className(**kwargs) |
|
458 | 456 | |
|
459 | 457 | return opObj |
@@ -672,18 +670,18 class ProcUnitConf(): | |||
|
672 | 670 | kwargs = self.getKwargs() |
|
673 | 671 | procUnitObj = className(**kwargs) |
|
674 | 672 | |
|
675 |
for opConfObj in self.opConfObjList: |
|
|
676 | ||
|
673 | for opConfObj in self.opConfObjList: | |
|
674 | ||
|
677 | 675 | if opConfObj.type=='self' and self.name=='run': |
|
678 | 676 | continue |
|
679 |
elif opConfObj.type=='self': |
|
|
677 | elif opConfObj.type=='self': | |
|
680 | 678 | procUnitObj.addOperationKwargs(opConfObj.id, **opConfObj.getKwargs()) |
|
681 | 679 | continue |
|
682 | 680 | |
|
683 | 681 | opObj = opConfObj.createObject(plotter_queue) |
|
684 | 682 | |
|
685 | 683 | self.opObjDict[opConfObj.id] = opObj |
|
686 | ||
|
684 | ||
|
687 | 685 | procUnitObj.addOperation(opObj, opConfObj.id) |
|
688 | 686 | |
|
689 | 687 | self.procUnitObj = procUnitObj |
@@ -1,1 +1,1 | |||
|
1 | <Project description="Segundo Test" id="191" name="test01"><ProcUnit datatype="ReceiverData" id="1911" inputId="0" name="ReceiverData"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="bool" id="191111" name="realtime" value="1" /><Parameter format="str" id="191112" name="plottypes" value="rti" /><Parameter format="str" id="191113" name="plot_server" value="tcp://10.10.10.82:7000" /></Operation></ProcUnit></Project> No newline at end of file | |
|
1 | <Project description="HF_EXAMPLE" id="191" name="test01"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/home/nanosat/data/hysell_data20/pdata" /><Parameter format="date" id="191113" name="startDate" value="2015/09/26" /><Parameter format="date" id="191114" name="endDate" value="2015/09/26" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="cursor" value="33" /><Parameter format="int" id="191119" name="skip" value="22" /><Parameter format="int" id="191120" name="delay" value="10" /><Parameter format="int" id="191121" name="walk" value="1" /><Parameter format="int" id="191122" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="Spectra" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="PublishData" priority="2" type="other"><Parameter format="int" id="191221" name="zeromq" value="1" /><Parameter format="int" id="191222" name="delay" value="1" /></Operation></ProcUnit></Project> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now