Uranium
Application Framework
|
Base class for things that should be performed in a thread. More...
Public Member Functions | |
None | __init__ (self) |
None | run (self) |
Perform the actual task of this job. More... | |
str | getMessage (self) |
None | setMessage (self, str message) |
Any | getResult (self) |
Get the result of the job. More... | |
None | setResult (self, Any result) |
Set the result of this job. More... | |
None | setError (self, Exception error) |
Set an exception that was thrown while the job was being executed. More... | |
None | start (self) |
Start the job. More... | |
None | cancel (self) |
Cancel the job. More... | |
bool | isRunning (self) |
Check whether the job is currently running. More... | |
bool | isFinished (self) |
Check whether the job has finished processing. More... | |
bool | hasError (self) |
Check whether the Job has encountered an error during execution. More... | |
Optional[Exception] | getError (self) |
Get the error that was encountered during execution. More... | |
Static Public Member Functions | |
None | yieldThread () |
Utility function that allows us to yield thread processing. More... | |
Static Public Attributes | |
finished = Signal() | |
Emitted when the job has finished processing. More... | |
progress = Signal() | |
Emitted when the job processing has progressed. More... | |
Base class for things that should be performed in a thread.
The Job class provides a basic interface for a 'job', that is a self-contained task that should be performed in a thread. It makes use of the JobQueue for the actual threading.
None UM.Job.Job.cancel | ( | self | ) |
Optional[Exception] UM.Job.Job.getError | ( | self | ) |
Get the error that was encountered during execution.
Any UM.Job.Job.getResult | ( | self | ) |
Get the result of the job.
The actual result object returned by this method is dependant on the implementation.
bool UM.Job.Job.hasError | ( | self | ) |
Check whether the Job has encountered an error during execution.
bool UM.Job.Job.isFinished | ( | self | ) |
Check whether the job has finished processing.
bool UM.Job.Job.isRunning | ( | self | ) |
Check whether the job is currently running.
None UM.Job.Job.run | ( | self | ) |
Perform the actual task of this job.
Should be reimplemented by subclasses.
NotImplementedError |
Reimplemented in UM.Scene.Platform._LoadPlatformJob, UM.FileHandler.WriteFileJob.WriteFileJob, UM.FileHandler.ReadFileJob.ReadFileJob, and UM.Mesh.ReadMeshJob.ReadMeshJob.
None UM.Job.Job.setError | ( | self, | |
Exception | error | ||
) |
Set an exception that was thrown while the job was being executed.
Setting error to something else than None implies the Job failed to execute properly.
error | Exception The exception to set. |
None UM.Job.Job.setResult | ( | self, | |
Any | result | ||
) |
None UM.Job.Job.start | ( | self | ) |
Start the job.
This will put the Job into the JobQueue to be processed whenever a thread is available.
|
static |
Utility function that allows us to yield thread processing.
This is mostly a workaround for broken python threads. This function forces a GIL release and allows a different thread to start processing if it is waiting.
|
static |
Emitted when the job has finished processing.
job | Job The finished job. |
|
static |
Emitted when the job processing has progressed.
job | Job The job reporting progress. |
amount | int The amount of progress made, from 0 to 100. |