mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
[Java] Fix some potential bugs about Ray.shutdown()
(#5693)
This commit is contained in:
parent
a4659a8f8b
commit
c580955840
5 changed files with 18 additions and 3 deletions
|
@ -33,6 +33,10 @@ public class RayDevRuntime extends AbstractRayRuntime {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
|
if (taskSubmitter != null) {
|
||||||
|
((LocalModeTaskSubmitter) taskSubmitter).shutdown();
|
||||||
|
taskSubmitter = null;
|
||||||
|
}
|
||||||
taskExecutor = null;
|
taskExecutor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,7 @@ public final class RayNativeRuntime extends AbstractRayRuntime {
|
||||||
}
|
}
|
||||||
if (null != manager) {
|
if (null != manager) {
|
||||||
manager.cleanup();
|
manager.cleanup();
|
||||||
|
manager = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,10 @@ public class LocalModeTaskSubmitter implements TaskSubmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
exec.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
public static ActorId getActorId(TaskSpec taskSpec) {
|
public static ActorId getActorId(TaskSpec taskSpec) {
|
||||||
ByteString actorId = null;
|
ByteString actorId = null;
|
||||||
if (taskSpec.getType() == TaskType.ACTOR_CREATION_TASK) {
|
if (taskSpec.getType() == TaskType.ACTOR_CREATION_TASK) {
|
||||||
|
|
|
@ -45,13 +45,17 @@ public abstract class BaseMultiLanguageTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass(alwaysRun = true)
|
private void checkMultiLanguageTestFlag() {
|
||||||
public void setUp() {
|
|
||||||
if (!"1".equals(System.getenv("ENABLE_MULTI_LANGUAGE_TESTS"))) {
|
if (!"1".equals(System.getenv("ENABLE_MULTI_LANGUAGE_TESTS"))) {
|
||||||
LOGGER.info("Skip Multi-language tests because environment variable "
|
LOGGER.info("Skip Multi-language tests because environment variable "
|
||||||
+ "ENABLE_MULTI_LANGUAGE_TESTS isn't set");
|
+ "ENABLE_MULTI_LANGUAGE_TESTS isn't set");
|
||||||
throw new SkipException("Skip test.");
|
throw new SkipException("Skip test.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeClass(alwaysRun = true)
|
||||||
|
public void setUp() {
|
||||||
|
checkMultiLanguageTestFlag();
|
||||||
|
|
||||||
// Delete existing socket files.
|
// Delete existing socket files.
|
||||||
for (String socket : ImmutableList.of(RAYLET_SOCKET_NAME, PLASMA_STORE_SOCKET_NAME)) {
|
for (String socket : ImmutableList.of(RAYLET_SOCKET_NAME, PLASMA_STORE_SOCKET_NAME)) {
|
||||||
|
@ -102,6 +106,8 @@ public abstract class BaseMultiLanguageTest {
|
||||||
|
|
||||||
@AfterClass(alwaysRun = true)
|
@AfterClass(alwaysRun = true)
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
|
checkMultiLanguageTestFlag();
|
||||||
|
|
||||||
// Disconnect to the cluster.
|
// Disconnect to the cluster.
|
||||||
Ray.shutdown();
|
Ray.shutdown();
|
||||||
System.clearProperty("ray.redis.address");
|
System.clearProperty("ray.redis.address");
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class BaseTest {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(BaseTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(BaseTest.class);
|
||||||
|
|
||||||
private List<File> filesToDelete;
|
private List<File> filesToDelete = ImmutableList.of();
|
||||||
|
|
||||||
@BeforeMethod(alwaysRun = true)
|
@BeforeMethod(alwaysRun = true)
|
||||||
public void setUpBase(Method method) {
|
public void setUpBase(Method method) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue