Skip to content

Commit

Permalink
follow review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryLitvintsev committed Dec 3, 2024
1 parent db4becc commit 31a99b2
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected BulkActivity(String name, TargetType targetType) {
retryPolicy = DEFAULT_RETRY_POLICY;
}

public void cancel(BulkRequestTarget target) {
public void cancel(String prefix, BulkRequestTarget target) {
target.cancel();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ public PinActivity(String name, TargetType targetType) {
super(name, targetType);
}

public void cancel(BulkRequestTarget target) {
super.cancel(target);
pinManager.send(unpinMessage(id, target.getAttributes().getPnfsId()));
public void cancel(String prefix, BulkRequestTarget target) {
super.cancel(prefix, target);
try {
pinManager.send(unpinMessage(id, prefix, target));
} catch (CacheException e) {
target.setErrorObject(new BulkServiceException("unable to fetch pnfsid of target in "
+ "order to cancel pinning.", e));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,14 @@ public StageActivity(String name, TargetType targetType) {
super(name, targetType);
}

public void cancel(BulkRequestTarget target) {
super.cancel(target);
pinManager.send(unpinMessage(id, target.getAttributes().getPnfsId()));
public void cancel(String prefix, BulkRequestTarget target) {
super.cancel(prefix, target);
try {
pinManager.send(unpinMessage(id, prefix, target));
} catch (CacheException e) {
target.setErrorObject(new BulkServiceException("unable to fetch pnfsid of target in "
+ "order to cancel staging.", e));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,32 @@ public UpdateQoSActivity(String name, TargetType targetType) {
}

@Override
public synchronized void cancel(BulkRequestTarget target) {
public synchronized void cancel(String prefix, BulkRequestTarget target) {
RemoteQoSRequirementsClient client = new RemoteQoSRequirementsClient();
client.setRequirementsService(qosEngine);
PnfsId pnfsId = target.getAttributes().getPnfsId();
PnfsId pnfsId = null;
if (target.getAttributes() == null) {
FsPath absolutePath = BulkRequestTarget.computeFsPath(prefix,
target.getPath().toString());
try {
pnfsId = pnfsHandler.getFileAttributes(absolutePath.toString(),
MINIMALLY_REQUIRED_ATTRIBUTES).getPnfsId();
} catch (CacheException e) {
LOGGER.error("fileQoSRequirementsModifiedCancelled failed: failed to fetch attributes for {} {}.",
target.getPath().toString(),
e.getMessage());
}
} else {
pnfsId = target.getAttributes().getPnfsId();
}
try {
client.fileQoSRequirementsModifiedCancelled(pnfsId, subject);
} catch (QoSException e) {
LOGGER.error("fileQoSRequirementsModifiedCancelled failed: {}, {}.", pnfsId,
e.getMessage());
}
responseReceiver.cancel(pnfsId.toString());
super.cancel(target);
super.cancel(prefix, target);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ void cancel() {
}

if (target != null) {
activity.cancel(target);
activity.cancel(targetPrefix, target);
LOGGER.debug("{} - target cancelled for task {}.", ruid, seqNo);
}

Expand Down

0 comments on commit 31a99b2

Please sign in to comment.