Search in sources :

Example 1 with RuntimeJobStatus

use of io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobStatus in project cdap by caskdata.

the class TetheringRuntimeJobManager method stop.

@Override
public void stop(ProgramRunInfo programRunInfo) throws Exception {
    RuntimeJobDetail jobDetail = getDetail(programRunInfo).orElse(null);
    if (jobDetail == null) {
        return;
    }
    RuntimeJobStatus status = jobDetail.getStatus();
    if (status.isTerminated() || status == RuntimeJobStatus.STOPPING) {
        return;
    }
    LOG.debug("Stopping run {} with following configurations: tethered instance name {}, tethered namespace {}.", programRunInfo.getRun(), tetheredInstanceName, tetheredNamespace);
    byte[] payload = Bytes.toBytes(GSON.toJson(programRunInfo));
    TetheringControlMessage message = new TetheringControlMessage(TetheringControlMessage.Type.STOP_PIPELINE, payload);
    publishToControlChannel(message);
}
Also used : RuntimeJobStatus(io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobStatus) TetheringControlMessage(io.cdap.cdap.internal.tethering.TetheringControlMessage) RuntimeJobDetail(io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobDetail)

Aggregations

TetheringControlMessage (io.cdap.cdap.internal.tethering.TetheringControlMessage)1 RuntimeJobDetail (io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobDetail)1 RuntimeJobStatus (io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobStatus)1