|
Uranium
Application Framework
|
Base class for things that should be performed in a thread. More...
Public Member Functions | |
| def | __init__ (self) |
| def | run (self) |
| Perform the actual task of this job. More... | |
| def | getMessage (self) |
| def | setMessage (self, message) |
| def | getResult (self) |
| Get the result of the job. More... | |
| def | setResult |
| Set the result of this job. More... | |
| def | setError |
| Set an exception that was thrown while the job was being executed. More... | |
| def | start (self) |
| Start the job. More... | |
| def | cancel (self) |
| Cancel the job. More... | |
| def | isRunning (self) |
| Check whether the job is currently running. More... | |
| def | isFinished (self) |
| Check whether the job has finished processing. More... | |
| def | hasError (self) |
| Check whether the Job has encountered an error during execution. More... | |
| def | getError (self) |
| Get the error that was encountered during execution. More... | |
Static Public Member Functions | |
| def | yieldThread () |
| Utility function that allows us to yield thread processing. More... | |
Static Public Attributes | |
| tuple | finished = Signal() |
| Emitted when the job has finished processing. More... | |
| tuple | 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.
| def UM.Job.Job.cancel | ( | self, | |
| None | |||
| ) |
| def UM.Job.Job.getError | ( | self, | |
| Optional, | |||
| Exception | |||
| ) |
Get the error that was encountered during execution.
| def UM.Job.Job.getResult | ( | self, | |
| Any | |||
| ) |
Get the result of the job.
The actual result object returned by this method is dependant on the implementation.
| def UM.Job.Job.hasError | ( | self, | |
| bool | |||
| ) |
Check whether the Job has encountered an error during execution.
| def UM.Job.Job.isFinished | ( | self, | |
| bool | |||
| ) |
Check whether the job has finished processing.
| def UM.Job.Job.isRunning | ( | self, | |
| bool | |||
| ) |
Check whether the job is currently running.
| def UM.Job.Job.run | ( | self, | |
| None | |||
| ) |
Perform the actual task of this job.
Should be reimplemented by subclasses.
| NotImplementedError |
| def UM.Job.Job.setError | ( | self, | |
| 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. |
| def UM.Job.Job.setResult | ( | self, | |
| result | |||
| ) |
| def UM.Job.Job.start | ( | self, | |
| None | |||
| ) |
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. |