Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor
A QueuedJobDescriptor is the stored representation of a piece of work that could take a while to execute, because of which it is desirable to not have it executing in parallel to other jobs.
A queued job should always attempt to report how many potential dataobjects will be affected by being executed;
this will determine which queue it is placed within so that some shorter jobs can execute immediately without needing
to wait for a potentially long running job.
- Author: Marcus Nyeholt <marcus@symbiote.com.au>
- License: BSD http://silverstripe.org/bsd-license/
Synopsis
class QueuedJobDescriptor
extends DataObject
{
- // members
- private static string $table_name = 'QueuedJobDescriptor';
- private static array $db = ;
- private static array $has_one = ;
- private static array $defaults = ;
- private static array $indexes = ;
- private static array $casting = ;
- private static array $searchable_fields = ;
- private static string $default_sort = 'Created DESC';
- private static bool $show_job_data = false;
- // methods
- public void requireDefaultRecords()
- public array summaryFields()
- public bool pause()
- public bool resume()
- public void restart()
- public void activateOnQueue()
- protected string getJobDir()
- public void execute()
- public void cleanupJob()
- public void onBeforeWrite()
- public void onBeforeDelete()
- public string|null getMessages()
- public string|null getLastMessage()
- public string getTitle()
- public string getJobTypeString()
- public string|null getSavedJobDataPreview()
- public string|null getMessagesRaw()
- public array getJobTypeValues()
- public array getJobStatusValues()
- public FieldList getCMSFields()
- private void getWorkerExpiry()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Members
private
- $casting — array
- $db — array
- $default_sort — string
- $defaults — array
- $has_one — array
- $indexes — array
- $searchable_fields — array
- $show_job_data
—
Symbiote\QueuedJobs\DataObjects\bool
Show job data and raw messages in the edit form - $table_name
—
string
{@inheritDoc}
Methods
private
protected
- getJobDir() — Gets the path to the queuedjob cache directory
public
- activateOnQueue() — Called to indicate that the job is ready to be run on the queue. This is done either as the result of creating the job and adding it, or when resuming.
- cleanupJob() — Called when the job has completed and we want to cleanup anything the descriptor has lying around in caches or the like.
- execute()
- getCMSFields()
- getJobStatusValues() — List all possible job statuses, useful for forms and filters
- getJobTypeString() — Return a string representation of the numeric JobType
- getJobTypeValues() — Return a map of numeric JobType values to localisable string representations.
- getLastMessage() — Get the last job message as a raw string
- getMessages() — Get all job messages as an HTML unordered list.
- getMessagesRaw()
- getSavedJobDataPreview()
- getTitle()
- onBeforeDelete()
- onBeforeWrite()
- pause() — Pause this job, but only if it is waiting, running, or init
- requireDefaultRecords()
- restart() — Restarts this job via a forced resume
- resume() — Resume this job and schedules it for execution
- summaryFields()