Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CastorScript
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
atlas-tdaq-software
CastorScript
Commits
057ee10f
Commit
057ee10f
authored
13 years ago
by
Wainer Vandelli
Browse files
Options
Downloads
Patches
Plain Diff
Used to be MergedMigrated.py
parent
0bde1322
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Script/MergedMigratedOld.py
+98
-0
98 additions, 0 deletions
Script/MergedMigratedOld.py
with
98 additions
and
0 deletions
Script/MergedMigratedOld.py
0 → 100644
+
98
−
0
View file @
057ee10f
#!/bin/env python
__version__
=
'
$Revision:$
'
# $Source$
from
SFOFileNameParser
import
SFOFileNameParser
import
os.path
import
sys
from
subprocess
import
*
BASEDIR
=
'
/castor/cern.ch/grid/atlas/tzero/prod1/perm/
'
def
nsls
(
target
,
castorenv
,
opts
=
[]):
command
=
[
'
nsls
'
]
command
.
extend
(
opts
)
command
.
append
(
target
)
kwds
=
{}
if
castorenv
:
kwds
[
'
env
'
]
=
castorenv
nsls
=
Popen
(
command
,
stdout
=
PIPE
,
stderr
=
STDOUT
,
**
kwds
)
nslsOut
,
_
=
nsls
.
communicate
()
ret
=
nsls
.
wait
()
return
((
ret
==
0
),
nslsOut
)
def
MergedMigrated
(
castorfile
,
castorenv
,
verbose
=
False
):
"""
Input file: /some_path/data09_cos.00122050.physics_IDCosmic.daq.RAW._lb0123._SFO-1._0001.data
Check fo migration of:
/<basedir>/<projecttag>/<streamtype_streamname>/<runnr-7digit>/<dataset>/<dataset>._lb<lbnr-4digit>._0001.<y>
basedir = /castor/cern.ch/grid/atlas/tzero/prod1/perm/
projecttag = data09_cos
dataset = data09_cos.00122050.physics_IDCosmic.merge.RAW
"""
parsed
=
SFOFileNameParser
(
os
.
path
.
basename
(
castorfile
))
dataset
=
'
%s.%s.%s_%s.merge.RAW
'
\
%
(
parsed
.
ProjectTag
(),
parsed
.
RunNr
(),
\
parsed
.
StreamType
(),
parsed
.
StreamName
())
### List the content of the path
path
=
os
.
path
.
join
(
BASEDIR
,
parsed
.
ProjectTag
(),
\
'
%s_%s
'
%
(
parsed
.
StreamType
(),
parsed
.
StreamName
()),
\
'
%07d
'
%
int
(
parsed
.
RunNr
()),
\
'
%s
'
%
dataset
)
if
verbose
:
print
path
### Look for files into the dataset dir
success
,
all_files
=
nsls
(
path
,
castorenv
)
## If fails, return false
if
not
success
:
return
False
files
=
[]
target_lb
=
int
(
parsed
.
LBNr
())
for
f
in
all_files
.
split
(
'
\n
'
):
if
not
f
:
continue
lbstring
=
f
.
split
(
'
.
'
,
6
)[
5
].
partition
(
'
_lb
'
)[
2
]
if
'
-
'
in
lbstring
:
#Multi LB file
minlb
,
maxlb
=
[
int
(
lb
)
for
lb
in
lbstring
.
split
(
'
-
'
)]
if
minlb
<=
target_lb
and
\
maxlb
>=
target_lb
:
files
.
append
(
f
)
else
:
#Single LB file
if
target_lb
==
int
(
lbstring
):
files
.
append
(
f
)
if
not
files
:
return
False
file
=
sorted
([(
int
(
f
.
rsplit
(
'
.
'
,
1
)[
1
]),
f
)
for
f
in
files
])[
-
1
][
1
]
#Check the migration status for the file
success
,
out
=
nsls
(
os
.
path
.
join
(
path
,
file
),
\
castorenv
,
opts
=
[
'
-l
'
])
if
success
and
'
m
'
in
out
.
split
(
'
'
)[
0
]:
return
True
else
:
return
False
if
__name__
==
'
__main__
'
:
print
MergedMigrated
(
sys
.
argv
[
1
],
''
,
verbose
=
True
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment