rokroskar/sparkhpc

View on GitHub

Showing 14 of 16 total issues

File sparkjob.py has 493 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#
# 
# Running spark clusters on batch scheduling systems
#
# Author: Rok Roskar, ETH Zuerich, 2016
Severity: Minor
Found in sparkhpc/sparkjob.py - About 7 hrs to fix

    SparkJob has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SparkJob(object): 
        """
        Generic SparkJob class
    
        To implement other schedulers, you must simply extend this class 
    Severity: Minor
    Found in sparkhpc/sparkjob.py - About 2 hrs to fix

      Function __init__ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, 
                      clusterid=None,
                      jobid=None,
                      ncores=4,
                      cores_per_executor=1, 
      Severity: Minor
      Found in sparkhpc/sparkjob.py - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function __init__ has 15 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, 
      Severity: Major
      Found in sparkhpc/sparkjob.py - About 1 hr to fix

        Function start_cluster has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def start_cluster(memory, 
                          cores_per_executor=1, 
                          timeout=30, 
                          spark_home=None, 
                          master_log_dir=None, 
        Severity: Minor
        Found in sparkhpc/sparkjob.py - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function show_clusters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def show_clusters(self): 
                sjs = self.current_clusters()
        
                if len(sjs) == 0: 
                    logger.info('No Spark clusters found')
        Severity: Minor
        Found in sparkhpc/sparkjob.py - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function _get_master has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_master(self, jobid, regex = None, timeout=60):
                """Retrieve the spark master address for jobid"""
        
                if self._job_started(jobid): 
                    timein = time.time()
        Severity: Minor
        Found in sparkhpc/sparkjob.py - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function start_cluster has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def start_cluster(memory, 
                          cores_per_executor=1, 
                          timeout=30, 
                          spark_home=None, 
                          master_log_dir=None, 
        Severity: Minor
        Found in sparkhpc/sparkjob.py - About 1 hr to fix

          Function _job_started has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def _job_started(cls, jobid): 
                  command = shlex.split(cls._get_current_jobs)
                  logger.debug('job status command: ' + cls._get_current_jobs)
                  stat = subprocess.check_output(command).decode().split('\n')
                  logger.debug('get_current_jobs: ' + '\n'.join(stat))
          Severity: Minor
          Found in sparkhpc/sparkjob.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function which has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def which(program):
              import os
              def is_exe(fpath):
                  return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
          
          
          Severity: Minor
          Found in sparkhpc/sparkjob.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function skip has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def skip(app, what, name, obj, skip, options):
          Severity: Minor
          Found in docs/conf.py - About 45 mins to fix

            Function start_spark has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def start_spark(self,
                                spark_conf=None, 
                                executor_memory=None,
                                profiling=False, 
                                graphframes_package='graphframes:graphframes:0.3.0-spark2.0-s_2.11', 
            Severity: Minor
            Found in sparkhpc/sparkjob.py - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function start_cluster has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def start_cluster(memory, 
            Severity: Minor
            Found in sparkhpc/sparkjob.py - About 45 mins to fix

              Function start_spark has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def start_spark(self,
              Severity: Minor
              Found in sparkhpc/sparkjob.py - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language