mfinzi/pristine-ml

View on GitHub
oil/tuning/localGpuExecutor.py

Summary

Maintainability
D
1 day
Test Coverage

Function _queue_management_worker has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

def _queue_management_worker(executor_reference,
                             processes,
                             pending_work_items,
                             work_ids_queue,
                             call_queue,
Severity: Minor
Found in oil/tuning/localGpuExecutor.py - About 6 hrs 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

File localGpuExecutor.py has 410 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
#import torch.multiprocessing as multiprocessing
from concurrent import futures
import torch
torch.multiprocessing.set_start_method("spawn",force="True")#.get_context('spawn')
Severity: Minor
Found in oil/tuning/localGpuExecutor.py - About 5 hrs to fix

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

    def _process_worker(call_queue, result_queue,gpu_set,gpu_pool):
        """Evaluates calls from call_queue and places the results in result_queue.
        This worker is run in a separate process.
        Args:
            call_queue: A multiprocessing.Queue of _CallItems that will be read and
    Severity: Minor
    Found in oil/tuning/localGpuExecutor.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 _add_call_item_to_queue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _add_call_item_to_queue(pending_work_items,
                                work_ids,
                                call_queue):
        """Fills call_queue with _WorkItems from pending_work_items.
        This function never blocks.
    Severity: Minor
    Found in oil/tuning/localGpuExecutor.py - About 55 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 _queue_management_worker has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _queue_management_worker(executor_reference,
    Severity: Minor
    Found in oil/tuning/localGpuExecutor.py - About 45 mins to fix

      Function _check_system_limits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def _check_system_limits():
          global _system_limits_checked, _system_limited
          if _system_limits_checked:
              if _system_limited:
                  raise NotImplementedError(_system_limited)
      Severity: Minor
      Found in oil/tuning/localGpuExecutor.py - About 25 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

      There are no issues that match your filters.

      Category
      Status