Skip to content

Commit

Permalink
YDA-5311: catch microservice errors when trying to set ACLs for repli…
Browse files Browse the repository at this point in the history
…cation or revision
  • Loading branch information
lwesterhof committed Oct 12, 2023
1 parent 409cbab commit 719377c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def replicate_asynchronously(ctx, path, source_resource, target_resource):
"""
zone = user.zone(ctx)

# Give rods 'own' access so that they can remove the AVU.
msi.set_acl(ctx, "default", "own", "rods#{}".format(zone), path)

# Mark data object for batch replication by setting 'org_replication_scheduled' metadata.
try:
# Add random id for replication balancing purposes
# Give rods 'own' access so that they can remove the AVU.
msi.set_acl(ctx, "default", "own", "rods#{}".format(zone), path)

# Add random identifier for replication balancing purposes.
msi.add_avu(ctx, '-d', path, constants.UUORGMETADATAPREFIX + "replication_scheduled", "{},{},{}".format(source_resource, target_resource, random.randint(1, 64)), "")
except msi.Error as e:
# iRods error for CAT_UNKNOWN_FILE can be ignored
# iRODS error for CAT_UNKNOWN_FILE can be ignored.
if str(e).find("-817000") == -1:
error_status = re.search("status \[(.*?)\]", str(e))
log.write(ctx, "Schedule replication of data object {} failed with error {}".format(path, error_status.group(1)))
Expand Down
10 changes: 5 additions & 5 deletions revisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ def resource_modified_post_revision(ctx, resource, zone, path):
# Only create revisions for research space
if path.startswith("/{}/home/{}".format(zone, constants.IIGROUPPREFIX)):
if not pathutil.basename(path) in constants.UUBLOCKLIST:
# Give rods 'own' access so that they can remove the AVU.
msi.set_acl(ctx, "default", "own", "rods#{}".format(zone), path)

# Mark data object for batch revision by setting 'org_revision_scheduled' metadata.
try:
# Add random id for revision balancing purposes
# Give rods 'own' access so that they can remove the AVU.
msi.set_acl(ctx, "default", "own", "rods#{}".format(zone), path)

# Add random identifier for revision balancing purposes.
msi.add_avu(ctx, '-d', path, constants.UUORGMETADATAPREFIX + "revision_scheduled", resource + ',' + str(random.randint(1, 64)), "")
except msi.Error as e:
# iRods error for CAT_UNKNOWN_FILE can be ignored
# iRODS error for CAT_UNKNOWN_FILE can be ignored.
if str(e).find("-817000") == -1:
error_status = re.search("status \[(.*?)\]", str(e))
log.write(ctx, "Schedule revision of data object {} failed with error {}".format(path, error_status.group(1)))
Expand Down

0 comments on commit 719377c

Please sign in to comment.