Search in sources :

Example 26 with Resources

use of co.cask.cdap.api.Resources in project cdap by caskdata.

the class WordCount method configure.

@Override
public void configure() {
    setMapperResources(new Resources(1024));
    setReducerResources(new Resources(1024));
}
Also used : Resources(co.cask.cdap.api.Resources)

Example 27 with Resources

use of co.cask.cdap.api.Resources in project cdap by caskdata.

the class ClicksAndViewsMapReduce method configure.

@Override
public void configure() {
    setName(NAME);
    setMapperResources(new Resources(1024));
    setReducerResources(new Resources(1024));
}
Also used : Resources(co.cask.cdap.api.Resources)

Example 28 with Resources

use of co.cask.cdap.api.Resources in project cdap by caskdata.

the class PurchaseHistoryService method configure.

@Override
protected void configure() {
    setName(SERVICE_NAME);
    setDescription("A service to retrieve a customer's purchase history");
    addHandler(new PurchaseHistoryServiceHandler());
    setResources(new Resources(1024));
}
Also used : Resources(co.cask.cdap.api.Resources)

Example 29 with Resources

use of co.cask.cdap.api.Resources in project cdap by caskdata.

the class ServiceSpecificationCodec method serialize.

@Override
public JsonElement serialize(ServiceSpecification spec, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject object = new JsonObject();
    object.addProperty("className", spec.getClassName());
    object.addProperty("name", spec.getName());
    object.addProperty("description", spec.getDescription());
    object.add("handlers", serializeMap(spec.getHandlers(), context, HttpServiceHandlerSpecification.class));
    object.add("resources", context.serialize(spec.getResources(), Resources.class));
    object.addProperty("instances", spec.getInstances());
    return object;
}
Also used : JsonObject(com.google.gson.JsonObject) Resources(co.cask.cdap.api.Resources) HttpServiceHandlerSpecification(co.cask.cdap.api.service.http.HttpServiceHandlerSpecification)

Example 30 with Resources

use of co.cask.cdap.api.Resources in project cdap by caskdata.

the class SparkWikipediaClustering method configure.

@Override
protected void configure() {
    if ("lda".equals(appConfig.clusteringAlgorithm)) {
        setDescription("A Spark program that analyzes wikipedia data using Latent Dirichlet Allocation (LDA).");
        setMainClass(ScalaSparkLDA.class);
    } else if ("kmeans".equals(appConfig.clusteringAlgorithm)) {
        setDescription("A Spark program that analyzes wikipedia data using K-Means.");
        setMainClass(ScalaSparkKMeans.class);
    } else {
        throw new IllegalArgumentException("Only 'lda' and 'kmeans' are supported as clustering algorithms. " + "Found " + appConfig.clusteringAlgorithm);
    }
    setName(NAME + "-" + appConfig.clusteringAlgorithm.toUpperCase());
    setDriverResources(new Resources(1024));
    setExecutorResources(new Resources(1024));
}
Also used : Resources(co.cask.cdap.api.Resources)

Aggregations

Resources (co.cask.cdap.api.Resources)40 JsonObject (com.google.gson.JsonObject)9 Test (org.junit.Test)8 ApplicationSpecification (co.cask.cdap.api.app.ApplicationSpecification)4 Connection (co.cask.cdap.etl.proto.Connection)4 UpgradeContext (co.cask.cdap.etl.proto.UpgradeContext)4 ServiceSpecification (co.cask.cdap.api.service.ServiceSpecification)3 HttpServiceHandlerSpecification (co.cask.cdap.api.service.http.HttpServiceHandlerSpecification)3 ArtifactSelectorConfig (co.cask.cdap.etl.proto.ArtifactSelectorConfig)3 ETLPlugin (co.cask.cdap.etl.proto.v2.ETLPlugin)3 ArrayList (java.util.ArrayList)3 MapReduceSpecification (co.cask.cdap.api.mapreduce.MapReduceSpecification)2 SchedulableProgramType (co.cask.cdap.api.schedule.SchedulableProgramType)2 ServiceHttpEndpoint (co.cask.cdap.api.service.http.ServiceHttpEndpoint)2 SparkSpecification (co.cask.cdap.api.spark.SparkSpecification)2 WorkerSpecification (co.cask.cdap.api.worker.WorkerSpecification)2 ScheduleProgramInfo (co.cask.cdap.api.workflow.ScheduleProgramInfo)2 WorkflowActionNode (co.cask.cdap.api.workflow.WorkflowActionNode)2 BatchPipelineSpec (co.cask.cdap.etl.batch.BatchPipelineSpec)2 Plugin (co.cask.cdap.etl.proto.v1.Plugin)2