Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92214460
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
Mon, Nov 18, 09:48
Size
1 KB
Mime Type
text/x-python
Expires
Wed, Nov 20, 09:48 (2 d)
Engine
blob
Format
Raw Data
Handle
22396122
Attached To
R3127 blackdynamite
updateRuns.py
View Options
#!/usr/bin/env python
import
BlackDynamite
as
BD
import
os
,
sys
,
stat
import
socket
parser
=
BD
.
BDParser
()
parser
.
register_params
(
group
=
"updateRuns"
,
params
=
{
"run_id"
:
int
,
"updates"
:
[
str
]
},
defaults
=
{
"machine_name"
:
socket
.
gethostname
()
},
help
=
{
"run_id"
:
"The id of the run to update"
,
"updates"
:
"The updates to perform. Syntax should be 'key = newval'"
}
)
params
=
parser
.
parseBDParameters
()
if
not
"user"
in
params
.
keys
():
params
[
"user"
]
=
os
.
getlogin
()
base
=
BD
.
Base
(
**
params
)
if
(
"runid"
in
params
):
if
"run_constraints"
not
in
params
:
params
[
"run_constraints"
]
=
[]
params
[
"run_constraints"
]
.
append
(
"id = "
+
str
(
params
[
"runid"
]))
runSelector
=
BD
.
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