Search in sources :

Example 1 with CommandContext

use of com.netflix.titus.cli.CommandContext in project titus-control-plane by Netflix.

the class JobGetCommand method subscribeToJobUpdateStream.

private void subscribeToJobUpdateStream(CommandContext context, String id) throws InterruptedException {
    CountDownLatch latch = new CountDownLatch(1);
    context.getJobManagementClient().observeJob(id).doFinally(signal -> latch.countDown()).subscribe(job -> logger.info("Job notification: {}", job), e -> logger.error("Command execution error", e));
    latch.await();
}
Also used : CommandContext(com.netflix.titus.cli.CommandContext) CountDownLatch(java.util.concurrent.CountDownLatch) CliCommand(com.netflix.titus.cli.CliCommand) Job(com.netflix.titus.api.jobmanager.model.job.Job) Logger(org.slf4j.Logger) Duration(java.time.Duration) Options(org.apache.commons.cli.Options) LoggerFactory(org.slf4j.LoggerFactory) CommandLine(org.apache.commons.cli.CommandLine) Option(org.apache.commons.cli.Option) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

Job (com.netflix.titus.api.jobmanager.model.job.Job)1 CliCommand (com.netflix.titus.cli.CliCommand)1 CommandContext (com.netflix.titus.cli.CommandContext)1 Duration (java.time.Duration)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 CommandLine (org.apache.commons.cli.CommandLine)1 Option (org.apache.commons.cli.Option)1 Options (org.apache.commons.cli.Options)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1