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

Refactor boolean flag based approach in SchedConfCLI#run

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      Boolean-flag based approach in org.apache.hadoop.yarn.client.cli.SchedConfCLI#run:
      Everything is controlled with boolean flags here.
      The flag hasOption is set to true in each of the if-clauses just to make the condition below the hasOption-conditions happy. The flag is set to true even for parameter that don't have an option (like 'getConf') at all, this is very misleading and hard to understand for the first read.

      Need below refactoring:
      a. Eliminates the hasOption boolean flag
      b. Where an option is misused, fail-fast: Have a method that contains this code and call it for every option, in-place:

      if (!hasOption) {
       System.err.println("Invalid Command Usage: ");
       printUsage();
       return -1;
       }
      

      c. Remove the boolean flags: format and getConf as well. These are unnecessary.

      cc snemeth

      Attachments

        Issue Links

          Activity

            People

              oleg_bonar Oleg Bonar
              prabhujoseph Prabhu Joseph
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: