Search in sources :

Example 11 with SetThreadName

use of com.facebook.airlift.concurrent.SetThreadName in project presto by prestodb.

the class ContinuousTaskStatusFetcher method fatal.

@Override
public void fatal(Throwable cause) {
    try (SetThreadName ignored = new SetThreadName("ContinuousTaskStatusFetcher-%s", taskId)) {
        updateStats(currentRequestStartNanos.get());
        onFail.accept(cause);
    }
}
Also used : SetThreadName(com.facebook.airlift.concurrent.SetThreadName)

Example 12 with SetThreadName

use of com.facebook.airlift.concurrent.SetThreadName in project presto by prestodb.

the class ContinuousTaskStatusFetcher method success.

@Override
public void success(TaskStatus value) {
    try (SetThreadName ignored = new SetThreadName("ContinuousTaskStatusFetcher-%s", taskId)) {
        updateStats(currentRequestStartNanos.get());
        try {
            updateTaskStatus(value);
            errorTracker.requestSucceeded();
        } finally {
            scheduleNextRequest();
        }
    }
}
Also used : SetThreadName(com.facebook.airlift.concurrent.SetThreadName)

Example 13 with SetThreadName

use of com.facebook.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
        started.set(true);
        scheduleUpdate();
        taskStatusFetcher.start();
        taskInfoFetcher.start();
    }
}
Also used : SetThreadName(com.facebook.airlift.concurrent.SetThreadName)

Example 14 with SetThreadName

use of com.facebook.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 = setContentTypeHeaders(binaryTransportEnabled, prepareDelete()).setUri(uriBuilder.build()).build();
        scheduleAsyncCleanupRequest(createCleanupBackoff(), request, "abort");
    }
}
Also used : SetThreadName(com.facebook.airlift.concurrent.SetThreadName) HttpUriBuilder(com.facebook.airlift.http.client.HttpUriBuilder) TaskUpdateRequest(com.facebook.presto.server.TaskUpdateRequest) Request(com.facebook.airlift.http.client.Request)

Example 15 with SetThreadName

use of com.facebook.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 = setContentTypeHeaders(binaryTransportEnabled, prepareDelete()).setUri(uriBuilder.build()).build();
        scheduleAsyncCleanupRequest(createCleanupBackoff(), request, "cancel");
    }
}
Also used : SetThreadName(com.facebook.airlift.concurrent.SetThreadName) HttpUriBuilder(com.facebook.airlift.http.client.HttpUriBuilder) TaskUpdateRequest(com.facebook.presto.server.TaskUpdateRequest) Request(com.facebook.airlift.http.client.Request) TaskStatus(com.facebook.presto.execution.TaskStatus)

Aggregations

SetThreadName (com.facebook.airlift.concurrent.SetThreadName)16 SqlStageExecution (com.facebook.presto.execution.SqlStageExecution)4 MoreFutures.tryGetFutureValue (com.facebook.airlift.concurrent.MoreFutures.tryGetFutureValue)2 MoreFutures.whenAnyComplete (com.facebook.airlift.concurrent.MoreFutures.whenAnyComplete)2 HttpUriBuilder (com.facebook.airlift.http.client.HttpUriBuilder)2 HttpUriBuilder.uriBuilderFrom (com.facebook.airlift.http.client.HttpUriBuilder.uriBuilderFrom)2 Request (com.facebook.airlift.http.client.Request)2 Logger (com.facebook.airlift.log.Logger)2 TimeStat (com.facebook.airlift.stats.TimeStat)2 Session (com.facebook.presto.Session)2 SystemSessionProperties.getMaxConcurrentMaterializations (com.facebook.presto.SystemSessionProperties.getMaxConcurrentMaterializations)2 SystemSessionProperties.getPartialResultsCompletionRatioThreshold (com.facebook.presto.SystemSessionProperties.getPartialResultsCompletionRatioThreshold)2 SystemSessionProperties.getPartialResultsMaxExecutionTimeMultiplier (com.facebook.presto.SystemSessionProperties.getPartialResultsMaxExecutionTimeMultiplier)2 SystemSessionProperties.isPartialResultsEnabled (com.facebook.presto.SystemSessionProperties.isPartialResultsEnabled)2 SystemSessionProperties.isRuntimeOptimizerEnabled (com.facebook.presto.SystemSessionProperties.isRuntimeOptimizerEnabled)2 BasicStageExecutionStats (com.facebook.presto.execution.BasicStageExecutionStats)2 BasicStageExecutionStats.aggregateBasicStageStats (com.facebook.presto.execution.BasicStageExecutionStats.aggregateBasicStageStats)2 LocationFactory (com.facebook.presto.execution.LocationFactory)2 PartialResultQueryManager (com.facebook.presto.execution.PartialResultQueryManager)2 QueryState (com.facebook.presto.execution.QueryState)2