[Streaming] fix streaming ci (#9675)

This commit is contained in:
chaokunyang
2020-09-08 22:20:58 +08:00
committed by GitHub
parent aa79542c77
commit 3645a05644
16 changed files with 177 additions and 75 deletions
@@ -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,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;