public TreeIndexDiskOrderScanOperatorNodePushable(IHyracksTaskContext ctx, int partition, IIndexDataflowHelperFactory indexHelperFactory, ISearchOperationCallbackFactory searchCallbackFactory) throws HyracksDataException { this.ctx = ctx; this.treeIndexHelper = indexHelperFactory.create(ctx.getJobletContext().getServiceContext(), partition); this.searchCallbackFactory = searchCallbackFactory; }
@Override public JobId getJobId() { return ctx.getJobletContext().getJobId(); }
@Override protected RunFileWriter getRunFileWriter() throws HyracksDataException { FileReference file = ctx.getJobletContext().createManagedWorkspaceFile(HybridTopKSortRunGenerator.class.getSimpleName()); return new RunFileWriter(file, ctx.getIoManager()); }
public IHyracksTaskContext createTestContext(JobId jobId, int partition, boolean withMessaging) throws HyracksDataException { IHyracksTaskContext ctx = TestUtils.create(KB32, ExecutionTestUtil.integrationUtil.ncs[0].getIoManager()); if (withMessaging) { TaskUtil.put(HyracksConstants.KEY_MESSAGE, new VSizeFrame(ctx), ctx); } IHyracksJobletContext jobletCtx = Mockito.mock(IHyracksJobletContext.class); JobEventListenerFactory factory = new JobEventListenerFactory(new TxnId(jobId.getId()), true); Mockito.when(jobletCtx.getJobletEventListenerFactory()).thenReturn(factory); Mockito.when(jobletCtx.getServiceContext()).thenReturn(ExecutionTestUtil.integrationUtil.ncs[0].getContext()); Mockito.when(jobletCtx.getJobId()).thenReturn(jobId); ctx = Mockito.spy(ctx); Mockito.when(ctx.getJobletContext()).thenReturn(jobletCtx); Mockito.when(ctx.getIoManager()).thenReturn(ExecutionTestUtil.integrationUtil.ncs[0].getIoManager()); TaskAttemptId taskId = new TaskAttemptId(new TaskId(new ActivityId(new OperatorDescriptorId(0), 0), partition), 0); Mockito.when(ctx.getTaskAttemptId()).thenReturn(taskId); return ctx; }
@Override public IPushRuntime[] createPushRuntime(IHyracksTaskContext ctx) throws HyracksDataException { IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory(); return new IPushRuntime[] { new CommitRuntime(ctx, ((IJobEventListenerFactory) fact).getTxnId(datasetId), datasetId, primaryKeyFields, isWriteTransaction, datasetPartitions[ctx.getTaskAttemptId().getTaskId().getPartition()], isSink) }; } }
final short partitionId = (short) ctx.getTaskAttemptId().getTaskId().getPartition(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider(partitionId, dataSourceId, totalDataSources); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId(); final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
public static RuntimeContext get(IHyracksTaskContext ctx) { return (RuntimeContext) ctx.getJobletContext().getApplicationContext().getApplicationObject(); }
@Override public LockThenSearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx, IOperatorNodePushable operatorNodePushable) throws HyracksDataException { ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx); try { IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory(); ITransactionContext txnCtx = txnSubsystem.getTransactionManager() .getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId)); return new LockThenSearchOperationCallback(new DatasetId(datasetId), resourceId, primaryKeyFields, txnSubsystem, txnCtx, operatorNodePushable); } catch (ACIDException e) { throw HyracksDataException.create(e); } }
final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId();
public IndexDropOperatorNodePushable(IIndexDataflowHelperFactory indexHelperFactory, Set<DropOption> options, IHyracksTaskContext ctx, int partition) throws HyracksDataException { this.indexHelper = indexHelperFactory.create(ctx.getJobletContext().getServiceContext(), partition); this.options = options; }
@Override public void sendApplicationMessageToCC(byte[] message, DeploymentId deploymentId) throws Exception { this.ncs.sendApplicationMessageToCC(getJobletContext().getJobId().getCcId(), message, deploymentId); }
@Override protected RunFileWriter getRunFileWriter() throws HyracksDataException { FileReference file = ctx.getJobletContext() .createManagedWorkspaceFile(ExternalSortGroupByRunGenerator.class.getSimpleName()); return new RunFileWriter(file, ctx.getIoManager()); }
@Override public ISearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx, IOperatorNodePushable operatorNodePushable) throws HyracksDataException { ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx); try { IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory(); ITransactionContext txnCtx = txnSubsystem.getTransactionManager() .getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId)); return new PrimaryIndexInstantSearchOperationCallback(new DatasetId(datasetId), resourceId, primaryKeyFields, txnSubsystem.getLockManager(), txnCtx); } catch (ACIDException e) { throw HyracksDataException.create(e); } }
final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId();
public TreeIndexStatsOperatorNodePushable(IHyracksTaskContext ctx, int partition, IIndexDataflowHelperFactory indexHelperFactory, IStorageManager storageManager) throws HyracksDataException { this.ctx = ctx; this.treeIndexHelper = indexHelperFactory.create(ctx.getJobletContext().getServiceContext(), partition); this.storageManager = storageManager; }
try { Thread.currentThread() .setName(Thread.currentThread().getName() + ":" + ctx.getJobletContext().getJobId() + ":" + ctx.getTaskAttemptId() + ":" + SuperActivityOperatorNodePushable.class.getSimpleName());
@Override public RunFileWriter getRunFileWriter() throws HyracksDataException { FileReference newRun = ctx.getJobletContext() .createManagedWorkspaceFile(ExternalGroupOperatorDescriptor.class.getSimpleName()); return new RunFileWriter(newRun, ctx.getIoManager()); } }
@Override public ISearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx, IOperatorNodePushable operatorNodePushable) throws HyracksDataException { ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx); try { IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory(); ITransactionContext txnCtx = txnSubsystem.getTransactionManager() .getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId)); return new PrimaryIndexSearchOperationCallback(new DatasetId(datasetId), resourceId, primaryKeyFields, txnSubsystem.getLockManager(), txnCtx); } catch (ACIDException e) { throw HyracksDataException.create(e); } }
public LSMIndexCompactOperatorNodePushable(IHyracksTaskContext ctx, int partition, IIndexDataflowHelperFactory indexHelperFactory) throws HyracksDataException { this.indexHelper = indexHelperFactory.create(ctx.getJobletContext().getServiceContext(), partition); }
@Override public IFrameWriter createResultPartitionWriter(IHyracksTaskContext ctx, ResultSetId rsId, boolean orderedResult, boolean asyncMode, int partition, int nPartitions, long maxReads) { ResultPartitionWriter dpw; JobId jobId = ctx.getJobletContext().getJobId(); synchronized (this) { dpw = new ResultPartitionWriter(ctx, this, jobId, rsId, asyncMode, orderedResult, partition, nPartitions, resultMemoryManager, fileFactory, maxReads); ResultSetMap rsIdMap = partitionResultStateMap.computeIfAbsent(jobId, k -> new ResultSetMap()); ResultState[] resultStates = rsIdMap.createOrGetResultStates(rsId, nPartitions); resultStates[partition] = dpw.getResultState(); } LOGGER.trace("Initialized partition writer: JobId: {}:partition: {}", jobId, partition); return dpw; }