Skip to content

Commit

Permalink
Move ReplicateTaskSummary from iexec-common to iexec-core (#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbern0rd authored May 28, 2024
1 parent 1d854f1 commit 61fb218
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file.

- Configure Gradle JVM Test Suite Plugin. (#691)
- Rename `IexecTaskApiClient` to `TaskApiClient`. (#696)
- Move `ReplicateTaskSummary` from `iexec-common` to `iexec-core`. (#704)

### Dependency Upgrades

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2022-2023 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.iexec.core.replicate;

import com.iexec.commons.poco.chain.WorkerpoolAuthorization;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ReplicateTaskSummary {

private WorkerpoolAuthorization workerpoolAuthorization;
private String smsUrl;

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import com.iexec.common.replicate.ReplicateStatus;
import com.iexec.common.replicate.ReplicateStatusDetails;
import com.iexec.common.replicate.ReplicateStatusUpdate;
import com.iexec.common.replicate.ReplicateTaskSummary;
import com.iexec.common.replicate.ReplicateTaskSummary.ReplicateTaskSummaryBuilder;
import com.iexec.commons.poco.chain.WorkerpoolAuthorization;
import com.iexec.commons.poco.task.TaskAbortCause;
import com.iexec.core.chain.SignatureService;
Expand All @@ -31,6 +29,7 @@
import com.iexec.core.notification.TaskNotification;
import com.iexec.core.notification.TaskNotificationExtra;
import com.iexec.core.notification.TaskNotificationType;
import com.iexec.core.replicate.ReplicateTaskSummary.ReplicateTaskSummaryBuilder;
import com.iexec.core.task.Task;
import com.iexec.core.task.TaskService;
import com.iexec.core.task.TaskStatus;
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/com/iexec/core/replicate/ReplicatesController.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

package com.iexec.core.replicate;

import com.iexec.common.replicate.*;
import com.iexec.common.replicate.ReplicateStatusDetails;
import com.iexec.common.replicate.ReplicateStatusModifier;
import com.iexec.common.replicate.ReplicateStatusUpdate;
import com.iexec.core.chain.BlockchainConnectionHealthIndicator;
import com.iexec.core.notification.TaskNotification;
import com.iexec.core.notification.TaskNotificationType;
Expand Down Expand Up @@ -139,14 +141,10 @@ public ResponseEntity<TaskNotificationType> updateReplicateStatus(
statusUpdate.setModifier(ReplicateStatusModifier.WORKER);
statusUpdate.setDate(new Date());

// Assuming wallet address sent by the worker is correct
// would be a security issue. Let's replace it.
// Assuming wallet address sent by the worker is correct would be a security issue. Let's replace it.
final ReplicateStatusDetails details = statusUpdate.getDetails();
if (details != null) {
final ComputeLogs computeLogs = details.getComputeLogs();
if (computeLogs != null) {
computeLogs.setWalletAddress(walletAddress);
}
if (details != null && details.getComputeLogs() != null) {
details.getComputeLogs().setWalletAddress(walletAddress);
}

log.debug("Worker request to update a replicate status [workerAddress:{}, chainTaskId:{}, statusUpdate:{}]", walletAddress, chainTaskId, statusUpdate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.iexec.common.replicate.ReplicateStatus;
import com.iexec.common.replicate.ReplicateStatusModifier;
import com.iexec.common.replicate.ReplicateStatusUpdate;
import com.iexec.common.replicate.ReplicateTaskSummary;
import com.iexec.commons.poco.chain.WorkerpoolAuthorization;
import com.iexec.commons.poco.task.TaskAbortCause;
import com.iexec.commons.poco.tee.TeeUtils;
Expand Down

0 comments on commit 61fb218

Please sign in to comment.