Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Job.Job Class Reference
Inheritance diagram for UM.Job.Job:
UM.FileHandler.ReadFileJob.ReadFileJob UM.FileHandler.WriteFileJob.WriteFileJob UM.Scene.Platform._LoadPlatformJob UM.Mesh.ReadMeshJob.ReadMeshJob

Public Member Functions

None __init__ (self)
None run (self)
Any getResult (self)
None setResult (self, Any result)
None setError (self, Exception error)
None start (self)
None cancel (self)
bool isRunning (self)
bool isFinished (self)
bool hasError (self)
Optional[Exception] getError (self)

Static Public Member Functions

None yieldThread ()

Static Public Attributes

 finished = Signal()
 progress = Signal()

Protected Attributes

bool _running = False
bool _finished = False
 _result = None
 _message = None
 _error = None

Detailed Description

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.
:sa JobQueue

Member Function Documentation

◆ cancel()

None UM.Job.Job.cancel ( self)
Cancel the job.

This will remove the Job from the JobQueue. If the run() function has already been called,
this will do nothing.

◆ getError()

Optional[Exception] UM.Job.Job.getError ( self)
Get the error that was encountered during execution.

:return: The error encountered during execution or None if there was no error.

◆ getResult()

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.

◆ hasError()

bool UM.Job.Job.hasError ( self)
Check whether the Job has encountered an error during execution.

:return: True if an error was set, False if not.

◆ isFinished()

bool UM.Job.Job.isFinished ( self)
Check whether the job has finished processing.

◆ isRunning()

bool UM.Job.Job.isRunning ( self)
Check whether the job is currently running.

:return:

◆ run()

None UM.Job.Job.run ( self)
Perform the actual task of this job. Should be reimplemented by subclasses.

:exception NotImplementedError

Reimplemented in UM.FileHandler.ReadFileJob.ReadFileJob, UM.FileHandler.WriteFileJob.WriteFileJob, UM.Mesh.ReadMeshJob.ReadMeshJob, and UM.Scene.Platform._LoadPlatformJob.

◆ setError()

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.

:param error: The exception to set.

◆ setResult()

None UM.Job.Job.setResult ( self,
Any result )
Set the result of this job.

This should be called by run() to set the actual result of the Job.

◆ start()

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.

:sa JobQueue::add()

◆ yieldThread()

None UM.Job.Job.yieldThread ( )
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.

The documentation for this class was generated from the following file:
  • UM/Job.py