|
@@ -158,6 +158,9 @@ public abstract class TaskAttemptImpl implements
|
|
|
org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt,
|
|
|
EventHandler<TaskAttemptEvent> {
|
|
|
|
|
|
+ @VisibleForTesting
|
|
|
+ protected final static Map<TaskType, Resource> RESOURCE_REQUEST_CACHE
|
|
|
+ = new HashMap<>();
|
|
|
static final Counters EMPTY_COUNTERS = new Counters();
|
|
|
private static final Logger LOG =
|
|
|
LoggerFactory.getLogger(TaskAttemptImpl.class);
|
|
@@ -172,7 +175,7 @@ public abstract class TaskAttemptImpl implements
|
|
|
private final Clock clock;
|
|
|
private final org.apache.hadoop.mapred.JobID oldJobId;
|
|
|
private final TaskAttemptListener taskAttemptListener;
|
|
|
- private final Resource resourceCapability;
|
|
|
+ private Resource resourceCapability;
|
|
|
protected Set<String> dataLocalHosts;
|
|
|
protected Set<String> dataLocalRacks;
|
|
|
private final List<String> diagnostics = new ArrayList<String>();
|
|
@@ -707,6 +710,10 @@ public abstract class TaskAttemptImpl implements
|
|
|
getResourceTypePrefix(taskType);
|
|
|
boolean memorySet = false;
|
|
|
boolean cpuVcoresSet = false;
|
|
|
+ if (RESOURCE_REQUEST_CACHE.get(taskType) != null) {
|
|
|
+ resourceCapability = RESOURCE_REQUEST_CACHE.get(taskType);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (resourceTypePrefix != null) {
|
|
|
List<ResourceInformation> resourceRequests =
|
|
|
ResourceUtils.getRequestedResourcesFromConfig(conf,
|
|
@@ -767,6 +774,9 @@ public abstract class TaskAttemptImpl implements
|
|
|
if (!cpuVcoresSet) {
|
|
|
this.resourceCapability.setVirtualCores(getCpuRequired(conf, taskType));
|
|
|
}
|
|
|
+ RESOURCE_REQUEST_CACHE.put(taskType, resourceCapability);
|
|
|
+ LOG.info("Resource capability of task type {} is set to {}",
|
|
|
+ taskType, resourceCapability);
|
|
|
}
|
|
|
|
|
|
private String getCpuVcoresKey(TaskType taskType) {
|