Search in sources :

Example 1 with Util.idToString

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());
        });
    });
}
Also used : Util.toLocalDateTime(com.hazelcast.jet.impl.util.Util.toLocalDateTime) LocalDateTime(java.time.LocalDateTime) JobStateSnapshot(com.hazelcast.jet.JobStateSnapshot) Util.idToString(com.hazelcast.jet.Util.idToString) HelpCommand(picocli.CommandLine.HelpCommand) Command(picocli.CommandLine.Command)

Aggregations

JobStateSnapshot (com.hazelcast.jet.JobStateSnapshot)1 Util.idToString (com.hazelcast.jet.Util.idToString)1 Util.toLocalDateTime (com.hazelcast.jet.impl.util.Util.toLocalDateTime)1 LocalDateTime (java.time.LocalDateTime)1 Command (picocli.CommandLine.Command)1 HelpCommand (picocli.CommandLine.HelpCommand)1