Skip to content

Commit

Permalink
Merge pull request #44 from XENONnT/create_rule_after_upload
Browse files Browse the repository at this point in the history
Now uploader can add a dataset rule also if all its files were already uploaded
  • Loading branch information
FaroutYLq authored Oct 30, 2023
2 parents 55a49b4 + 0ec561f commit e1d8ff6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions admix/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ def upload(path, rse,
db.update_data(number, data_dict)
try:
clients.upload_client.upload(to_upload)
if not get_rule(did,rse):
clients.rule_client.add_replication_rule(dids=[{'scope':scope,'name':name}],copies=1,rse_expression=rse)
except Exception as e:
if verbose:
print(f"Upload failed for {path}")
Expand All @@ -106,4 +104,15 @@ def upload(path, rse,
else:
print(f"Nothing to upload at {path}")

try:
if not get_rule(did,rse):
clients.rule_client.add_replication_rule(dids=[{'scope':scope,'name':name}],copies=1,rse_expression=rse)
print(f"Missing rule has been added")
except Exception as e:
if verbose:
print(f"Insertion of rule failed")
print(e)
return did


return did

0 comments on commit e1d8ff6

Please sign in to comment.