/** * Render a table with information about a list of metrics * * @param list a list of metrics * @return the table to use for displaying the list of metrics */ protected Table displayMetrics(PagedResources<MetricResource> list) { LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", String.format("%s name", kind)); TableModel model = new BeanListTableModel<>(list, headers); return DataFlowTables.applyStyle(new TableBuilder(model)).build(); }
/** * Render a table with information about a list of metrics * * @param list a list of metrics * @return the table to use for displaying the list of metrics */ protected Table displayMetrics(PagedResources<MetricResource> list) { LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", String.format("%s name", kind)); TableModel model = new BeanListTableModel<>(list, headers); return DataFlowTables.applyStyle(new TableBuilder(model)).build(); }
@CliCommand(value = LIST_STREAM, help = "List created streams") public Table listStreams() { final PagedResources<StreamDefinitionResource> streams = streamOperations().list(); LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", "Stream Name"); headers.put("dslText", "Stream Definition"); headers.put("statusDescription", "Status"); BeanListTableModel<StreamDefinitionResource> model = new BeanListTableModel<>(streams, headers); return DataFlowTables.applyStyle(new TableBuilder(model)).build(); }
@CliCommand(value = STREAM_PLATFORM_LIST, help = "List Skipper platforms") public Table listPlatforms() { Collection<Deployer> platforms = streamOperations().listPlatforms(); LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", "Name"); headers.put("type", "Type"); headers.put("description", "Description"); BeanListTableModel<Deployer> model = new BeanListTableModel<>(platforms, headers); return DataFlowTables.applyStyle(new TableBuilder(model)).build(); }
@ShellMethod(key = "repo list", value = "List package repositories") public Table list() { Resources<Repository> repositoryResources = this.skipperClient.listRepositories(); LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", "Name"); headers.put("url", "URL"); headers.put("local", "Local"); headers.put("repoOrder", "Order"); TableModel model = new BeanListTableModel<>(repositoryResources.getContent(), headers); TableBuilder tableBuilder = new TableBuilder(model); return TableUtils.applyStyle(tableBuilder).build(); }
@ShellMethod(key = "platform list", value = "List platforms") public Table list() { Resources<Deployer> repositoryResources = this.skipperClient.listDeployers(); LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", "Name"); headers.put("type", "Type"); headers.put("description", "Description"); TableModel model = new BeanListTableModel<>(repositoryResources.getContent(), headers); TableBuilder tableBuilder = new TableBuilder(model); return TableUtils.applyStyle(tableBuilder).build(); }
@CliCommand(value = STREAM_SKIPPER_PLATFORM_LIST, help = "List Skipper platforms") public Table listPlatforms() { Collection<Deployer> platforms = streamOperations().listPlatforms(); LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", "Name"); headers.put("type", "Type"); headers.put("description", "Description"); BeanListTableModel<Deployer> model = new BeanListTableModel<>(platforms, headers); return DataFlowTables.applyStyle(new TableBuilder(model)).build(); }
@CliCommand(value = LIST_STREAM, help = "List created streams") public Table listStreams() { final PagedResources<StreamDefinitionResource> streams = streamOperations().list(); LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", "Stream Name"); headers.put("dslText", "Stream Definition"); headers.put("statusDescription", "Status"); BeanListTableModel<StreamDefinitionResource> model = new BeanListTableModel<>(streams, headers); return DataFlowTables.applyStyle(new TableBuilder(model)).build(); }
@CliCommand(value = LIST, help = "List created tasks") public Table list() { final PagedResources<TaskDefinitionResource> tasks = taskOperations().list(); LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", "Task Name"); headers.put("dslText", "Task Definition"); headers.put("status", "Task Status"); final TableBuilder builder = new TableBuilder(new BeanListTableModel<>(tasks, headers)); return DataFlowTables.applyStyle(builder).build(); }
private Table displayAggrCounter(AggregateCounterResource aggResource, final NumberFormat pattern) { LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("key", "TIME"); headers.put("value", "COUNT"); TableModel model = new BeanListTableModel<>(aggResource.getValues().entrySet(), headers); Table table = DataFlowTables.applyStyle(new TableBuilder(model)).on(CellMatchers.ofType(Long.class)) .addFormatter(value -> new String[] { pattern.format(value) }).addAligner(SimpleHorizontalAligner.right).build(); return table; }
private Table displayAggrCounter(AggregateCounterResource aggResource, final NumberFormat pattern) { LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("key", "TIME"); headers.put("value", "COUNT"); TableModel model = new BeanListTableModel<>(aggResource.getValues().entrySet(), headers); Table table = DataFlowTables.applyStyle(new TableBuilder(model)).on(CellMatchers.ofType(Long.class)) .addFormatter(value -> new String[] { pattern.format(value) }).addAligner(SimpleHorizontalAligner.right).build(); return table; }
@CliCommand(value = PLATFORM_LIST, help = "List platform accounts for tasks") public Table listPlatforms() { final PagedResources<LauncherResource> platforms = taskOperations().listPlatforms(); LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", "Platform Name"); headers.put("type", "Platform Type"); headers.put("description", "Description"); final TableBuilder builder = new TableBuilder(new BeanListTableModel<>(platforms, headers)); return DataFlowTables.applyStyle(builder).build(); }
@CliCommand(value = LIST, help = "List created tasks") public Table list() { final PagedResources<TaskDefinitionResource> tasks = taskOperations().list(); LinkedHashMap<String, Object> headers = new LinkedHashMap<>(); headers.put("name", "Task Name"); headers.put("dslText", "Task Definition"); headers.put("status", "Task Status"); final TableBuilder builder = new TableBuilder(new BeanListTableModel<>(tasks, headers)); return DataFlowTables.applyStyle(builder).build(); }
@CliCommand(value = TASK_EXECUTION_CURRENT, help = "Display count of currently executin tasks and related information") public Table currentExecutions() { CurrentTaskExecutionsResource taskExecutionsResource = taskOperations().currentTaskExecutions(); TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); modelBuilder.addRow().addValue("Current Running Tasks").addValue(taskExecutionsResource.getRunningExecutionCount()); modelBuilder.addRow().addValue("Maximum Concurrent Executions").addValue(taskExecutionsResource .getMaximumTaskExecutions()); TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); return builder.build(); }
@CliCommand(value = TASK_EXECUTION_CURRENT, help = "Display count of currently executin tasks and related information") public Table currentExecutions() { CurrentTaskExecutionsResource taskExecutionsResource = taskOperations().currentTaskExecutions(); TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); modelBuilder.addRow().addValue("Current Running Tasks").addValue(taskExecutionsResource.getRunningExecutionCount()); modelBuilder.addRow().addValue("Maximum Concurrent Executions").addValue(taskExecutionsResource .getMaximumTaskExecutions()); TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); return builder.build(); }
@CliCommand(value = STEP_EXECUTION_PROGRESS, help = "Display the details of a specific step progress") public Table stepProgressDisplay( @CliOption(key = { "id" }, help = "the step execution id", mandatory = true) long id, @CliOption(key = { "jobExecutionId" }, help = "the job execution id", mandatory = true) long jobExecutionId) { StepExecutionProgressInfoResource progressInfoResource = jobOperations().stepExecutionProgress(jobExecutionId, id); TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); modelBuilder.addRow().addValue("ID ").addValue("Step Name ").addValue("Complete ").addValue("Duration "); modelBuilder.addRow().addValue(progressInfoResource.getStepExecution().getId()) .addValue(progressInfoResource.getStepExecution().getStepName()) .addValue(progressInfoResource.getPercentageComplete() * 100 + "%") .addValue(progressInfoResource.getDuration() + " ms"); TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); return builder.build(); }
@CliCommand(value = STEP_EXECUTION_PROGRESS, help = "Display the details of a specific step progress") public Table stepProgressDisplay( @CliOption(key = { "id" }, help = "the step execution id", mandatory = true) long id, @CliOption(key = { "jobExecutionId" }, help = "the job execution id", mandatory = true) long jobExecutionId) { StepExecutionProgressInfoResource progressInfoResource = jobOperations().stepExecutionProgress(jobExecutionId, id); TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); modelBuilder.addRow().addValue("ID ").addValue("Step Name ").addValue("Complete ").addValue("Duration "); modelBuilder.addRow().addValue(progressInfoResource.getStepExecution().getId()) .addValue(progressInfoResource.getStepExecution().getStepName()) .addValue(progressInfoResource.getPercentageComplete() * 100 + "%") .addValue(progressInfoResource.getDuration() + " ms"); TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); return builder.build(); }
@CliCommand(value = INSTANCE_DISPLAY, help = "Display the job executions for a specific job instance.") public Table instanceDisplay(@CliOption(key = { "id" }, help = "the job instance id", mandatory = true) long id) { JobInstanceResource jobInstanceResource = jobOperations().jobInstance(id); TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); modelBuilder.addRow().addValue("Name ").addValue("Execution ID ").addValue("Step Execution Count ") .addValue("Status ").addValue("Job Parameters "); for (JobExecutionResource job : jobInstanceResource.getJobExecutions()) { modelBuilder.addRow().addValue(jobInstanceResource.getJobName()).addValue(job.getExecutionId()) .addValue(job.getStepExecutionCount()).addValue(job.getJobExecution().getStatus().name()) .addValue(job.getJobParametersString()); } TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); return builder.build(); }
@CliCommand(value = INSTANCE_DISPLAY, help = "Display the job executions for a specific job instance.") public Table instanceDisplay(@CliOption(key = { "id" }, help = "the job instance id", mandatory = true) long id) { JobInstanceResource jobInstanceResource = jobOperations().jobInstance(id); TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); modelBuilder.addRow().addValue("Name ").addValue("Execution ID ").addValue("Step Execution Count ") .addValue("Status ").addValue("Job Parameters "); for (JobExecutionResource job : jobInstanceResource.getJobExecutions()) { modelBuilder.addRow().addValue(jobInstanceResource.getJobName()).addValue(job.getExecutionId()) .addValue(job.getStepExecutionCount()).addValue(job.getJobExecution().getStatus().name()) .addValue(job.getJobParametersString()); } TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); return builder.build(); }
@CliCommand(value = STEP_EXECUTION_LIST, help = "List step executions filtered by jobExecutionId") public Table stepExecutionList(@CliOption(key = { "id" }, help = "the job execution id to be used as a filter", mandatory = true) long id) { final PagedResources<StepExecutionResource> steps = jobOperations().stepExecutionList(id); TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); modelBuilder.addRow().addValue("ID ").addValue("Step Name ").addValue("Job Exec Id ").addValue("Start Time ") .addValue("End Time ").addValue("Status "); for (StepExecutionResource step : steps) { modelBuilder.addRow().addValue(step.getStepExecution().getId()) .addValue(step.getStepExecution().getStepName()).addValue(id) .addValue(step.getStepExecution().getStartTime()).addValue(step.getStepExecution().getEndTime()) .addValue(step.getStepExecution().getStatus().name()); } TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); return builder.build(); }