Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90848343
updateRuns.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Nov 5, 07:50
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Nov 7, 07:50 (2 d)
Engine
blob
Format
Raw Data
Handle
22145887
Attached To
R3127 blackdynamite
updateRuns.py
View Options
#!/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
Log In to Comment