use of org.apache.hyracks.api.job.IJobletEventListenerFactory in project asterixdb by apache.
the class IndexUtil method bindJobEventListener.
/**
* Binds a job event listener to the job specification.
*
* @param spec,
* the job specification.
* @param metadataProvider,
* the metadata provider.
* @return the AsterixDB job id for transaction management.
*/
public static JobId bindJobEventListener(JobSpecification spec, MetadataProvider metadataProvider) {
JobId jobId = JobIdFactory.generateJobId();
metadataProvider.setJobId(jobId);
boolean isWriteTransaction = metadataProvider.isWriteTransaction();
IJobletEventListenerFactory jobEventListenerFactory = new JobEventListenerFactory(jobId, isWriteTransaction);
spec.setJobletEventListenerFactory(jobEventListenerFactory);
return jobId;
}
use of org.apache.hyracks.api.job.IJobletEventListenerFactory in project asterixdb by apache.
the class HeuristicCompilerFactoryBuilder method create.
@Override
public ICompilerFactory create() {
return new ICompilerFactory() {
@Override
public ICompiler createCompiler(final ILogicalPlan plan, final IMetadataProvider<?, ?> metadata, int varCounter) {
final IOptimizationContext oc = optCtxFactory.createOptimizationContext(varCounter, expressionEvalSizeComputer, mergeAggregationExpressionFactory, expressionTypeComputer, missableTypeComputer, conflictingTypeResolver, physicalOptimizationConfig, clusterLocations);
oc.setMetadataDeclarations(metadata);
final HeuristicOptimizer opt = new HeuristicOptimizer(plan, logicalRewrites, physicalRewrites, oc);
return new ICompiler() {
@Override
public void optimize() throws AlgebricksException {
opt.optimize();
}
@Override
public JobSpecification createJob(Object appContext, IJobletEventListenerFactory jobEventListenerFactory) throws AlgebricksException {
AlgebricksConfig.ALGEBRICKS_LOGGER.fine("Starting Job Generation.\n");
JobGenContext context = new JobGenContext(null, metadata, appContext, serializerDeserializerProvider, hashFunctionFactoryProvider, hashFunctionFamilyProvider, comparatorFactoryProvider, typeTraitProvider, binaryBooleanInspectorFactory, binaryIntegerInspectorFactory, printerProvider, missingWriterFactory, normalizedKeyComputerFactoryProvider, expressionRuntimeProvider, expressionTypeComputer, oc, expressionEvalSizeComputer, partialAggregationTypeComputer, predEvaluatorFactoryProvider, physicalOptimizationConfig.getFrameSize(), clusterLocations);
PlanCompiler pc = new PlanCompiler(context);
return pc.compilePlan(plan, null, jobEventListenerFactory);
}
};
}
};
}
Aggregations