soonq/worker.py
def start(self):
        """Begin working on the assigned type of task."""
        while self.alive and self.directive == self.DRV_WORK:
            try:
                # Read database.
                dequeued_item = self.task.dequeue()
                if not dequeued_item:
                    if not self.waiting:
                        self.waiting = True
                        echo(f"Waiting for next task...\n")
                    continue
                self.waiting = False
                self.task.set_status("dequeued")
                task_id, _, _, _, task_args, task_kwargs = dequeued_item
                # Run.
                self.task.slate(task_args, task_kwargs)
                echo(f"Running task: {task_id}")
                # Pass off execution to subprocess.
                exc_txt = self.subprocess_run(task_id)
                if exc_txt:
                    echo(f"Error in task: {task_id}\n")
                    self.task.set_status("error")
                    self.task.record_exc(exc_txt)
                else:
                    echo(f"Finished task: {task_id}\n")
                    self.task.set_status("complete")
            except KeyboardInterrupt:
                self.terminate()
                break
        else:
            if self.alive and self.directive == self.DRV_QUIT:
                self.quit()
Begin working on the assigned type of task.
Begin working on the assigned type of task.
Begin working on the assigned type of task .
def start(self):
        while self.alive and self.directive == self.DRV_WORK:
            try:
                dequeued_item = self.task.dequeue()
                if not dequeued_item:
                    if not self.waiting:
                        self.waiting = True
                        echo(f"Waiting for next task...\n")
                    continue
                self.waiting = False
                self.task.set_status("dequeued")
                task_id, _, _, _, task_args, task_kwargs = dequeued_item
                self.task.slate(task_args, task_kwargs)
                echo(f"Running task: {task_id}")
                exc_txt = self.subprocess_run(task_id)
                if exc_txt:
                    echo(f"Error in task: {task_id}\n")
                    self.task.set_status("error")
                    self.task.record_exc(exc_txt)
                else:
                    echo(f"Finished task: {task_id}\n")
                    self.task.set_status("complete")
            except KeyboardInterrupt:
                self.terminate()
                break
        else:
            if self.alive and self.directive == self.DRV_QUIT:
                self.quit()
def start ( self ) : while self . alive and self . directive == self . DRV_WORK : try : dequeued_item = self . task . dequeue ( ) if not dequeued_item : if not self . waiting : self . waiting = True echo ( f"Waiting for next task...\n" ) continue self . waiting = False self . task . set_status ( "dequeued" ) task_id , _ , _ , _ , task_args , task_kwargs = dequeued_item self . task . slate ( task_args , task_kwargs ) echo ( f"Running task: {task_id}" ) exc_txt = self . subprocess_run ( task_id ) if exc_txt : echo ( f"Error in task: {task_id}\n" ) self . task . set_status ( "error" ) self . task . record_exc ( exc_txt ) else : echo ( f"Finished task: {task_id}\n" ) self . task . set_status ( "complete" ) except KeyboardInterrupt : self . terminate ( ) break else : if self . alive and self . directive == self . DRV_QUIT : self . quit ( )
Begin working on the assigned type of task.
Begin working on the assigned type of task .
"""Begin working on the assigned type of task.""" # Read database. # Run. # Pass off execution to subprocess.
self