Skip to content

Commit

Permalink
Use list_content to get parents
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-McNab-UK committed May 15, 2024
1 parent 74b54a0 commit a95f2c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
32 changes: 16 additions & 16 deletions commands/justin-rucio-upload
Original file line number Diff line number Diff line change
Expand Up @@ -161,34 +161,34 @@ if not reps or 'pfns' not in reps or not reps['pfns']:
print('--- No replica in Rucio, exit 98')
sys.exit(98)

# Check the file is in the given dataset
# Check the given file is in the parent dataset
for i in range(1, tries + 1):
print('--- Dataset check try %d/%d' % (i, tries))
try:
didClient = rucio.client.didclient.DIDClient()

parentGen = didClient.list_parent_dids(args['scope'], filename)
contentGen = didClient.list_content(args['scope'], args['dataset'])
break
except Exception as e:
parentGen = None
print('--- Rucio list_parent_dids call %d/%d fails: %s' %
contentGen = None
print('--- Rucio list_content call %d/%d fails: %s' %
(i, tries, str(e)))

if not parentGen:
# No parents returned!
print('--- File not found in any dataset, exit 97')
if not contentGen:
# No content DIDs returned!
print('--- No files in dataset, exit 97')
sys.exit(97)

# Try to find the given dataset in the parents
for parent in parentGen:
if ('scope' in parent and
'name' in parent and
parent['scope'] == args['scope'] and
parent['name'] == args['dataset']):
# Found the given dataset as a parent
# Try to find the given file in the dataset
for content in contentGen:
if ('scope' in content and
'name' in content and
content['scope'] == args['scope'] and
content['name'] == filename):
# Found the given filename in the dataset
print('--- Upload, replicas, and dataset checks passed')
sys.exit(0)

# We didn't find the given dataset as a parent of the uploaded file!
print('--- Did not find the dataset as a parent, exit 96')
# We didn't find the given file in the parent dataset!
print('--- Did not find the file in the parent dataset, exit 96')
sys.exit(96)
4 changes: 3 additions & 1 deletion dashboard/justin-wsgi-dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -4283,7 +4283,9 @@ def awtResults(environ, user, cgiValues):
# List of storages
output += ('<tr><td> </td>\n'
'<td><div style="writing-mode: vertical-lr">'
'Last&nbsp;AWT&nbsp;job</div></td>')
'Last&nbsp;AWT&nbsp;job</div></td>'
'<td><div style="writing-mode: vertical-lr">'
'Last&nbsp;OSG&nbsp;time</div></td>')

for rseName in rseNames:
if rseName in outputRseNames:
Expand Down

0 comments on commit a95f2c6

Please sign in to comment.