Complete the code to allocate a container in Hadoop YARN.
container = nmClient.allocateContainer([1])The allocateContainer method requires a containerRequest object to specify resource needs.
Complete the code to specify the memory size for the container request.
resource.setMemory([1])The setMemory method expects an integer value representing memory in MB, such as 1024.
Fix the error in the code to request a container with the correct resource capability.
containerRequest = new ContainerRequest([1], null, null, 1)
The ContainerRequest constructor requires a resource object describing the container's capabilities.
Fill both blanks to create a resource with 2048 MB memory and 2 virtual cores.
resource = Resource.newInstance([1], [2])
The newInstance method takes memory in MB and number of virtual CPU cores as arguments.
Fill all three blanks to create a container request with resource, null nodes, and priority 5.
containerRequest = new ContainerRequest([1], [2], null, [3])
The ContainerRequest constructor needs resource, nodes (null for any), racks (null), and priority.