git-svn-id: http://svn.tuebingen.mpg.de/ag-raetsch/projects/QPalma@8634 e1793c9e...
[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 cmd = 'echo ./resurrect %s | qsub -l h_vmem=5.0G -cwd -j y -N \"%s.log\"'%(instance,instance)
40 #print cmd
41 os.system(cmd)
42
43 #os.system('echo "./resurrect %s >out_%s.log 2>err_%s.log &"'%(instance,instance,instance))
44
45
46 if __name__ == '__main__':
47 m = Model()
48 m.createInstances()
49 m.doSelection()