@Override public Map<String, ServiceSpecification> getServices() { return delegate.getServices(); }
@Override public Map<String, ServiceSpecification> getServices() { return delegate.getServices(); }
private Iterable<ProgramSpecification> getProgramSpecs(ApplicationId appId) { ApplicationSpecification appSpec = store.getApplication(appId); return Iterables.concat(appSpec.getMapReduce().values(), appSpec.getServices().values(), appSpec.getSpark().values(), appSpec.getWorkers().values(), appSpec.getWorkflows().values()); }
@Override protected void validateOptions(Program program, ProgramOptions options) { super.validateOptions(program, options); // Extract and verify parameters ApplicationSpecification appSpec = program.getApplicationSpecification(); Preconditions.checkNotNull(appSpec, "Missing application specification."); ProgramType processorType = program.getType(); Preconditions.checkNotNull(processorType, "Missing processor type."); Preconditions.checkArgument(processorType == ProgramType.SERVICE, "Only SERVICE process type is supported."); ServiceSpecification serviceSpec = appSpec.getServices().get(program.getName()); Preconditions.checkNotNull(serviceSpec, "Missing ServiceSpecification for %s", program.getName()); }
@Override protected void validateOptions(Program program, ProgramOptions options) { super.validateOptions(program, options); // Extract and verify parameters ApplicationSpecification appSpec = program.getApplicationSpecification(); Preconditions.checkNotNull(appSpec, "Missing application specification."); ProgramType processorType = program.getType(); Preconditions.checkNotNull(processorType, "Missing processor type."); Preconditions.checkArgument(processorType == ProgramType.SERVICE, "Only SERVICE process type is supported."); ServiceSpecification serviceSpec = appSpec.getServices().get(program.getName()); Preconditions.checkNotNull(serviceSpec, "Missing ServiceSpecification for %s", program.getName()); }
private Iterable<ProgramSpecification> getProgramSpecs(ApplicationId appId) { ApplicationSpecification appSpec = store.getApplication(appId); return Iterables.concat(appSpec.getFlows().values(), appSpec.getMapReduce().values(), appSpec.getServices().values(), appSpec.getSpark().values(), appSpec.getWorkers().values(), appSpec.getWorkflows().values()); }
private void deleteRouteConfig(ApplicationId appId, ApplicationSpecification appSpec) { for (ServiceSpecification serviceSpec : appSpec.getServices().values()) { ProgramId serviceId = appId.service(serviceSpec.getName()); try { routeStore.delete(serviceId); } catch (NotFoundException ex) { // expected if a config has not been stored for that service. } } }
private void deleteRouteConfig(ApplicationId appId, ApplicationSpecification appSpec) { for (ServiceSpecification serviceSpec : appSpec.getServices().values()) { ProgramId serviceId = appId.service(serviceSpec.getName()); try { routeStore.delete(serviceId); } catch (NotFoundException ex) { // expected if a config has not been stored for that service. } } }
@Override public ProgramController run(Program program, ProgramOptions options) { // Extract and verify parameters ApplicationSpecification appSpec = program.getApplicationSpecification(); Preconditions.checkNotNull(appSpec, "Missing application specification."); ProgramType processorType = program.getType(); Preconditions.checkNotNull(processorType, "Missing processor type."); Preconditions.checkArgument(processorType == ProgramType.SERVICE, "Only SERVICE process type is supported."); ServiceSpecification serviceSpec = appSpec.getServices().get(program.getName()); Preconditions.checkNotNull(serviceSpec, "Missing ServiceSpecification for %s", program.getName()); return startAll(program, options, serviceSpec.getInstances()); }
@Override public ProgramController run(Program program, ProgramOptions options) { // Extract and verify parameters ApplicationSpecification appSpec = program.getApplicationSpecification(); Preconditions.checkNotNull(appSpec, "Missing application specification."); ProgramType processorType = program.getType(); Preconditions.checkNotNull(processorType, "Missing processor type."); Preconditions.checkArgument(processorType == ProgramType.SERVICE, "Only SERVICE process type is supported."); ServiceSpecification serviceSpec = appSpec.getServices().get(program.getName()); Preconditions.checkNotNull(serviceSpec, "Missing ServiceSpecification for %s", program.getName()); return startAll(program, options, serviceSpec.getInstances()); }
private static ServiceSpecification getServiceSpecOrFail(ProgramId id, ApplicationSpecification appSpec) { ServiceSpecification spec = appSpec.getServices().get(id.getProgram()); if (spec == null) { throw new NoSuchElementException("no such service @ namespace id: " + id.getNamespace() + ", app id: " + id.getApplication() + ", service id: " + id.getProgram()); } return spec; }
private static ServiceSpecification getServiceSpecOrFail(ProgramId id, ApplicationSpecification appSpec) { ServiceSpecification spec = appSpec.getServices().get(id.getProgram()); if (spec == null) { throw new NoSuchElementException("no such service @ namespace id: " + id.getNamespace() + ", app id: " + id.getApplication() + ", service id: " + id.getProgram()); } return spec; }
private Set<ProgramId> getAllPrograms(ApplicationId appId, ApplicationSpecification appSpec) { Set<ProgramId> result = new HashSet<>(); result.addAll(getProgramsWithType(appId, ProgramType.MAPREDUCE, appSpec.getMapReduce())); result.addAll(getProgramsWithType(appId, ProgramType.WORKFLOW, appSpec.getWorkflows())); result.addAll(getProgramsWithType(appId, ProgramType.SERVICE, appSpec.getServices())); result.addAll(getProgramsWithType(appId, ProgramType.SPARK, appSpec.getSpark())); result.addAll(getProgramsWithType(appId, ProgramType.WORKER, appSpec.getWorkers())); return result; }
private void addPrograms(ImmutableMap.Builder<String, String> properties) { addPrograms(ProgramType.MAPREDUCE, appSpec.getMapReduce().values(), properties); addPrograms(ProgramType.SERVICE, appSpec.getServices().values(), properties); addPrograms(ProgramType.SPARK, appSpec.getSpark().values(), properties); addPrograms(ProgramType.WORKER, appSpec.getWorkers().values(), properties); addPrograms(ProgramType.WORKFLOW, appSpec.getWorkflows().values(), properties); }
private Set<ProgramId> getAllPrograms(ApplicationId appId, ApplicationSpecification appSpec) { Set<ProgramId> result = new HashSet<>(); result.addAll(getProgramsWithType(appId, ProgramType.FLOW, appSpec.getFlows())); result.addAll(getProgramsWithType(appId, ProgramType.MAPREDUCE, appSpec.getMapReduce())); result.addAll(getProgramsWithType(appId, ProgramType.WORKFLOW, appSpec.getWorkflows())); result.addAll(getProgramsWithType(appId, ProgramType.SERVICE, appSpec.getServices())); result.addAll(getProgramsWithType(appId, ProgramType.SPARK, appSpec.getSpark())); result.addAll(getProgramsWithType(appId, ProgramType.WORKER, appSpec.getWorkers())); return result; }
private void addPrograms(ImmutableMap.Builder<String, String> properties) { addPrograms(ProgramType.FLOW, appSpec.getFlows().values(), properties); addPrograms(ProgramType.MAPREDUCE, appSpec.getMapReduce().values(), properties); addPrograms(ProgramType.SERVICE, appSpec.getServices().values(), properties); addPrograms(ProgramType.SPARK, appSpec.getSpark().values(), properties); addPrograms(ProgramType.WORKER, appSpec.getWorkers().values(), properties); addPrograms(ProgramType.WORKFLOW, appSpec.getWorkflows().values(), properties); }
private boolean programExists(ProgramId id, ApplicationSpecification appSpec) { switch (id.getType()) { case MAPREDUCE: return appSpec.getMapReduce().containsKey(id.getProgram()); case SERVICE: return appSpec.getServices().containsKey(id.getProgram()); case SPARK: return appSpec.getSpark().containsKey(id.getProgram()); case WORKER: return appSpec.getWorkers().containsKey(id.getProgram()); case WORKFLOW: return appSpec.getWorkflows().containsKey(id.getProgram()); default: throw new IllegalArgumentException("Unexpected ProgramType " + id.getType()); } }
private boolean programExists(ProgramId id, ApplicationSpecification appSpec) { switch (id.getType()) { case FLOW: return appSpec.getFlows().containsKey(id.getProgram()); case MAPREDUCE: return appSpec.getMapReduce().containsKey(id.getProgram()); case SERVICE: return appSpec.getServices().containsKey(id.getProgram()); case SPARK: return appSpec.getSpark().containsKey(id.getProgram()); case WORKER: return appSpec.getWorkers().containsKey(id.getProgram()); case WORKFLOW: return appSpec.getWorkflows().containsKey(id.getProgram()); default: throw new IllegalArgumentException("Unexpected ProgramType " + id.getType()); } }
@Override protected void setupLaunchConfig(ProgramLaunchConfig launchConfig, Program program, ProgramOptions options, CConfiguration cConf, Configuration hConf, File tempDir) { ApplicationSpecification appSpec = program.getApplicationSpecification(); ServiceSpecification serviceSpec = appSpec.getServices().get(program.getName()); // Add a runnable for the service handler launchConfig.addRunnable(serviceSpec.getName(), new ServiceTwillRunnable(serviceSpec.getName()), serviceSpec.getInstances(), options.getUserArguments().asMap(), serviceSpec.getResources()); } }
@Override protected void setupLaunchConfig(ProgramLaunchConfig launchConfig, Program program, ProgramOptions options, CConfiguration cConf, Configuration hConf, File tempDir) { ApplicationSpecification appSpec = program.getApplicationSpecification(); ServiceSpecification serviceSpec = appSpec.getServices().get(program.getName()); // Add a runnable for the service handler launchConfig.addRunnable(serviceSpec.getName(), new ServiceTwillRunnable(serviceSpec.getName()), serviceSpec.getInstances(), options.getUserArguments().asMap(), serviceSpec.getResources()); } }