Search in sources :

Example 11 with SetThreadName

use of io.airlift.concurrent.SetThreadName in project presto by prestodb.

the class HttpRemoteTask method start.

@Override
public void start() {
    try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
        // to start we just need to trigger an update
        scheduleUpdate();
        taskStatusFetcher.start();
        taskInfoFetcher.start();
    }
}
Also used : SetThreadName(io.airlift.concurrent.SetThreadName)

Example 12 with SetThreadName

use of io.airlift.concurrent.SetThreadName in project presto by prestodb.

the class HttpRemoteTask method abort.

private synchronized void abort(TaskStatus status) {
    checkState(status.getState().isDone(), "cannot abort task with an incomplete status");
    try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
        taskStatusFetcher.updateTaskStatus(status);
        // send abort to task
        HttpUriBuilder uriBuilder = getHttpUriBuilder(getTaskStatus());
        Request request = prepareDelete().setUri(uriBuilder.build()).build();
        scheduleAsyncCleanupRequest(new Backoff(MAX_CLEANUP_RETRY_TIME, MAX_CLEANUP_RETRY_TIME), request, "abort");
    }
}
Also used : SetThreadName(io.airlift.concurrent.SetThreadName) HttpUriBuilder(io.airlift.http.client.HttpUriBuilder) Request(io.airlift.http.client.Request) TaskUpdateRequest(com.facebook.presto.server.TaskUpdateRequest)

Example 13 with SetThreadName

use of io.airlift.concurrent.SetThreadName in project presto by prestodb.

the class HttpRemoteTask method cancel.

@Override
public synchronized void cancel() {
    try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
        TaskStatus taskStatus = getTaskStatus();
        if (taskStatus.getState().isDone()) {
            return;
        }
        // send cancel to task and ignore response
        HttpUriBuilder uriBuilder = getHttpUriBuilder(taskStatus).addParameter("abort", "false");
        Request request = prepareDelete().setUri(uriBuilder.build()).build();
        scheduleAsyncCleanupRequest(new Backoff(MAX_CLEANUP_RETRY_TIME, MAX_CLEANUP_RETRY_TIME), request, "cancel");
    }
}
Also used : SetThreadName(io.airlift.concurrent.SetThreadName) HttpUriBuilder(io.airlift.http.client.HttpUriBuilder) Request(io.airlift.http.client.Request) TaskUpdateRequest(com.facebook.presto.server.TaskUpdateRequest) TaskStatus(com.facebook.presto.execution.TaskStatus)

Aggregations

SetThreadName (io.airlift.concurrent.SetThreadName)13 SqlStageExecution (com.facebook.presto.execution.SqlStageExecution)2 SqlQueryScheduler (com.facebook.presto.execution.scheduler.SqlQueryScheduler)2 TaskUpdateRequest (com.facebook.presto.server.TaskUpdateRequest)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 HttpUriBuilder (io.airlift.http.client.HttpUriBuilder)2 Request (io.airlift.http.client.Request)2 TaskSource (com.facebook.presto.TaskSource)1 StageId (com.facebook.presto.execution.StageId)1 StageState (com.facebook.presto.execution.StageState)1 TaskStatus (com.facebook.presto.execution.TaskStatus)1 Driver (com.facebook.presto.operator.Driver)1 DriverContext (com.facebook.presto.operator.DriverContext)1 DriverStats (com.facebook.presto.operator.DriverStats)1 PrestoException (com.facebook.presto.spi.PrestoException)1 PlanNodeId (com.facebook.presto.sql.planner.plan.PlanNodeId)1 TimeStat (io.airlift.stats.TimeStat)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1