Search in sources :

Example 1 with KillJobsRequest

use of io.crate.executor.transport.kill.KillJobsRequest in project crate by crate.

the class KillJobTask method execute.

@Override
public void execute(BatchConsumer consumer, Row parameters) {
    KillJobsRequest request = new KillJobsRequest(ImmutableList.of(jobToKill));
    nodeAction.broadcast(request, new OneRowActionListener<>(consumer, KillTask.KILL_RESPONSE_TO_ROW_FUNCTION));
}
Also used : KillJobsRequest(io.crate.executor.transport.kill.KillJobsRequest)

Example 2 with KillJobsRequest

use of io.crate.executor.transport.kill.KillJobsRequest in project crate by crate.

the class NodeDisconnectJobMonitorService method onNodeDisconnected.

@Override
public void onNodeDisconnected(final DiscoveryNode node) {
    final Collection<UUID> contexts = jobContextService.getJobIdsByCoordinatorNode(node.getId()).collect(Collectors.toList());
    if (contexts.isEmpty()) {
        // Disconnected node is not a handler node --> kill jobs on all participated nodes
        contexts.addAll(jobContextService.getJobIdsByParticipatingNodes(node.getId()).collect(Collectors.toList()));
        KillJobsRequest killJobsRequest = new KillJobsRequest(contexts);
        if (!contexts.isEmpty()) {
            killJobsNodeAction.broadcast(killJobsRequest, new ActionListener<KillResponse>() {

                @Override
                public void onResponse(KillResponse killResponse) {
                }

                @Override
                public void onFailure(Throwable e) {
                    LOGGER.warn("failed to send kill request to nodes");
                }
            }, Arrays.asList(node.getId()));
        } else {
            return;
        }
    }
    threadPool.schedule(DELAY, ThreadPool.Names.GENERIC, () -> jobContextService.killJobs(contexts));
}
Also used : KillJobsRequest(io.crate.executor.transport.kill.KillJobsRequest) KillResponse(io.crate.executor.transport.kill.KillResponse)

Aggregations

KillJobsRequest (io.crate.executor.transport.kill.KillJobsRequest)2 KillResponse (io.crate.executor.transport.kill.KillResponse)1