batch_on_files.py
def worker(cls, dispatcher, processCls):
        """
        The worker creates a processCls object to calculate the result.
        """
        while True:
            args = dispatcher.getTask()
            dispatcher.putProcess(
                {"num": args[0], "pos": args[1], "pid": current_process().pid}
            )
            taskproc = processCls(args[2])
            result = taskproc.calculate(args[3])
            output = {
                "process": {
                    "name": current_process().name,
                    "pid": current_process().pid,
                },
                "num": args[0],
                "pos": args[1],
                "args": args[3],
                "result": result,
            }
            # Put the result on the output queue
            dispatcher.putResult(output)

        The worker creates a processCls object to calculate the result.
        
The worker creates a processCls object to calculate the result.
The worker creates a processCls object to calculate the result .
def worker(cls, dispatcher, processCls):
        while True:
            args = dispatcher.getTask()
            dispatcher.putProcess(
                {"num": args[0], "pos": args[1], "pid": current_process().pid}
            )
            taskproc = processCls(args[2])
            result = taskproc.calculate(args[3])
            output = {
                "process": {
                    "name": current_process().name,
                    "pid": current_process().pid,
                },
                "num": args[0],
                "pos": args[1],
                "args": args[3],
                "result": result,
            }
            dispatcher.putResult(output)
def worker ( cls , dispatcher , processCls ) : while True : args = dispatcher . getTask ( ) dispatcher . putProcess ( { "num" : args [ 0 ] , "pos" : args [ 1 ] , "pid" : current_process ( ) . pid } ) taskproc = processCls ( args [ 2 ] ) result = taskproc . calculate ( args [ 3 ] ) output = { "process" : { "name" : current_process ( ) . name , "pid" : current_process ( ) . pid , } , "num" : args [ 0 ] , "pos" : args [ 1 ] , "args" : args [ 3 ] , "result" : result , } dispatcher . putResult ( output )
The worker creates a processCls object to calculate the result.
The worker creates a processCls object to calculate the result .
"""
        The worker creates a processCls object to calculate the result.
        """ # Put the result on the output queue

cls
dispatcher
processCls