Skip to content

Commit

Permalink
Add idle_shutdown_timeout=5m flag
Browse files Browse the repository at this point in the history
  • Loading branch information
damondouglas committed Aug 23, 2024
1 parent 02c94dd commit 40813b3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
abstract class PrismExecutor {

private static final Logger LOG = LoggerFactory.getLogger(PrismExecutor.class);
static final String IDLE_SHUTDOWN_TIMEOUT = "-idle_shutdown_timeout=%s";
static final String JOB_PORT_FLAG_TEMPLATE = "-job_port=%s";
static final String SERVE_HTTP_FLAG_TEMPLATE = "-serve_http=%s";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,11 @@ public interface PrismPipelineOptions extends PortablePipelineOptions {
Boolean getEnableWebUI();

void setEnableWebUI(Boolean enableWebUI);

@Description(
"Duration, represented as a String, that prism will wait for a new job before shutting itself down. Negative durations disable auto shutdown. Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\".")
@Default.String("5m")
String getIdleShutdownTimeout();

void setIdleShutdownTimeout(String idleShutdownTimeout);
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,16 @@ PrismExecutor startPrism() throws IOException {
String serveHttpFlag =
String.format(
PrismExecutor.SERVE_HTTP_FLAG_TEMPLATE, prismPipelineOptions.getEnableWebUI());
String idleShutdownTimeoutFlag =
String.format(
PrismExecutor.IDLE_SHUTDOWN_TIMEOUT, prismPipelineOptions.getIdleShutdownTimeout());
String endpoint = "localhost:" + port;
prismPipelineOptions.setJobEndpoint(endpoint);
String command = locator.resolve();
PrismExecutor executor =
PrismExecutor.builder()
.setCommand(command)
.setArguments(Arrays.asList(portFlag, serveHttpFlag))
.setArguments(Arrays.asList(portFlag, serveHttpFlag, idleShutdownTimeoutFlag))
.build();
executor.execute();
checkState(executor.isAlive());
Expand Down

0 comments on commit 40813b3

Please sign in to comment.