Skip to content

Commit 64299bb

Browse files
author
Laurent Gougeon
committed
Fixed the issue with the manual re-queing of a failed file.
1 parent 240ad2b commit 64299bb

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

src/main/java/ecmwf/ecpds/master/transfer/TransferScheduler.java

+32-33
Original file line numberDiff line numberDiff line change
@@ -3314,6 +3314,7 @@ public int nextStep() {
33143314
final var acquisition = isAcquisition(_currentTransfer);
33153315
final var currentTime = System.currentTimeMillis();
33163316
final var expiryTime = _currentTransfer.getExpiryTime().getTime();
3317+
final var currentStatus = _currentTransfer.getUserStatus();
33173318
if (!StatusFactory.EXEC.equals(status) && expiryTime < currentTime) {
33183319
_log.info("Stopping DataTransfer " + _currentTransfer.getId() + " (expired)");
33193320
_currentTransfer.setStatusCode(StatusFactory.FAIL);
@@ -3325,38 +3326,31 @@ public int nextStep() {
33253326
return NEXT_STEP_CONTINUE;
33263327
}
33273328
if (StatusFactory.RETR.equals(status) && acquisition) {
3328-
final var currentStatus = _currentTransfer.getUserStatus();
3329-
if (isNotEmpty(currentStatus)) {
3330-
// The retry was triggered by a user action (e.g. requeue)
3331-
// Make sure it will not be triggered again unless the file
3332-
// is already on the data movers!
3333-
_currentTransfer.setUserStatus(null);
3334-
} else // Was this file already downloaded by the
3335-
// DownloadScheduler?
3336-
if (!_currentTransfer.getDataFile().getDownloaded()) {
3337-
// The file was not downloaded so the source acquisition
3338-
// Host was configured to not retrieve the file on the
3339-
// data movers.
3340-
final Host host = getHost();
3341-
if (host == null || !HOST_ACQUISITION.getECtransSetup(host.getData())
3342-
.getBoolean(HOST_ACQUISITION_REQUEUE_ON_FAILURE)) {
3343-
// In this case we don't want to restart
3344-
// the transmission as it should be forced only by a
3345-
// re-queue from the acquisition Destination!
3346-
_log.info("Cancelling retry for DataTransfer " + _currentTransfer.getId()
3347-
+ " (not found on remote site)");
3348-
_currentTransfer.setStatusCode(StatusFactory.FAIL);
3349-
// The original error was already set in the comment in
3350-
// the last history message!
3351-
_currentTransfer.setComment(
3352-
"No automatic retry (manual requeue or rediscovery from Acquisition Scheduler required)");
3353-
_currentTransfer.setFinishTime(new Timestamp(System.currentTimeMillis()));
3354-
MASTER.addTransferHistory(_currentTransfer);
3355-
_setLastFailedTransfer(_currentTransfer);
3356-
_update(_currentTransfer, true);
3357-
return NEXT_STEP_CONTINUE;
3358-
}
3359-
}
3329+
// Was this file already downloaded by the DownloadScheduler?
3330+
if (!isNotEmpty(currentStatus) && !_currentTransfer.getDataFile().getDownloaded()) {
3331+
// The file was not downloaded so the source acquisition
3332+
// Host was configured to not retrieve the file on the
3333+
// data movers.
3334+
final Host host = getHost();
3335+
if (host == null || !HOST_ACQUISITION.getECtransSetup(host.getData())
3336+
.getBoolean(HOST_ACQUISITION_REQUEUE_ON_FAILURE)) {
3337+
// In this case we don't want to restart
3338+
// the transmission as it should be forced only by a
3339+
// re-queue from the acquisition Destination!
3340+
_log.info("Cancelling retry for DataTransfer " + _currentTransfer.getId()
3341+
+ " (not found on remote site)");
3342+
_currentTransfer.setStatusCode(StatusFactory.FAIL);
3343+
// The original error was already set in the comment in
3344+
// the last history message!
3345+
_currentTransfer.setComment(
3346+
"No automatic retry (manual requeue or rediscovery from Acquisition Scheduler required)");
3347+
_currentTransfer.setFinishTime(new Timestamp(System.currentTimeMillis()));
3348+
MASTER.addTransferHistory(_currentTransfer);
3349+
_setLastFailedTransfer(_currentTransfer);
3350+
_update(_currentTransfer, true);
3351+
return NEXT_STEP_CONTINUE;
3352+
}
3353+
}
33603354
}
33613355
final var maxStart = _destination.getMaxStart();
33623356
final var queueTime = _currentTransfer.getQueueTime().getTime();
@@ -3405,10 +3399,15 @@ public int nextStep() {
34053399
var retry = false;
34063400
if (StatusFactory.RETR.equals(_currentTransfer.getStatusCode())) {
34073401
_destinationStep = DestinationStep.DESTINATION_STEP_PROCESS_RETR;
3408-
_log.info("Retrying DataTransfer " + _currentTransfer.getId());
34093402
if ((_currentTransfer.getHost() != null) && (!_provider.next(_currentTransfer) || !isRunning())) {
34103403
return NEXT_STEP_CONTINUE;
34113404
}
3405+
_log.info("Retrying DataTransfer " + _currentTransfer.getId());
3406+
if (isNotEmpty(currentStatus) && acquisition)
3407+
// The retry was triggered by a user action (e.g. re-queue)
3408+
// Make sure it will not be triggered again unless the file
3409+
// is already on the data movers!
3410+
_currentTransfer.setUserStatus(null);
34123411
_currentTransfer.setStatusCode(StatusFactory.WAIT);
34133412
_currentTransfer.setFinishTime(null);
34143413
_currentTransfer.setComment(null);

0 commit comments

Comments
 (0)