Package com.facebook.presto.operator

Examples of com.facebook.presto.operator.TaskContext


    @Override
    protected Map<String, Long> runOnce()
    {
        ConnectorSession session = new ConnectorSession("user", "source", "catalog", "schema", UTC_KEY, Locale.ENGLISH, "address", "agent");
        ExecutorService executor = localQueryRunner.getExecutor();
        TaskContext taskContext = new TaskContext(
                new TaskStateMachine(new TaskId("query", "stage", "task"), executor),
                executor,
                session,
                new DataSize(256, MEGABYTE),
                new DataSize(1, MEGABYTE),
                false);

        CpuTimer cpuTimer = new CpuTimer();
        execute(taskContext);
        CpuDuration executionTime = cpuTimer.elapsedTime();

        TaskStats taskStats = taskContext.getTaskStats();
        long inputRows = taskStats.getRawInputPositions();
        long inputBytes = taskStats.getRawInputDataSize().toBytes();
        long outputRows = taskStats.getOutputPositions();
        long outputBytes = taskStats.getOutputDataSize().toBytes();
View Full Code Here


                {
                    return new BufferInfo(outputId, false, 0, 0);
                }
            }));

            TaskStats taskStats = new TaskContext(taskId, executor, session).getTaskStats();

            taskInfo = new StateMachine<>("task " + taskId, executor, new TaskInfo(
                    taskId,
                    TaskInfo.MIN_VERSION,
                    TaskState.PLANNED,
View Full Code Here

                        }
                    }
                }
            });

            this.taskContext = new TaskContext(taskStateMachine,
                    notificationExecutor,
                    session,
                    checkNotNull(maxTaskMemoryUsage, "maxTaskMemoryUsage is null"),
                    checkNotNull(operatorPreAllocatedMemory, "operatorPreAllocatedMemory is null"),
                    cpuTimerEnabled);
View Full Code Here

                        sharedBuffer.destroy();
                    }
                }
            });

            this.taskContext = new TaskContext(taskStateMachine,
                    notificationExecutor,
                    session,
                    checkNotNull(maxTaskMemoryUsage, "maxTaskMemoryUsage is null"),
                    checkNotNull(operatorPreAllocatedMemory, "operatorPreAllocatedMemory is null"),
                    cpuTimerEnabled);
View Full Code Here

        ColumnFileHandle targetFileHandle = builder.build();

        if (!sources.isEmpty()) {
            // Throw out any stats generated by the optimization setp
            Session session = new Session("user", "source", "catalog", "schema", "address", "agent");
            OperatorContext operatorContext = new TaskContext(new TaskId("query", "stage", "task"), executor, session)
                    .addPipelineContext(true, true)
                    .addDriverContext()
                    .addOperatorContext(0, "OptimizeEncodings");

            AlignmentOperator source = new AlignmentOperator(operatorContext, sources);
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

                {
                    return new BufferInfo(outputId, false, 0, 0);
                }
            }));

            TaskStats taskStats = new TaskContext(taskId, executor, session).getTaskStats();

            taskInfo = new StateMachine<>("task " + taskId, executor, new TaskInfo(
                    taskId,
                    TaskInfo.MIN_VERSION,
                    TaskState.PLANNED,
View Full Code Here

            // cache task info
            taskInfos.putIfAbsent(taskInfo.getTaskId(), taskInfo);

            // record input and output stats
            TaskContext taskContext = taskExecution.getTaskContext();
            finishedInputDataSize.merge(taskContext.getInputDataSize());
            finishedInputPositions.merge(taskContext.getInputPositions());
            finishedOutputDataSize.merge(taskContext.getOutputDataSize());
            finishedOutputPositions.merge(taskContext.getOutputPositions());

            // remove task (after caching the task info)
            tasks.remove(taskInfo.getTaskId());
        }
        return taskInfo;
View Full Code Here

        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

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.