Source:
<code>public TaskInfo createTask(Offer offer, FrameworkID frameworkId, TaskID taskId, NodeTask nodeTask) { Objects.requireNonNull(offer, "Offer should be non-null"); Objects.requireNonNull(nodeTask, "NodeTask should be non-null"); NMPorts ports = getPorts(offer); LOGGER.debug(ports.toString()); ServiceResourceProfile serviceProfile = nodeTask.getProfile(); Scalar taskMemory = Scalar.newBuilder().setValue(serviceProfile.getAggregateMemory()).build(); Scalar taskCpus = Scalar.newBuilder().setValue(serviceProfile.getAggregateCpu()).build(); CommandInfo commandInfo = getCommandInfo(serviceProfile, ports); ExecutorInfo executorInfo = getExecutorInfoForSlave(frameworkId, offer, commandInfo); TaskInfo.Builder taskBuilder = TaskInfo .newBuilder() .setName("task-" + taskId.getValue()) .setTaskId(taskId) .setSlaveId(offer.getSlaveId()); return taskBuilder .addAllResources(taskUtils.getScalarResource(offer, "cpus", taskCpus.getValue(), taskUtils.getExecutorCpus())) .addAllResources(taskUtils.getScalarResource(offer, "mem", taskMemory.getValue(), taskUtils.getExecutorMemory())) .addResources(Resource.newBuilder() .setName("ports") .setType(Value.Type.RANGES) .setRanges(Value.Ranges.newBuilder() .addRange(Range.newBuilder() .setBegin(ports.getRpcPort()) .setEnd(ports.getRpcPort()) .build()) .addRange(Range.newBuilder() .setBegin(ports.getLocalizerPort()) .setEnd(ports.getLocalizerPort()) .build()) .addRange(Range.newBuilder() .setBegin(ports.getWebAppHttpPort()) .setEnd(ports.getWebAppHttpPort()) .build()) .addRange(Range.newBuilder() .setBegin(ports.getShufflePort()) .setEnd(ports.getShufflePort()) .build()))) .setExecutor(executorInfo) <START> .build(); <END> }</code><technical_language>above. If this is a formatting change, I suggest leave @klucar avoid conflicts while merging PRs</technical_language>

Target:
public TaskInfo createTask(Offer offer, FrameworkID frameworkId, TaskID taskId, NodeTask nodeTask) { Objects.requireNonNull(offer, "Offer should be non-null"); Objects.requireNonNull(nodeTask, "NodeTask should be non-null"); NMPorts ports = getPorts(offer); LOGGER.debug(ports.toString()); ServiceResourceProfile serviceProfile = nodeTask.getProfile(); Double taskMemory = serviceProfile.getAggregateMemory(); Double taskCpus = serviceProfile.getAggregateCpu(); CommandInfo commandInfo = getCommandInfo(serviceProfile, ports); ExecutorInfo executorInfo = getExecutorInfoForSlave(frameworkId, offer, commandInfo); TaskInfo.Builder taskBuilder = TaskInfo.newBuilder().setName("task-" + taskId.getValue()).setTaskId(taskId).setSlaveId( offer.getSlaveId()); return taskBuilder .addAllResources(taskUtils.getScalarResource(offer, "cpus", taskCpus, taskUtils.getExecutorCpus())) .addAllResources(taskUtils.getScalarResource(offer, "mem", taskMemory, taskUtils.getExecutorMemory())) .addResources(Resource.newBuilder().setName("ports").setType(Value.Type.RANGES).setRanges(Value.Ranges.newBuilder() .addRange(Range.newBuilder().setBegin(ports.getRpcPort()).setEnd(ports.getRpcPort()).build()) .addRange(Range.newBuilder().setBegin(ports.getLocalizerPort()).setEnd(ports.getLocalizerPort()).build()) .addRange(Range.newBuilder().setBegin(ports.getWebAppHttpPort()).setEnd(ports.getWebAppHttpPort()).build()) .addRange(Range.newBuilder().setBegin(ports.getShufflePort()).setEnd(ports.getShufflePort()).build()))) .setExecutor(executorInfo) .build(); }