mirror of
https://github.com/wassname/ray.git
synced 2026-07-07 17:49:12 +08:00
[Streaming] fix streaming ci (#9675)
This commit is contained in:
+23
@@ -5,6 +5,8 @@ import io.ray.runtime.util.JniUtils;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -37,4 +39,25 @@ public class EnvUtil {
|
||||
JniUtils.loadLibrary("streaming_java");
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute an external command.
|
||||
*
|
||||
* @return Whether the command succeeded.
|
||||
*/
|
||||
public static boolean executeCommand(List<String> command, int waitTimeoutSeconds) {
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command)
|
||||
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
||||
.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||
Process process = processBuilder.start();
|
||||
boolean exit = process.waitFor(waitTimeoutSeconds, TimeUnit.SECONDS);
|
||||
if (!exit) {
|
||||
process.destroyForcibly();
|
||||
}
|
||||
return process.exitValue() == 0;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Error executing command " + String.join(" ", command), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-1
@@ -1,7 +1,6 @@
|
||||
package io.ray.streaming.runtime.util;
|
||||
|
||||
import com.sun.management.OperatingSystemMXBean;
|
||||
import io.ray.api.id.UniqueId;
|
||||
import io.ray.streaming.runtime.core.resource.Container;
|
||||
import io.ray.streaming.runtime.core.resource.ContainerId;
|
||||
import java.io.BufferedInputStream;
|
||||
|
||||
Reference in New Issue
Block a user