/** * Creates a {@link ProgramId} with no program name. This allows matching * for all datasets associated with an Application as opposed to a single program. */ public static ProgramId getProgramId(ApplicationId applicationId) { // Use empty programId to denote applicationId return applicationId.flow(""); }
@Override public Void call() throws Exception { String namespace = String.format("%s.%s", programId.getApplication(), programId.getProgram()); NamespaceId namespaceId = programId.getNamespaceId(); for (Map.Entry<String, Collection<Long>> entry : streamGroups.asMap().entrySet()) { streamConsumerFactory.dropAll(namespaceId.stream(entry.getKey()), namespace, entry.getValue()); } queueAdmin.dropAllForFlow(programId.getParent().flow(programId.getEntityName())); return null; } });
/** * Returns number of instances for a flowlet within a flow. */ @GET @Path("/apps/{app-id}/flows/{flow-id}/flowlets/{flowlet-id}/instances") public void getFlowletInstances(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("flow-id") String flowId, @PathParam("flowlet-id") String flowletId) throws Exception { try { ProgramId flow = validateAndGetNamespace(namespaceId).app(appId).flow(flowId); if (!lifecycleService.programExists(flow)) { throw new NotFoundException(flow); } int count = store.getFlowletInstances(flow, flowletId); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(new Instances(count))); } catch (SecurityException e) { responder.sendStatus(HttpResponseStatus.UNAUTHORIZED); } catch (Throwable e) { if (respondIfElementNotFound(e, responder)) { return; } throw e; } }
FlowletId flowlet = appId.flow(flowId).flowlet(flowletName); instances = programClient.getFlowletInstances(flowlet); break;
FlowletId flowletId = appId.flow(flowId).flowlet(flowletName); programClient.setFlowletInstances(flowletId, numInstances); output.printf("Successfully set flowlet '%s' of flow '%s' of app '%s' to %d instances\n",
appId.flow(flowSpecification.getName()), flowSpecification);
ProgramId programId = appId.flow(flow.getName()); for (FlowletConnection connection : flow.getConnections()) { if (connection.getSourceType().equals(FlowletConnection.Type.STREAM)) {