+ refactored code further
[qpalma.git] / scripts / ModelSelection.py
1 #!/usr/bin/env python
2 # -*- coding:latin-1 -*-
3
4 import cPickle
5 import os
6 import os.path
7 import time
8
9 from qpalma_main import QPalma
10 import Experiment as Exp
11
12 class Model:
13
14 allInstances = []
15
16 def __init__(self):
17 pass
18
19 def createInstances(self):
20
21 allRuns = Exp.createRuns()
22
23 for currentRun in allRuns:
24
25 currentInstance = QPalma(currentRun)
26
27 #print 'instance created, starting to pickle configuration...'
28 name = currentRun['name']
29 instance_fn = '%s.pickle'%name
30 fh = open(instance_fn,'w+')
31 cPickle.dump(currentInstance,fh)
32 fh.close()
33
34 self.allInstances.append(instance_fn)
35
36 def doSelection(self):
37 for instance in self.allInstances:
38 time.sleep(2)
39 os.system('echo ./resurrect %s | qsub -l h_vmem=3.0G -cwd -j y -N \"%s.log\"'%(instance,instance))
40 #os.system('echo "./resurrect %s >out_%s.log 2>err_%s.log &"'%(instance,instance,instance))
41
42
43 if __name__ == '__main__':
44 m = Model()
45 m.createInstances()
46 m.doSelection()