public FlowId flow(String program) { return new FlowId(this, program); }
public static String prefixForFlow(FlowId flowId) { // queue:///namespace/app/flow/ // Note that the trailing / is crucial, otherwise this could match queues of flow1, flowx, etc. return String.format("queue:///%s/%s/%s/", flowId.getNamespace(), flowId.getApplication(), flowId.getEntityName()); }
private FlowletId deserializeFlowletId(JsonObject id) { FlowId flow = deserializeFlowId(id); String flowletId = id.get("flowlet").getAsString(); return new FlowletId(flow.getParent(), flow.getProgram(), flowletId); }
public String getDataTableName(FlowId flowId) { // tableName = system.queue.<app>.<flow> return unqualifiedTableNamePrefix + "." + flowId.getApplication() + "." + flowId.getEntityName(); } }
public TableId getDataTableId(FlowId flowId) { // tableName = system.queue.<app>.<flow> return TableId.from(flowId.getNamespace(), getDataTableName(flowId)); }
FlowletId flowlet = appId.flow(flowId).flowlet(flowletName); instances = programClient.getFlowletInstances(flowlet); break;
DatasetId stateStoreId = getStateStoreId(flowId.getNamespace()); Map<String, String> args = ImmutableMap.of(HBaseQueueDatasetModule.PROPERTY_QUEUE_NAME, prefixName.toString()); HBaseConsumerStateStore stateStore = datasetFramework.getDataset(stateStoreId, args, null);
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",
public static QueueName fromFlowlet(FlowId flow, String flowlet, String output) { return fromFlowlet(flow.getNamespace(), flow.getApplication(), flow.getEntityName(), flowlet, output); }
private FlowId deserializeFlowId(JsonObject id) { ApplicationId applicationId = deserializeApplicationId(id); return new FlowId(applicationId, id.get("flow").getAsString()); }
private FlowletId deserializeFlowletId(JsonObject id) { FlowId flow = deserializeFlowId(id.getAsJsonObject("flow")); String flowletId = id.get("id").getAsString(); return new FlowletId(flow.getParent(), flow.getProgram(), flowletId); }
public TableId getDataTableId(FlowId flowId, QueueConstants.QueueType queueType) throws IOException { String tableName = String.format("%s.%s.%s.%s", NamespaceId.SYSTEM.getNamespace(), queueType, flowId.getApplication(), flowId.getEntityName()); return tableUtil.createHTableId(new NamespaceId(flowId.getNamespace()), tableName); }
private FlowId deserializeFlowId(JsonObject id) { ProgramId flow = deserializeProgramId(id); return new FlowId(flow.getParent(), id.get("flow").getAsString()); }
public static Flow fromEntityId(FlowId flowId) { return new Flow(Id.Application.fromEntityId(flowId.getParent()), flowId.getProgram()); }
@Override public void dropAll(StreamId streamId, String namespace, Iterable<Long> groupIds) throws IOException { // A bit hacky to assume namespace is formed by appId.flowId. See AbstractDataFabricFacade // String namespace = String.format("%s.%s", // programId.getApplicationId(), // programId.getId()); String invalidNamespaceError = String.format("Namespace string %s must be of the form <app>.<flow>", namespace); Iterator<String> namespaceParts = Splitter.on('.').split(namespace).iterator(); Preconditions.checkArgument(namespaceParts.hasNext(), invalidNamespaceError); String appId = namespaceParts.next(); Preconditions.checkArgument(namespaceParts.hasNext(), invalidNamespaceError); String flowId = namespaceParts.next(); queueService.truncateAllWithPrefix(QueueName.prefixForFlow(new FlowId(streamId.getNamespace(), appId, flowId))); } }
/** * Deletes queues. */ @DELETE @Path("/apps/{app-id}/flows/{flow-id}/queues") public void deleteFlowQueues(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("flow-id") String flowId) throws Exception { FlowId flow = new FlowId(namespaceId, appId, flowId); try { ProgramStatus status = lifecycleService.getProgramStatus(flow); if (ProgramStatus.STOPPED != status) { responder.sendString(HttpResponseStatus.FORBIDDEN, "Flow is running, please stop it first."); } else { queueAdmin.dropAllForFlow(flow); FlowUtils.deleteFlowPendingMetrics(metricStore, namespaceId, appId, flowId); responder.sendStatus(HttpResponseStatus.OK); } } catch (SecurityException e) { responder.sendStatus(HttpResponseStatus.UNAUTHORIZED); } }
public TableId getDataTableId(QueueName queueName, QueueConstants.QueueType queueType) throws IOException { if (!queueName.isQueue()) { throw new IllegalArgumentException("'" + queueName + "' is not a valid name for a queue."); } return getDataTableId(new FlowId(queueName.getFirstComponent(), queueName.getSecondComponent(), queueName.getThirdComponent()), queueType); }
public String getActualTableName(QueueName queueName) { return getTableNameForFlow(new FlowId(queueName.getFirstComponent(), queueName.getSecondComponent(), queueName.getThirdComponent())); }