Page MenuHomec4science

updateRuns.py
No OneTemporary

File Metadata

Created
Tue, Nov 5, 07:50

updateRuns.py

#!/usr/bin/env python
import base
import job
import run
import os , sys, stat
import subprocess
import getopt
import socket
import bdparser
import runselector
import re
import shutil
parser = bdparser.BDParser()
parser.register_params(
group = "updateRuns",
params={
"runid":int,
"updates":[str]
},
defaults={
"machine_name":socket.gethostname()
},
help={
"runid": "The id of the run to update",
"updates": "The updates to perform. Syntax should be 'key = newval'"
}
)
params = parser.parseBDParameters()
base = base.Base(**params)
if ("runid" in params):
if "run_constraints" not in params:
params["run_constraints"] = []
params["run_constraints"].append("id = " + str(params["runid"]))
runSelector = runselector.RunSelector(base)
run_list = runSelector.selectRuns(params,params)
if (len(run_list) == 0):
print "No runs to be updated"
if (not "updates" in params):
print "No update to be performed: use --updates option"
sys.exit(-1)
for r,j in run_list:
r.setFields(params["updates"])
if (params["truerun"] == True):
r.update()
base.commit()

Event Timeline