Uranium
Application Framework
Loading...
Searching...
No Matches
UM.JobQueue.JobQueue Class Reference

A thread pool and queue manager for Jobs. More...

Public Member Functions

 __init__ (self,(str, int) thread_count="auto")
 Initialize.
 
 add (self, "Job" job)
 Add a Job to the queue.
 
 remove (self, "Job" job)
 Remove a waiting Job from the queue.
 
"JobQueue" getInstance (cls)
 Get the singleton instance of the JobQueue.
 

Static Public Attributes

 jobStarted = Signal()
 Emitted whenever a job starts processing.
 
 jobFinished = Signal()
 Emitted whenever a job has finished processing.
 

Protected Member Functions

 _nextJob (self)
 protected:
 

Protected Attributes

 _threads
 
 _semaphore
 
 _jobs
 
 _jobs_lock
 

Static Protected Attributes

 _instance = None
 

Detailed Description

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.

See also
Job

Constructor & Destructor Documentation

◆ __init__()

UM.JobQueue.JobQueue.__init__ (   self,
(str, int)   thread_count = "auto" 
)

Initialize.

Parameters
thread_countThe 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.

Member Function Documentation

◆ add()

UM.JobQueue.JobQueue.add (   self,
"Job"  job 
)

Add a Job to the queue.

Parameters
jobJob The Job to add.

◆ remove()

UM.JobQueue.JobQueue.remove (   self,
"Job"  job 
)

Remove a waiting Job from the queue.

Parameters
jobJob 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.

Member Data Documentation

◆ jobFinished

UM.JobQueue.JobQueue.jobFinished = Signal()
static

Emitted whenever a job has finished processing.

Parameters
jobJob The job that has finished processing.

◆ jobStarted

UM.JobQueue.JobQueue.jobStarted = Signal()
static

Emitted whenever a job starts processing.

Parameters
jobJob The job that has started processing.

The documentation for this class was generated from the following file: