public static Workflow fromEntityId(WorkflowId workflowId) { return new Workflow(Id.Application.fromEntityId(workflowId.getParent()), workflowId.getProgram()); } }
public static Workflow fromEntityId(WorkflowId workflowId) { return new Workflow(Id.Application.fromEntityId(workflowId.getParent()), workflowId.getProgram()); } }
ApplicationSpecification appSpec = getApplicationSpec(metaStore, app); if (appSpec == null || appSpec.getWorkflows() == null || appSpec.getWorkflows().get(workflowId.getProgram()) == null) { LOG.warn("Missing ApplicationSpecification for {}, " + "potentially caused by application removal right after stopping workflow {}", app, workflowId); WorkflowSpecification workflowSpec = appSpec.getWorkflows().get(workflowId.getProgram()); Map<String, WorkflowNode> nodeIdMap = workflowSpec.getNodeIdMap(); List<WorkflowDataset.ProgramRun> programRunsList = new ArrayList<>();
ApplicationSpecification appSpec = getApplicationSpec(metaStore, app); if (appSpec == null || appSpec.getWorkflows() == null || appSpec.getWorkflows().get(workflowId.getProgram()) == null) { LOG.warn("Missing ApplicationSpecification for {}, " + "potentially caused by application removal right after stopping workflow {}", app, workflowId); WorkflowSpecification workflowSpec = appSpec.getWorkflows().get(workflowId.getProgram()); Map<String, WorkflowNode> nodeIdMap = workflowSpec.getNodeIdMap(); List<WorkflowDataset.ProgramRun> programRunsList = new ArrayList<>();
new WorkflowSpecification("DummyClass", SCHEDULED_PROG1_ID.getProgram(), "scheduled workflow", Collections.emptyMap(), Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap()); Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), ImmutableMap.of(SCHEDULED_PROG1_ID.getProgram(), scheduledWorfklow1), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()); new WorkflowSpecification("DummyClass", SCHEDULED_PROG2_ID.getProgram(), "scheduled workflow", Collections.emptyMap(), Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap()); Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), ImmutableMap.of(SCHEDULED_PROG2_ID.getProgram(), scheduledWorfklow2), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap());
private List<ScheduleDetail> doList(WorkflowId workflow) throws IOException, UnauthenticatedException, NotFoundException, UnauthorizedException { String path = String.format("apps/%s/workflows/%s/schedules", workflow.getApplication(), workflow.getProgram()); URL url = config.resolveNamespacedURLV3(workflow.getNamespaceId(), path); HttpResponse response = restClient.execute(HttpMethod.GET, url, config.getAccessToken(), HttpURLConnection.HTTP_NOT_FOUND); if (HttpURLConnection.HTTP_NOT_FOUND == response.getResponseCode()) { throw new NotFoundException(workflow); } ObjectResponse<List<ScheduleDetail>> objectResponse = ObjectResponse.fromJsonBody(response, LIST_SCHEDULE_DETAIL_TYPE, GSON); return objectResponse.getResponseObject(); }
private static MDSKey.Builder getRowKeyBuilder(WorkflowId id, long time) { return new MDSKey.Builder().add(id.getNamespace()) .add(id.getApplication()).add(id.getVersion()).add(id.getProgram()).add(time); } }
/** * Get the next scheduled run time of the program. A program may contain multiple schedules. * This method returns the next scheduled runtimes for all the schedules. This method only takes + into account schedules based on time. Schedules based on data are ignored. * * @param workflow Id of the Workflow for which to fetch next run times. * @return list of Scheduled runtimes for the Workflow. Empty list if there are no schedules. */ public List<ScheduledRuntime> nextRuntimes(WorkflowId workflow) throws IOException, UnauthenticatedException, NotFoundException, UnauthorizedException { String path = String.format("apps/%s/workflows/%s/nextruntime", workflow.getApplication(), workflow.getProgram()); URL url = config.resolveNamespacedURLV3(workflow.getNamespaceId(), path); HttpResponse response = restClient.execute(HttpMethod.GET, url, config.getAccessToken(), HttpURLConnection.HTTP_NOT_FOUND); if (HttpURLConnection.HTTP_NOT_FOUND == response.getResponseCode()) { throw new NotFoundException(workflow); } ObjectResponse<List<ScheduledRuntime>> objectResponse = ObjectResponse.fromJsonBody( response, new TypeToken<List<ScheduledRuntime>>() { }.getType(), GSON); return objectResponse.getResponseObject(); }
private static MDSKey.Builder getRowKeyBuilder(WorkflowId id, long time) { return new MDSKey.Builder().add(id.getNamespace()) .add(id.getApplication()).add(id.getVersion()).add(id.getProgram()).add(time); } }