Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-6799

Remove the duplicated code in CGroupsHandlerImp.java

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha3
    • Fix Version/s: 2.9.0, 3.0.0-beta1
    • Component/s: nodemanager
    • Labels:
      None

      Description

      The else clause in initializeCGroupController is not necessary.

        public void initializeCGroupController(CGroupController controller) throws
            ResourceHandlerException {
          if (enableCGroupMount) {
            // We have a controller that needs to be mounted
            mountCGroupController(controller);
          } else {
            String controllerPath = getControllerPath(controller);
      
            if (controllerPath == null) {
              throw new ResourceHandlerException(
                  String.format("Controller %s not mounted."
                      + " You either need to mount it with %s"
                      + " or mount cgroups before launching Yarn",
                      controller.getName(), YarnConfiguration.
                      NM_LINUX_CONTAINER_CGROUPS_MOUNT));
            }
          }
      
          // We are working with a pre-mounted contoller
          // Make sure that Yarn cgroup hierarchy path exists
          initializePreMountedCGroupController(controller);
        }
      
        private void initializePreMountedCGroupController(CGroupController controller)
            throws ResourceHandlerException {
          // Check permissions to cgroup hierarchy and
          // create YARN cgroup if it does not exist, yet
          String controllerPath = getControllerPath(controller);
      
          if (controllerPath == null) {
            throw new ResourceHandlerException(
                String.format("Controller %s not mounted."
                        + " You either need to mount it with %s"
                        + " or mount cgroups before launching Yarn",
                    controller.getName(), YarnConfiguration.
                        NM_LINUX_CONTAINER_CGROUPS_MOUNT));
          }
      

        Attachments

        1. YARN-6799.002.patch
          2 kB
          weiyuan
        2. YARN-6799.001.patch
          2 kB
          weiyuan

          Activity

            People

            • Assignee:
              v123582 weiyuan
              Reporter:
              yufeigu Yufei Gu
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: