private JsonObject formatJobPlan(ClusterJob job) throws IOException { JsonObject jobJson = new JsonObject(); jobJson.addProperty("id", job.getJobId()); jobJson.addProperty("clusterId", job.getClusterId()); jobJson.addProperty("action", job.getClusterAction().name()); jobJson.addProperty("currentStage", job.getCurrentStageNumber()); JsonArray stagesJson = new JsonArray(); for (Set<String> stage : job.getStagedTasks()) { JsonArray stageJson = new JsonArray(); for (String taskId : stage) { ClusterTask task = clusterStore.getClusterTask(TaskId.fromString(taskId)); JsonObject taskJson = new JsonObject(); taskJson.addProperty("id", task.getTaskId()); taskJson.addProperty("taskName", task.getTaskName().name()); taskJson.addProperty("nodeId", task.getNodeId()); taskJson.addProperty("service", task.getService()); stageJson.add(taskJson); } stagesJson.add(stageJson); } jobJson.add("stages", stagesJson); return jobJson; }
ClusterJob clusterJob = clusterStore.getClusterJob(jobId); if (!clusterJob.getClusterId().equals(clusterId)) { throw new IllegalArgumentException(String.format("Job %s does not belong to cluster %s", planId, clusterId));
try { ClusterJob job = clusterStore.getClusterJob(jobId); Cluster cluster = clusterStore.getCluster(job.getClusterId()); Set<Node> clusterNodes = clusterStore.getClusterNodes(job.getClusterId()); Map<String, Node> nodeMap = Maps.newHashMap(); for (Node node : clusterNodes) {
TaskConfig taskConfig = taskObject.getConfig(); String clusterId = clusterJob.getClusterId(); Map<String, Object> sensitiveFields = credentialStore.get(tenantId, clusterId); taskConfig.getProvider().addFields(sensitiveFields);