Uranium
Application Framework
|
Public Member Functions | |
None | __init__ (self, Union[str, int] thread_count="auto") |
None | add (self, "Job" job) |
None | remove (self, "Job" job) |
"JobQueue" | getInstance (cls, *args, **kwargs) |
Static Public Attributes | |
jobStarted = Signal() | |
jobFinished = Signal() | |
Protected Member Functions | |
Optional["Job"] | _nextJob (self) |
Protected Attributes | |
list | _threads = [_Worker(self, name = "JobQueueWorker [%s]" % t) for t in range(thread_count)] |
_semaphore = threading.Semaphore(0) | |
list | _jobs = [] |
_jobs_lock = threading.Lock() | |
A thread pool and queue manager for Jobs. The JobQueue class manages a queue of Job objects and a set of threads that can take things from this queue to process them. :sa Job
None UM.JobQueue.JobQueue.__init__ | ( | self, | |
Union[str, int] | thread_count = "auto" ) |
Initialize. :param thread_count: The amount of threads to use. Can be a positive integer or `auto`. When `auto`, the number of threads is based on the number of processors and cores on the machine.
|
protected |
protected: Get the next job off the queue. Note that this will block until a job is available.
None UM.JobQueue.JobQueue.add | ( | self, | |
"Job" | job ) |
Add a Job to the queue. :param job: The Job to add.
None UM.JobQueue.JobQueue.remove | ( | self, | |
"Job" | job ) |
Remove a waiting Job from the queue. :param job: The Job to remove. :note If a job has already begun processing it is already removed from the queue and thus can no longer be cancelled.