# Buggy code
def WorkersRunning(self):
    """Determines if the workers are running."""
    for extraction_worker_status in iter(self._extraction_workers.values()):
        if extraction_worker_status.status == definitions.PROCESSING_STATUS_COMPLETED:
            logging.debug("Worker completed.")
            continue
        if (
            extraction_worker_status.number_of_events_delta > 0
            or extraction_worker_status.consumed_number_of_path_specs_delta > 0
            or extraction_worker_status.produced_number_of_path_specs_delta > 0
        ):
            return True

    return False


# Traceback (CError)
plaso-1.3.1.post20151021

^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.7/multiprocessing/util.py", line 325, in _exit_function
p.join()
File "/usr/lib/python2.7/multiprocessing/process.py", line 145, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 154, in wait
return self.poll(0)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 135, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.7/multiprocessing/util.py", line 325, in _exit_function
p.join()
File "/usr/lib/python2.7/multiprocessing/process.py", line 145, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 154, in wait
return self.poll(0)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 135, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored\


analyst   4035  3335  0 Oct29 pts/19   00:00:57 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4045  4035  0 Oct29 pts/19   00:01:02 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4048  4035  0 Oct29 pts/19   00:00:39 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4051  4035  0 Oct29 pts/19   00:00:58 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4054  4035  0 Oct29 pts/19   00:00:41 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4060  4035  0 Oct29 pts/19   00:00:44 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4063  4035  0 Oct29 pts/19   00:00:40 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4066  4035  0 Oct29 pts/19   00:00:37 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4068  4035  0 Oct29 pts/19   00:00:40 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4070  4035  0 Oct29 pts/19   00:11:09 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4073  4035  0 Oct29 pts/19   00:00:37 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4076  4035  0 Oct29 pts/19   00:00:37 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4083  4035  1 Oct29 pts/19   00:14:40 [log2timeline.py] <defunct>

# Fixed code
def WorkersRunning(self):
    """Determines if the workers are running."""
    for extraction_worker_status in iter(self._extraction_workers.values()):
        if extraction_worker_status.status == definitions.PROCESSING_STATUS_COMPLETED:
            logging.debug("Worker completed.")
            continue
        if (
            extraction_worker_status.number_of_events_delta > 0
            or extraction_worker_status.consumed_number_of_path_specs_delta > 0
            or extraction_worker_status.produced_number_of_path_specs_delta > 0
            or (
                extraction_worker_status.status == definitions.PROCESSING_STATUS_HASHING
            )
        ):
            return True

    return False