Package org.apache.twill.api

Examples of org.apache.twill.api.RuntimeSpecification


    return txnl.executeUnchecked(new TransactionExecutor.Function<AppMds, Integer>() {
      @Override
      public Integer apply(AppMds mds) throws Exception {
        ApplicationSpecification appSpec = getAppSpecOrFail(mds, id);
        ServiceSpecification serviceSpec = getServiceSpecOrFail(id, appSpec);
        RuntimeSpecification runtimeSpec = getRunnableSpecOrFail(id, serviceSpec, runnable);
        return runtimeSpec.getResourceSpecification().getInstances();
      }
    });
  }
View Full Code Here


      @Override
      public Void apply(AppMds mds) throws Exception {
        ApplicationSpecification appSpec = getAppSpecOrFail(mds, id);
        ServiceSpecification serviceSpec = getServiceSpecOrFail(id, appSpec);

        RuntimeSpecification runtimeSpec = serviceSpec.getRunnables().get(runnable);
        if (runtimeSpec == null) {
          throw new IllegalArgumentException(String.format("Runnable not found, app: %s, service: %s, runnable %s",
                                                           id.getApplication(), id.getId(), runnable));
        }

        ResourceSpecification resourceSpec = replaceInstanceCount(runtimeSpec.getResourceSpecification(), count);
        RuntimeSpecification newRuntimeSpec = replaceResourceSpec(runtimeSpec, resourceSpec);

        Preconditions.checkNotNull(newRuntimeSpec);

        ApplicationSpecification newAppSpec =
          replaceServiceSpec(appSpec, id.getId(), replaceRuntimeSpec(runnable, serviceSpec, newRuntimeSpec));
View Full Code Here

    }
  }

  private RuntimeSpecification getRunnableSpecOrFail(final Id.Program id, ServiceSpecification serviceSpec,
                                                     String runnable) {
    RuntimeSpecification runtimeSpec = serviceSpec.getRunnables().get(runnable);
    if (runtimeSpec == null) {
      throw new NoSuchElementException(String.format("Runnable not found, app: %s, service: %s, runnable %s",
                                                     id.getApplication(), id.getId(), runnable));
    }
    return runtimeSpec;
View Full Code Here

TOP

Related Classes of org.apache.twill.api.RuntimeSpecification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.