Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120434916
mvRuns.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
Fri, Jul 4, 08:50
Size
1 KB
Mime Type
text/x-python
Expires
Sun, Jul 6, 08:50 (2 d)
Engine
blob
Format
Raw Data
Handle
27188591
Attached To
R3127 blackdynamite
mvRuns.py
View Options
#!/usr/bin/env python
import
BlackDynamite
as
BD
import
os
,
sys
,
stat
import
subprocess
import
getopt
import
socket
import
datetime
################################################################
################################################################
parser
=
BD
.
BDParser
()
parser
.
register_params
(
group
=
"mvRuns"
,
params
=
{
"path"
:
str
},
mandatory
=
{
'path'
:
True
},
help
=
{
"path"
:
"Path to the local machine where to store the run outputs"
})
params
=
parser
.
parseBDParameters
()
mybase
=
BD
.
Base
(
**
params
)
runSelector
=
BD
.
RunSelector
(
mybase
)
run_list
=
runSelector
.
selectRuns
(
params
,
params
,
quiet
=
True
)
for
r
,
j
in
run_list
:
print
'mv run,job:'
,
r
.
id
,
j
.
id
url_src
=
r
[
'machine_name'
]
+
':'
+
r
[
'run_path'
]
if
url_src
[
-
1
]
==
'/'
:
url_src
=
url_src
[:
-
1
]
url_dest
=
params
[
'path'
]
rsync_command
=
'rsync --remove-source-files -auP {0} {1}'
.
format
(
url_src
,
url_dest
)
print
rsync_command
import
subprocess
,
socket
if
params
[
'truerun'
]
==
True
:
ret
=
subprocess
.
call
(
rsync_command
,
shell
=
True
)
else
:
ret
=
True
if
ret
:
continue
f
,
p
=
os
.
path
.
split
(
r
[
'run_path'
])
print
f
,
p
while
p
==
''
:
f
,
p
=
os
.
path
.
split
(
f
)
# print '"',f,'" "',p,'"'
r
[
'run_path'
]
=
os
.
path
.
join
(
url_dest
,
p
.
strip
())
r
[
'machine_name'
]
=
socket
.
gethostname
()
r
.
update
()
if
params
[
'truerun'
]
==
True
:
mybase
.
commit
()
Event Timeline
Log In to Comment