Skip to content

Commit

Permalink
Merge pull request #802 from dynamic-entropy/crab_tape_recall_policy
Browse files Browse the repository at this point in the history
Add Analysis Tape Recall activity
  • Loading branch information
ericvaandering authored May 22, 2024
2 parents f3ca1eb + 7014e71 commit dc7badd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/policy/CMSRucioPolicy/algorithms/auto_approve.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ def global_approval(rule, did, session) -> bool:
:returns: True if the rule should be auto approved, False otherwise
"""

auto_approve_activity = 'User AutoApprove'
auto_approve_activities = ["User AutoApprove", "Analysis TapeRecall"]

# All checks are performed at rule creation
# The approval conditions are define in _check_for_auto_approve_eligibility function in the permissions module
# Check activity is User AutoApprove
# Analysis TapeRecall is also auto approved - This is used by CRAB to recall data from tape on behalf of the user
# The accounting is handled in crabserver

if rule['activity'] == auto_approve_activity:
if rule["activity"] in auto_approve_activities:
return True

return False
3 changes: 3 additions & 0 deletions src/policy/CMSRucioPolicy/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ def perm_add_rule(issuer, kwargs, *, session: "Optional[Session]" = None):
if kwargs["activity"] == "User AutoApprove":
return _check_for_auto_approve_eligibility(issuer, rses, kwargs, session=session)

if kwargs["activity"] == "Analysis TapeRecall" and issuer.external == "crab_tape_recall":
return True

# Anyone can use _Temp RSEs if a lifetime is set and under a month
all_temp = True
for rse in rses:
Expand Down
4 changes: 3 additions & 1 deletion src/policy/CMSRucioPolicy/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
"Production Input", "Production Output",
"Analysis Input", "Analysis Output", "Staging",
"T0 Export", "T0 Tape", "Upload/Download (Job)",
"Upload/Download (User)", "User AutoApprove", "User Subscriptions", "Data Challenge"]}
"Upload/Download (User)", "User AutoApprove",
"User Subscriptions", "Data Challenge", "Analysis TapeRecall"]}


SCOPE_LENGTH = 25

Expand Down

0 comments on commit dc7badd

Please sign in to comment.