use of com.hazelcast.jet.impl.JobSummary in project hazelcast by hazelcast.
the class SqlMetadataInJobConfigTest method test_selectMetadata_clientJobSummary.
@Test
public void test_selectMetadata_clientJobSummary() {
String sql = "SELECT * FROM table(generate_stream(1))";
try (SqlResult ignored = client().getSql().execute(new SqlStatement(sql).setCursorBufferSize(1))) {
List<JobSummary> jobSummaries = ((JetClientInstanceImpl) client().getJet()).getJobSummaryList().stream().filter(jobSummary -> jobSummary.getStatus() == RUNNING).collect(Collectors.toList());
assertEquals(1, jobSummaries.size());
JobSummary jobSummary = jobSummaries.get(0);
// TODO uncomment this when doing https://github.com/hazelcast/hazelcast/issues/20372
// assertNotNull(jobSummary.getSqlSummary());
// assertEquals(sql, jobSummary.getSqlSummary().getQuery());
// assertEquals(Boolean.TRUE, jobSummary.getSqlSummary().isUnbounded());
}
}
use of com.hazelcast.jet.impl.JobSummary in project hazelcast by hazelcast.
the class NonSmartClientTest method when_jobSummaryListIsAsked_then_jobSummaryListReturned.
@Test
public void when_jobSummaryListIsAsked_then_jobSummaryListReturned() {
// Given
Job job = startJobAndVerifyItIsRunning();
// When
List<JobSummary> summaryList = ((JetClientInstanceImpl) nonMasterClient.getJet()).getJobSummaryList();
// Then
assertNotNull(summaryList);
assertTrue(summaryList.stream().anyMatch(s -> s.getJobId() == job.getId()));
}
use of com.hazelcast.jet.impl.JobSummary in project hazelcast by hazelcast.
the class HazelcastCommandLine method listJobs.
@Command(name = "list-jobs", description = "Lists running jobs on the cluster")
public void listJobs(@Mixin(name = "verbosity") Verbosity verbosity, @Mixin(name = "targets") TargetsMixin targets, @Option(names = { "-a", "--all" }, description = "Lists all jobs including completed and failed ones") boolean listAll) {
runWithHazelcast(targets, verbosity, false, hz -> {
JetClientInstanceImpl jetClientInstanceImpl = (JetClientInstanceImpl) hz.getJet();
List<JobSummary> summaries = jetClientInstanceImpl.getJobSummaryList();
String format = "%-19s %-18s %-23s %s";
printf(format, "ID", "STATUS", "SUBMISSION TIME", "NAME");
summaries.stream().filter(job -> listAll || isActive(job.getStatus())).forEach(job -> {
String idString = idToString(job.getJobId());
String name = job.getName().equals(idString) ? "N/A" : job.getName();
printf(format, idString, job.getStatus(), toLocalDateTime(job.getSubmissionTime()), name);
});
});
}
Aggregations