// Initializing dataset context and hooking it up with mapreduce job transaction
DatasetFramework datasetFramework = injector.getInstance(DatasetFramework.class);
CConfiguration configuration = injector.getInstance(CConfiguration.class);
ApplicationSpecification programSpec = program.getSpecification();
// if this is not for a mapper or a reducer, we don't need the metrics collection service
MetricsCollectionService metricsCollectionService =
(type == null) ? null : injector.getInstance(MetricsCollectionService.class);
DiscoveryServiceClient discoveryServiceClient = injector.getInstance(DiscoveryServiceClient.class);
// Creating mapreduce job context
MapReduceSpecification spec = program.getSpecification().getMapReduce().get(program.getName());
BasicMapReduceContext context =
new BasicMapReduceContext(program, type, RunIds.fromString(runId),
runtimeArguments, programSpec.getDatasets().keySet(), spec, logicalStartTime,
workflowBatch, discoveryServiceClient, metricsCollectionService,
datasetFramework, configuration);
// propagating tx to all txAware guys
// NOTE: tx will be committed by client code