use of com.hazelcast.jet.Util.idToString in project hazelcast by hazelcast.
the class HazelcastCommandLine method listSnapshots.
@Command(name = "list-snapshots", description = "Lists exported snapshots on the cluster")
public void listSnapshots(@Mixin(name = "verbosity") Verbosity verbosity, @Mixin(name = "targets") TargetsMixin targets, @Option(names = { "-F", "--full-job-name" }, description = "Don't trim job name to fit, can break layout") boolean fullJobName) {
runWithHazelcast(targets, verbosity, false, hz -> {
Collection<JobStateSnapshot> snapshots = hz.getJet().getJobStateSnapshots();
printf("%-23s %-15s %-24s %s", "TIME", "SIZE (bytes)", "JOB NAME", "SNAPSHOT NAME");
snapshots.stream().sorted(Comparator.comparing(JobStateSnapshot::name)).forEach(ss -> {
LocalDateTime creationTime = toLocalDateTime(ss.creationTime());
String jobName = ss.jobName() == null ? Util.idToString(ss.jobId()) : ss.jobName();
if (!fullJobName) {
jobName = shorten(jobName);
}
printf("%-23s %-,15d %-24s %s", creationTime, ss.payloadSize(), jobName, ss.name());
});
});
}
Aggregations