Search in sources :

Example 6 with CarteObjectEntry

use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.

the class JobResource method removeJob.

@GET
@Path("/remove/{id : .+}")
public Response removeJob(@PathParam("id") String id) {
    Job job = CarteResource.getJob(id);
    CarteObjectEntry entry = CarteResource.getCarteObjectEntry(id);
    KettleLogStore.discardLines(job.getLogChannelId(), true);
    CarteSingleton.getInstance().getJobMap().removeJob(entry);
    return Response.ok().build();
}
Also used : Job(org.pentaho.di.job.Job) CarteObjectEntry(org.pentaho.di.www.CarteObjectEntry) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 7 with CarteObjectEntry

use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.

the class TransformationResource method prepareTransformation.

// change from GET to UPDATE/POST for proper REST method
@GET
@Path("/prepare/{id : .+}")
@Produces({ MediaType.APPLICATION_JSON })
public TransformationStatus prepareTransformation(@PathParam("id") String id) {
    Trans trans = CarteResource.getTransformation(id);
    try {
        CarteObjectEntry entry = CarteResource.getCarteObjectEntry(id);
        TransConfiguration transConfiguration = CarteSingleton.getInstance().getTransformationMap().getConfiguration(entry);
        TransExecutionConfiguration executionConfiguration = transConfiguration.getTransExecutionConfiguration();
        // Set the appropriate logging, variables, arguments, replay date, ...
        // etc.
        trans.setArguments(executionConfiguration.getArgumentStrings());
        trans.setReplayDate(executionConfiguration.getReplayDate());
        trans.setSafeModeEnabled(executionConfiguration.isSafeModeEnabled());
        trans.setGatheringMetrics(executionConfiguration.isGatheringMetrics());
        trans.injectVariables(executionConfiguration.getVariables());
        trans.setPreviousResult(executionConfiguration.getPreviousResult());
        trans.prepareExecution(null);
    } catch (KettleException e) {
        e.printStackTrace();
    }
    return getTransformationStatus(id);
}
Also used : TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) KettleException(org.pentaho.di.core.exception.KettleException) Trans(org.pentaho.di.trans.Trans) TransConfiguration(org.pentaho.di.trans.TransConfiguration) CarteObjectEntry(org.pentaho.di.www.CarteObjectEntry) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 8 with CarteObjectEntry

use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.

the class TransformationResource method getTransformationStatus.

@GET
@Path("/status/{id : .+}")
@Produces({ MediaType.APPLICATION_JSON })
public TransformationStatus getTransformationStatus(@PathParam("id") String id) {
    TransformationStatus status = new TransformationStatus();
    // find trans
    Trans trans = CarteResource.getTransformation(id);
    CarteObjectEntry entry = CarteResource.getCarteObjectEntry(id);
    status.setId(entry.getId());
    status.setName(entry.getName());
    status.setStatus(trans.getStatus());
    for (int i = 0; i < trans.nrSteps(); i++) {
        StepInterface step = trans.getRunThread(i);
        if ((step.isRunning()) || step.getStatus() != StepExecutionStatus.STATUS_EMPTY) {
            StepStatus stepStatus = new StepStatus(step);
            status.addStepStatus(stepStatus);
        }
    }
    return status;
}
Also used : StepInterface(org.pentaho.di.trans.step.StepInterface) StepStatus(org.pentaho.di.trans.step.StepStatus) Trans(org.pentaho.di.trans.Trans) CarteObjectEntry(org.pentaho.di.www.CarteObjectEntry) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 9 with CarteObjectEntry

use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.

the class TransformationResource method removeTransformation.

// change from GET to UPDATE/POST for proper REST method
@GET
@Path("/remove/{id : .+}")
public Response removeTransformation(@PathParam("id") String id) {
    Trans trans = CarteResource.getTransformation(id);
    CarteObjectEntry entry = CarteResource.getCarteObjectEntry(id);
    KettleLogStore.discardLines(trans.getLogChannelId(), true);
    CarteSingleton.getInstance().getTransformationMap().removeTransformation(entry);
    return Response.ok().build();
}
Also used : Trans(org.pentaho.di.trans.Trans) CarteObjectEntry(org.pentaho.di.www.CarteObjectEntry) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 10 with CarteObjectEntry

use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.

the class TransformationMapConcurrentTest method setup.

@Before
public void setup() throws Exception {
    transformationMap = new TransformationMap();
    concurrentAllocateTasks = new ArrayList<>();
    concurrentDeallocateTasks = new ArrayList<>();
    // adding equal port allocations
    for (int i = 1; i <= numberOfSameAllocations; i++) {
        concurrentAllocateTasks.add(new ConcurrentAllocate(40000, "host0", "id0", "trans0", "slave0", "source0", "0", "slave-0", "target0", "0"));
    }
    // no deallocate tasks and !spa.isAllocated() returns true
    for (int i = 1; i <= numberOfSameSourceAndTargetSlaveNameAllocations; i++) {
        concurrentAllocateTasks.add(new ConcurrentAllocate(40000, "host1", "id" + i, "trans" + i, "slave-1", "source" + i, "" + i, "slave-2", "target" + i, "" + i));
    }
    // adding different allocations
    for (int i = 2; i <= numberOfDifferentAllocations + 1; i++) {
        concurrentAllocateTasks.add(new ConcurrentAllocate(40000, "host" + i, "id" + i, "trans" + i, "slave-" + i, "source" + i, "" + i, "slave-" + i, "target" + i, "" + i));
    }
    // adding allocations which have the same hostname as different ones but diff properties
    for (int i = 1; i <= numberOfSameHosts; i++) {
        concurrentAllocateTasks.add(new ConcurrentAllocate(40000, "host" + i, "diff", "diff", "diff", "diff", "diff", "diff", "diff", "diff"));
    }
    for (int i = 0; i < numberOfDeallocateTasks; i++) {
        CarteObjectEntry carteObjectEntry = new CarteObjectEntry("trans" + i, "id" + 1);
        concurrentDeallocateTasks.add(new ConcurrentDeallocate(i, "host" + i, carteObjectEntry));
    }
}
Also used : TransformationMap(org.pentaho.di.www.TransformationMap) CarteObjectEntry(org.pentaho.di.www.CarteObjectEntry) Before(org.junit.Before)

Aggregations

CarteObjectEntry (org.pentaho.di.www.CarteObjectEntry)10 GET (javax.ws.rs.GET)8 Path (javax.ws.rs.Path)8 Produces (javax.ws.rs.Produces)6 Job (org.pentaho.di.job.Job)3 Trans (org.pentaho.di.trans.Trans)3 ArrayList (java.util.ArrayList)2 KettleException (org.pentaho.di.core.exception.KettleException)2 Before (org.junit.Before)1 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)1 JobConfiguration (org.pentaho.di.job.JobConfiguration)1 TransConfiguration (org.pentaho.di.trans.TransConfiguration)1 TransExecutionConfiguration (org.pentaho.di.trans.TransExecutionConfiguration)1 StepInterface (org.pentaho.di.trans.step.StepInterface)1 StepStatus (org.pentaho.di.trans.step.StepStatus)1 TransformationMap (org.pentaho.di.www.TransformationMap)1