Skip to content

Commit bad19a5

Browse files
authored
Merge pull request #552 from iExecBlockchainComputing/bugfix/miscellaneous-fixes
Bugfix/miscellaneous fixes
2 parents 81c898b + 3139edc commit bad19a5

File tree

11 files changed

+44
-37
lines changed

11 files changed

+44
-37
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
1818
- Fix log format in `LasService`. (#546)
1919
- Do not retry calls to fetch replicate from a scheduler, those calls are already scheduled. (#547)
2020
- Remove dead code in `IexecHubService`. (#550)
21+
- Remove `VersionService#isSnapshot`. (#552)
2122
### Dependency Upgrades
2223
- Upgrade to `iexec-common` 8.2.1-NEXT-SNAPSHOT. (#538)
2324
- Remove `logstash-gelf` dependency. (#540)
@@ -27,7 +28,7 @@ All notable changes to this project will be documented in this file.
2728
- Upgrade to `jenkins-library` 2.7.3. (#549)
2829
- Upgrade to `iexec-commons-poco` 3.1.0. (#551)
2930
- Upgrade to `iexec-common` 8.3.0. (#551)
30-
- Upgrade to `iexec-commons-containers` 1.1.0. (#551)
31+
- Upgrade to `iexec-commons-containers` 1.1.2. (#551 #552)
3132

3233
## [[8.1.4]](https://github.com/iExecBlockchainComputing/iexec-worker/releases/tag/v8.1.4) 2023-06-27
3334

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
version=8.1.4
22
iexecCommonVersion=8.3.0
3-
iexecCommonsContainersVersion=1.1.0
3+
iexecCommonsContainersVersion=1.1.2
44
iexecCommonsPocoVersion=3.1.0
55
iexecBlockchainAdapterVersion=8.1.1
66
iexecResultVersion=8.1.1
7-
iexecSmsVersion=8.1.1
7+
iexecSmsVersion=8.2.0-NEXT-SNAPSHOT
88

99
nexusUser
1010
nexusPassword

src/main/java/com/iexec/worker/PingService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -80,10 +80,10 @@ void pingScheduler() {
8080
try {
8181
sessionId = coreClient.ping(loginService.getToken());
8282
} catch (FeignException e) {
83+
log.warn("The worker cannot ping the core [status:{}]", e.status());
8384
if (e instanceof FeignException.Unauthorized) {
8485
loginService.login();
8586
}
86-
log.warn("The worker cannot ping the core [status:{}]", e.status());
8787
return;
8888
}
8989

src/main/java/com/iexec/worker/compute/ComputeController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2022-2023 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ public ComputeController(ComputeExitCauseService computeStageExitService,
4242
}
4343

4444
@PostMapping("/compute/{stage}/{chainTaskId}/exit")
45-
public ResponseEntity sendExitCauseForGivenComputeStage(
45+
public ResponseEntity<Void> sendExitCauseForGivenComputeStage(
4646
@PathVariable ComputeStage stage,
4747
@PathVariable String chainTaskId,
4848
@RequestBody ExitMessage exitMessage) {

src/main/java/com/iexec/worker/utils/AsyncUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,16 +16,17 @@
1616

1717
package com.iexec.worker.utils;
1818

19+
import lombok.AccessLevel;
20+
import lombok.NoArgsConstructor;
1921
import lombok.extern.slf4j.Slf4j;
2022

2123
import java.util.concurrent.CompletableFuture;
2224
import java.util.concurrent.Executor;
2325

2426
@Slf4j
27+
@NoArgsConstructor(access = AccessLevel.PRIVATE)
2528
public class AsyncUtils {
2629

27-
private AsyncUtils() {}
28-
2930
/**
3031
* The default {@link CompletableFuture#runAsync(Runnable)} fails silently when an exception
3132
* is thrown in the running thread. This wrapper method adds an exception handler that logs

src/main/java/com/iexec/worker/utils/ExecutorUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,15 +16,16 @@
1616

1717
package com.iexec.worker.utils;
1818

19+
import lombok.AccessLevel;
20+
import lombok.NoArgsConstructor;
1921
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
2022

2123
import java.util.concurrent.Executor;
2224
import java.util.concurrent.ThreadPoolExecutor.DiscardPolicy;
2325

26+
@NoArgsConstructor(access = AccessLevel.PRIVATE)
2427
public class ExecutorUtils {
2528

26-
private ExecutorUtils() {}
27-
2829
public static Executor
2930
newSingleThreadExecutorWithFixedSizeQueue(int queueSize, String threadNamePrefix) {
3031
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();

src/main/java/com/iexec/worker/utils/version/VersionService.java renamed to src/main/java/com/iexec/worker/version/VersionService.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,9 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.iexec.worker.utils.version;
17+
package com.iexec.worker.version;
1818

19-
import com.iexec.common.utils.VersionUtils;
2019
import org.springframework.boot.info.BuildProperties;
2120
import org.springframework.stereotype.Service;
2221

@@ -33,8 +32,4 @@ public String getVersion() {
3332
return buildProperties.getVersion();
3433
}
3534

36-
public boolean isSnapshot() {
37-
return VersionUtils.isSnapshot(buildProperties.getVersion());
38-
}
39-
4035
}

src/main/java/com/iexec/worker/worker/WorkerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import com.iexec.worker.feign.CustomCoreFeignClient;
2727
import com.iexec.worker.tee.scone.TeeSconeService;
2828
import com.iexec.worker.utils.LoggingUtils;
29-
import com.iexec.worker.utils.version.VersionService;
29+
import com.iexec.worker.version.VersionService;
3030
import lombok.extern.slf4j.Slf4j;
3131
import org.springframework.cloud.context.restart.RestartEndpoint;
3232
import org.springframework.context.annotation.Bean;

src/test/java/com/iexec/worker/tee/TeeServicesPropertiesServiceTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ class TeeServicesPropertiesServiceTests {
5454
private static final long POST_COMPUTE_HEAP_SIZE = 1024L;
5555
private static final String POST_COMPUTE_ENTRYPOINT = "postComputeEntrypoint";
5656
private static final GramineServicesProperties GRAMINE_PROPERTIES = new GramineServicesProperties(
57-
new TeeAppProperties(PRE_COMPUTE_IMAGE, "", PRE_COMPUTE_ENTRYPOINT, PRE_COMPUTE_HEAP_SIZE),
58-
new TeeAppProperties(POST_COMPUTE_IMAGE, "", POST_COMPUTE_ENTRYPOINT, POST_COMPUTE_HEAP_SIZE)
57+
TeeAppProperties.builder().image(PRE_COMPUTE_IMAGE).fingerprint("")
58+
.entrypoint(PRE_COMPUTE_ENTRYPOINT).heapSizeInBytes(PRE_COMPUTE_HEAP_SIZE).build(),
59+
TeeAppProperties.builder().image(POST_COMPUTE_IMAGE).fingerprint("")
60+
.entrypoint(POST_COMPUTE_ENTRYPOINT).heapSizeInBytes(POST_COMPUTE_HEAP_SIZE).build()
5961
);
6062

6163
@Mock

src/test/java/com/iexec/worker/utils/version/VersionServiceTests.java renamed to src/test/java/com/iexec/worker/version/VersionServiceTests.java

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
package com.iexec.worker.utils.version;
1+
/*
2+
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.iexec.worker.version;
218

319
import org.junit.jupiter.api.Assertions;
420
import org.junit.jupiter.api.BeforeEach;
5-
import org.junit.jupiter.api.Test;
621
import org.junit.jupiter.params.ParameterizedTest;
722
import org.junit.jupiter.params.provider.ValueSource;
823
import org.mockito.InjectMocks;
@@ -25,18 +40,10 @@ public void preflight() {
2540
}
2641

2742
@ParameterizedTest
28-
@ValueSource(strings={"x.y.z", "x.y.z-rc"})
29-
void testNonSnapshotVersion(String version) {
43+
@ValueSource(strings={"x.y.z", "x.y.z-rc", "x.y.z-NEXT-SNAPSHOT"})
44+
void testVersions(String version) {
3045
Mockito.when(buildProperties.getVersion()).thenReturn(version);
3146
Assertions.assertEquals(version, versionService.getVersion());
32-
Assertions.assertFalse(versionService.isSnapshot());
33-
}
34-
35-
@Test
36-
void testSnapshotVersion() {
37-
Mockito.when(buildProperties.getVersion()).thenReturn("x.y.z-NEXT-SNAPSHOT");
38-
Assertions.assertEquals("x.y.z-NEXT-SNAPSHOT", versionService.getVersion());
39-
Assertions.assertTrue(versionService.isSnapshot());
4047
}
4148

4249
}

0 commit comments

Comments
 (0)