Skip to content

Commit

Permalink
Merge pull request #575 from iExecBlockchainComputing/feature/clean-r…
Browse files Browse the repository at this point in the history
…equest-upload-failed

Clean unused `ReplicateStatus#RESULT_UPLOAD_REQUEST_FAILED`
  • Loading branch information
mcornaton authored May 5, 2023
2 parents 3c96d5c + 9fd5681 commit 97c5770
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ All notable changes to this project will be documented in this file.
### Quality
- Remove unused methods in `IexecHubService`. (#572)
- Clean unused Replicate methods and update tests. (#573)
- Clean unused `ReplicateStatus#RESULT_UPLOAD_REQUEST_FAILED`. (#575)
### Dependency Upgrades
- Upgrade to `iexec-common` 8.0.0. (#571)
- Add new `iexec-commons-poco` 1.0.2 dependency. (#571)
- Update `iexec-commons-poco` to 1.0.2-NEXT-SNAPSHOT. (#574)
- Upgrade to `iexec-common` 8.0.0-NEXT-SNAPSHOT. (#571 #575)
- Add new `iexec-commons-poco` 1.0.2-NEXT-SNAPSHOT dependency. (#571 #574)

## [[8.0.1]](https://github.com/iExecBlockchainComputing/iexec-core/releases/tag/v8.0.1) 2023-03-20

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.util.Optional;

import static com.iexec.common.replicate.ReplicateStatus.RESULT_UPLOAD_FAILED;
import static com.iexec.common.replicate.ReplicateStatus.RESULT_UPLOAD_REQUEST_FAILED;
import static com.iexec.common.utils.DateTimeUtils.addMinutesToDate;

@Slf4j
Expand Down Expand Up @@ -71,8 +70,7 @@ public void detect() {
Replicate uploadingReplicate = oUploadingReplicate.get();

boolean startedUploadLongAgo = new Date().after(addMinutesToDate(task.getLatestStatusChange().getDate(), 2));
boolean hasReplicateAlreadyFailedToUpload = uploadingReplicate.containsStatus(RESULT_UPLOAD_REQUEST_FAILED) ||
uploadingReplicate.containsStatus(RESULT_UPLOAD_FAILED);
boolean hasReplicateAlreadyFailedToUpload = uploadingReplicate.containsStatus(RESULT_UPLOAD_FAILED);

if (!startedUploadLongAgo) {
return;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/iexec/core/workflow/ReplicateWorkflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ private void setDefaultWorkflowTransitions() {
addTransition(REVEALED, toList(RESULT_UPLOAD_REQUESTED, COMPLETING));

// result upload
addTransition(RESULT_UPLOAD_REQUESTED, toList(RESULT_UPLOADING, RESULT_UPLOAD_REQUEST_FAILED));
addTransition(RESULT_UPLOAD_REQUEST_FAILED, toList(COMPLETING));
addTransition(RESULT_UPLOAD_REQUESTED, toList(RESULT_UPLOADING));
addTransition(RESULT_UPLOADING, toList(RESULT_UPLOADED, RESULT_UPLOAD_FAILED));
addTransition(RESULT_UPLOAD_FAILED, toList(COMPLETING));
addTransition(RESULT_UPLOADED, toList(COMPLETING));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void shouldNotDetectReplicatePreviouslyDetected() {
replicate.updateStatus(ReplicateStatus.COMPUTED, ReplicateStatusModifier.WORKER);

// we suppose that the status has already been set in a previous detect
replicate.updateStatus(ReplicateStatus.RESULT_UPLOAD_REQUEST_FAILED, ReplicateStatusModifier.POOL_MANAGER);
replicate.updateStatus(ReplicateStatus.RESULT_UPLOAD_FAILED, ReplicateStatusModifier.POOL_MANAGER);

TaskStatusChange change1 = new TaskStatusChange(fourMinutesAgo, TaskStatus.INITIALIZED);
TaskStatusChange change2 = new TaskStatusChange(threeMinutesAgo, TaskStatus.RUNNING);
Expand All @@ -152,6 +152,6 @@ void shouldNotDetectReplicatePreviouslyDetected() {
// trying to detect any timeout
timeoutDetector.detect();
Mockito.verify(replicatesService, Mockito.times(0))
.updateReplicateStatus(CHAIN_TASK_ID, WALLET_WORKER_1, RESULT_UPLOAD_REQUEST_FAILED);
.updateReplicateStatus(CHAIN_TASK_ID, WALLET_WORKER_1, RESULT_UPLOAD_FAILED);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ void workflowToJson() throws IOException {
expectedTransitions.put(CONTRIBUTED, List.of(REVEALING, FAILED, WORKER_LOST, RECOVERING, ABORTED));
expectedTransitions.put(REVEALING, List.of(REVEALED, REVEAL_FAILED, FAILED, WORKER_LOST, RECOVERING, ABORTED));
expectedTransitions.put(REVEALED, List.of(RESULT_UPLOAD_REQUESTED, COMPLETING, WORKER_LOST, RECOVERING, ABORTED));
expectedTransitions.put(RESULT_UPLOAD_REQUESTED, List.of(RESULT_UPLOADING, RESULT_UPLOAD_REQUEST_FAILED, WORKER_LOST, RECOVERING, ABORTED));
expectedTransitions.put(RESULT_UPLOAD_REQUEST_FAILED, List.of(COMPLETING, WORKER_LOST, RECOVERING, ABORTED));
expectedTransitions.put(RESULT_UPLOAD_REQUESTED, List.of(RESULT_UPLOADING, WORKER_LOST, RECOVERING, ABORTED));
expectedTransitions.put(RESULT_UPLOADING, List.of(RESULT_UPLOADED, RESULT_UPLOAD_FAILED, WORKER_LOST, RECOVERING, ABORTED));
expectedTransitions.put(RESULT_UPLOAD_FAILED, List.of(COMPLETING, WORKER_LOST, RECOVERING, ABORTED));
expectedTransitions.put(RESULT_UPLOADED, List.of(COMPLETING, WORKER_LOST, RECOVERING, ABORTED));
Expand All @@ -207,8 +206,8 @@ void workflowToJson() throws IOException {
expectedTransitions.put(CONTRIBUTE_FAILED, List.of(FAILED, WORKER_LOST, ABORTED));
expectedTransitions.put(REVEAL_FAILED, List.of(FAILED, WORKER_LOST, ABORTED));
expectedTransitions.put(ABORTED, List.of(FAILED, WORKER_LOST, COMPLETED, FAILED));
expectedTransitions.put(WORKER_LOST, List.of(FAILED, CREATED, STARTING, START_FAILED, STARTED, APP_DOWNLOADING, APP_DOWNLOAD_FAILED, APP_DOWNLOADED, DATA_DOWNLOADING, DATA_DOWNLOAD_FAILED, DATA_DOWNLOADED, COMPUTING, COMPUTE_FAILED, COMPUTED, CONTRIBUTING, CONTRIBUTE_FAILED, CONTRIBUTED, REVEALING, REVEAL_FAILED, REVEALED, RESULT_UPLOAD_REQUESTED, RESULT_UPLOAD_REQUEST_FAILED, RESULT_UPLOADING, RESULT_UPLOAD_FAILED, RESULT_UPLOADED, CONTRIBUTE_AND_FINALIZE_ONGOING, CONTRIBUTE_AND_FINALIZE_FAILED, CONTRIBUTE_AND_FINALIZE_DONE, COMPLETING, COMPLETE_FAILED, COMPLETED, FAILED, RECOVERING, ABORTED, RECOVERING, ABORTED, ABORTED));
expectedTransitions.put(RECOVERING, List.of(FAILED, WORKER_LOST, RECOVERING, START_FAILED, STARTED, APP_DOWNLOADING, APP_DOWNLOAD_FAILED, APP_DOWNLOADED, DATA_DOWNLOADING, DATA_DOWNLOAD_FAILED, DATA_DOWNLOADED, COMPUTING, COMPUTE_FAILED, COMPUTED, CONTRIBUTING, CONTRIBUTE_FAILED, CONTRIBUTED, REVEALING, REVEAL_FAILED, REVEALED, RESULT_UPLOAD_REQUESTED, RESULT_UPLOAD_REQUEST_FAILED, RESULT_UPLOADING, RESULT_UPLOAD_FAILED, RESULT_UPLOADED, CONTRIBUTE_AND_FINALIZE_ONGOING, CONTRIBUTE_AND_FINALIZE_FAILED, CONTRIBUTE_AND_FINALIZE_DONE, COMPLETING, COMPLETE_FAILED, COMPLETED, FAILED, ABORTED, RECOVERING, WORKER_LOST));
expectedTransitions.put(WORKER_LOST, List.of(FAILED, CREATED, STARTING, START_FAILED, STARTED, APP_DOWNLOADING, APP_DOWNLOAD_FAILED, APP_DOWNLOADED, DATA_DOWNLOADING, DATA_DOWNLOAD_FAILED, DATA_DOWNLOADED, COMPUTING, COMPUTE_FAILED, COMPUTED, CONTRIBUTING, CONTRIBUTE_FAILED, CONTRIBUTED, REVEALING, REVEAL_FAILED, REVEALED, RESULT_UPLOAD_REQUESTED, RESULT_UPLOADING, RESULT_UPLOAD_FAILED, RESULT_UPLOADED, CONTRIBUTE_AND_FINALIZE_ONGOING, CONTRIBUTE_AND_FINALIZE_FAILED, CONTRIBUTE_AND_FINALIZE_DONE, COMPLETING, COMPLETE_FAILED, COMPLETED, FAILED, RECOVERING, ABORTED, RECOVERING, ABORTED, ABORTED));
expectedTransitions.put(RECOVERING, List.of(FAILED, WORKER_LOST, RECOVERING, START_FAILED, STARTED, APP_DOWNLOADING, APP_DOWNLOAD_FAILED, APP_DOWNLOADED, DATA_DOWNLOADING, DATA_DOWNLOAD_FAILED, DATA_DOWNLOADED, COMPUTING, COMPUTE_FAILED, COMPUTED, CONTRIBUTING, CONTRIBUTE_FAILED, CONTRIBUTED, REVEALING, REVEAL_FAILED, REVEALED, RESULT_UPLOAD_REQUESTED, RESULT_UPLOADING, RESULT_UPLOAD_FAILED, RESULT_UPLOADED, CONTRIBUTE_AND_FINALIZE_ONGOING, CONTRIBUTE_AND_FINALIZE_FAILED, CONTRIBUTE_AND_FINALIZE_DONE, COMPLETING, COMPLETE_FAILED, COMPLETED, FAILED, ABORTED, RECOVERING, WORKER_LOST));
expectedTransitions.put(COMPLETE_FAILED, List.of(WORKER_LOST, ABORTED));

assertThat(actualTransitions).isEqualTo(expectedTransitions);
Expand Down

0 comments on commit 97c5770

Please sign in to comment.