Search in sources :

Example 1 with ExecutionKilled

use of io.kestra.core.models.executions.ExecutionKilled in project kestra by kestra-io.

the class KafkaExecutorTest method createKilled.

private void createKilled(Execution execution) {
    ExecutionKilled executionKilled = ExecutionKilled.builder().executionId(execution.getId()).build();
    this.executionKilledInput().pipeInput(executionKilled.getExecutionId(), executionKilled);
}
Also used : ExecutionKilled(io.kestra.core.models.executions.ExecutionKilled)

Example 2 with ExecutionKilled

use of io.kestra.core.models.executions.ExecutionKilled in project kestra by kestra-io.

the class ExecutorMain method topology.

public StreamsBuilder topology() {
    StreamsBuilder builder = new KafkaStreamsBuilder();
    // executor
    builder.addStateStore(Stores.keyValueStoreBuilder(Stores.persistentKeyValueStore(EXECUTOR_STATE_STORE_NAME), Serdes.String(), JsonSerde.of(Executor.class)));
    // WorkerTask deduplication
    builder.addStateStore(Stores.keyValueStoreBuilder(Stores.persistentKeyValueStore(WORKERTASK_DEDUPLICATION_STATE_STORE_NAME), Serdes.String(), Serdes.String()));
    // next deduplication
    builder.addStateStore(Stores.keyValueStoreBuilder(Stores.persistentKeyValueStore(NEXTS_DEDUPLICATION_STATE_STORE_NAME), Serdes.String(), JsonSerde.of(ExecutorNextTransformer.Store.class)));
    // trigger deduplication
    builder.addStateStore(Stores.keyValueStoreBuilder(Stores.persistentKeyValueStore(TRIGGER_DEDUPLICATION_STATE_STORE_NAME), Serdes.String(), Serdes.String()));
    // declare common stream
    KStream<String, WorkerTaskResult> workerTaskResultKStream = this.workerTaskResultKStream(builder);
    KStream<String, Executor> executorKStream = this.executorKStream(builder);
    // join with killed
    KStream<String, ExecutionKilled> executionKilledKStream = this.executionKilledKStream(builder);
    KStream<String, Executor> executionWithKilled = this.joinExecutionKilled(executionKilledKStream, executorKStream);
    // join with WorkerResult
    KStream<String, Executor> executionKStream = this.joinWorkerResult(workerTaskResultKStream, executionWithKilled);
    // handle state on execution
    KStream<String, Executor> stream = kafkaStreamSourceService.executorWithFlow(executionKStream, true);
    stream = this.handleExecutor(stream);
    // save execution
    this.toExecution(stream);
    this.toWorkerTask(stream);
    this.toWorkerTaskResult(stream);
    this.toExecutorFlowTriggerTopic(stream);
    // task Flow
    KTable<String, WorkerTaskExecution> workerTaskExecutionKTable = this.workerTaskExecutionStream(builder);
    KStream<String, WorkerTaskExecution> workerTaskExecutionKStream = this.deduplicateWorkerTaskExecution(stream);
    this.toWorkerTaskExecution(workerTaskExecutionKStream);
    this.workerTaskExecutionToExecution(workerTaskExecutionKStream);
    this.handleWorkerTaskExecution(workerTaskExecutionKTable, stream);
    // purge at end
    this.purgeExecutor(stream);
    this.purgeWorkerRunning(workerTaskResultKStream);
    return builder;
}
Also used : KafkaStreamsBuilder(io.kestra.runner.kafka.services.KafkaStreamsBuilder) KafkaTemplateExecutor(io.kestra.runner.kafka.KafkaTemplateExecutor) KafkaFlowExecutor(io.kestra.runner.kafka.KafkaFlowExecutor) ExecutionKilled(io.kestra.core.models.executions.ExecutionKilled) KafkaStreamsBuilder(io.kestra.runner.kafka.services.KafkaStreamsBuilder)

Aggregations

ExecutionKilled (io.kestra.core.models.executions.ExecutionKilled)2 KafkaFlowExecutor (io.kestra.runner.kafka.KafkaFlowExecutor)1 KafkaTemplateExecutor (io.kestra.runner.kafka.KafkaTemplateExecutor)1 KafkaStreamsBuilder (io.kestra.runner.kafka.services.KafkaStreamsBuilder)1