Skip to content

Instantly share code, notes, and snippets.

@gadamc
Created June 4, 2011 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gadamc/1007651 to your computer and use it in GitHub Desktop.
Save gadamc/1007651 to your computer and use it in GitHub Desktop.
start jobs on cc GE cluster and use the database to get files that are ready for analysis
#!/usr/bin/env python
from couchdbkit import Server,Database
import os, subprocess, sys
def main():
datadir = '/sps/edelweis/kdata/data/current'
firstRun = 'le26a000'
lastRun = 'zz99z999'
detectorlist = ['FID802', 'FID804', 'FID803', 'FID806']
s = Server('http://edwdbik.fzk.de:5984')
db = s['edwdb']
vr = db.view('proc/tier1', startkey = firstRun, endkey = lastRun)
commandbase = 'qsub -P P_edelweis -o $HOME/analysis/tempVtime/qsubOut -e $HOME/analysis/tempVtime/qsubOut -l sps=1 $HOME/analysis/tempVtime/plotVtime.sh'
print commandbase
for row in vr:
doc = db.get(row['id'])
for bolo in detectorlist:
command = commandbase + ' ' + doc['tier0']['file'] + ' ' + bolo
print command
p = subprocess.Popen(command, shell=True, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
print p.communicate()[0]
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment