Package com.facebook.presto.operator

Examples of com.facebook.presto.operator.TaskContext


        if (taskExecution == null) {
            TaskInfo taskInfo = taskInfos.get(taskId);
            if (taskInfo == null) {
                // task does not exist yet, mark the task as canceled, so later if a late request
                // comes in to create the task, the task remains canceled
                TaskContext taskContext = new TaskContext(
                        new TaskStateMachine(taskId, taskNotificationExecutor),
                        taskManagementExecutor,
                        null,
                        maxTaskMemoryUsage,
                        operatorPreAllocatedMemory,
                        cpuTimerEnabled);

                taskInfo = new TaskInfo(taskId,
                        Long.MAX_VALUE,
                        TaskState.CANCELED,
                        URI.create("unknown"),
                        DateTime.now(),
                        new SharedBufferInfo(QueueState.FINISHED, 0, 0, ImmutableList.<BufferInfo>of()),
                        ImmutableSet.<PlanNodeId>of(),
                        taskContext.getTaskStats(),
                        ImmutableList.<ExecutionFailureInfo>of());
                TaskInfo existingTaskInfo = taskInfos.putIfAbsent(taskId, taskInfo);
                if (existingTaskInfo != null) {
                    taskInfo = existingTaskInfo;
                }
View Full Code Here


        CounterStat temp;

        temp = new CounterStat();
        temp.merge(finishedInputDataSize);
        for (TaskExecution taskExecution : tasks.values()) {
            TaskContext taskContext = taskExecution.getTaskContext();
            temp.merge(taskContext.getInputDataSize());
        }
        inputDataSize.resetTo(temp);

        temp = new CounterStat();
        temp.merge(finishedInputPositions);
        for (TaskExecution taskExecution : tasks.values()) {
            TaskContext taskContext = taskExecution.getTaskContext();
            temp.merge(taskContext.getInputPositions());
        }
        inputPositions.resetTo(temp);

        temp = new CounterStat();
        temp.merge(finishedOutputDataSize);
        for (TaskExecution taskExecution : tasks.values()) {
            TaskContext taskContext = taskExecution.getTaskContext();
            temp.merge(taskContext.getOutputDataSize());
        }
        outputDataSize.resetTo(temp);

        temp = new CounterStat();
        temp.merge(finishedOutputPositions);
        for (TaskExecution taskExecution : tasks.values()) {
            TaskContext taskContext = taskExecution.getTaskContext();
            temp.merge(taskContext.getOutputPositions());
        }
        outputPositions.resetTo(temp);
    }
View Full Code Here

        return outputFactory.getMaterializingOperator().getMaterializedResult();
    }

    public List<Driver> createDrivers(@Language("SQL") String sql, OutputFactory outputFactory)
    {
        return createDrivers(sql, outputFactory, new TaskContext(new TaskId("query", "stage", "task"), executor, session));
    }
View Full Code Here

        return result;
    }

    private static DriverContext createDriverContext(Session session)
    {
        return new TaskContext(new TaskId("query", "stage", "task"), EXECUTOR, session)
                .addPipelineContext(true, true)
                .addDriverContext();
    }
View Full Code Here

        return outputFactory.getMaterializingOperator().getMaterializedResult();
    }

    public List<Driver> createDrivers(@Language("SQL") String sql, OutputFactory outputFactory)
    {
        return createDrivers(sql, outputFactory, new TaskContext(new TaskId("query", "stage", "task"), executor, session));
    }
View Full Code Here

                    Executor executor)
            {
                this.taskStateMachine = new TaskStateMachine(checkNotNull(taskId, "taskId is null"), checkNotNull(executor, "executor is null"));

                Session session = new Session("user", "source", "catalog", "schema", "address", "agent");
                this.taskContext = new TaskContext(taskStateMachine, executor, session, new DataSize(256, MEGABYTE), new DataSize(1, MEGABYTE), true);

                this.location = URI.create("fake://task/" + taskId);

                this.sharedBuffer = new SharedBuffer(checkNotNull(new DataSize(1, Unit.BYTE), "maxBufferSize is null"));
                this.fragment = checkNotNull(fragment, "fragment is null");
View Full Code Here

        dataDir = Files.createTempDir();
        DatabaseLocalStorageManagerConfig config = new DatabaseLocalStorageManagerConfig().setDataDirectory(dataDir);
        storageManager = new DatabaseLocalStorageManager(dbi, config);
        executor = newCachedThreadPool(daemonThreadsNamed("test"));
        Session session = new Session("user", "source", "catalog", "schema", "address", "agent");
        driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, session)
                .addPipelineContext(true, true)
                .addDriverContext();
    }
View Full Code Here

        return outputFactory.getMaterializingOperator().getMaterializedResult();
    }

    public List<Driver> createDrivers(@Language("SQL") String sql, OutputFactory outputFactory)
    {
        return createDrivers(sql, outputFactory, new TaskContext(new TaskId("query", "stage", "task"), executor, session));
    }
View Full Code Here

                    Executor executor)
            {
                this.taskStateMachine = new TaskStateMachine(checkNotNull(taskId, "taskId is null"), checkNotNull(executor, "executor is null"));

                Session session = new Session("user", "source", "catalog", "schema", "address", "agent");
                this.taskContext = new TaskContext(taskStateMachine, executor, session, new DataSize(256, MEGABYTE), new DataSize(1, MEGABYTE), true);

                this.location = URI.create("fake://task/" + taskId);

                this.sharedBuffer = new SharedBuffer(checkNotNull(new DataSize(1, Unit.BYTE), "maxBufferSize is null"), INITIAL_EMPTY_OUTPUT_BUFFERS);
                this.fragment = checkNotNull(fragment, "fragment is null");
View Full Code Here

    @Override
    public MaterializedResult execute(ConnectorSession session, @Language("SQL") String sql)
    {
        MaterializedOutputFactory outputFactory = new MaterializedOutputFactory();

        TaskContext taskContext = new TaskContext(new TaskId("query", "stage", "task"), executor, session);
        List<Driver> drivers = createDrivers(session, sql, outputFactory, taskContext);

        boolean done = false;
        while (!done) {
            boolean processed = false;
View Full Code Here

TOP

Related Classes of com.facebook.presto.operator.TaskContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.