Symbiote\QueuedJobs\Tests\QueuedJobsTest\TestQJService
Synopsis
class TestQJService
extends QueuedJobService
implements
TestOnly
{
- // members
- private $logger;
- private static array $dependencies = ;
- // Inherited members from QueuedJobService
- protected integer $startedAt;
- public DefaultQueueHandler $queueHandler;
- public TaskRunnerEngine $queueRunner;
- public array $defaultJobs;
- // Inherited methods from QueuedJobService
- public void __construct()
- public int queueJob()
- public void startJob()
- public bool isAtMaxJobs()
- protected void copyJobToDescriptor()
- protected void copyDescriptorToJob()
- public QueuedJobDescriptor|null getNextPendingJob()
- public array checkJobHealth()
- public void checkDefaultJobs()
- protected void restartStalledJob()
- protected QueuedJob|boolean initialiseJob()
- protected bool grabMutex()
- public boolean runJob()
- protected mixed withNestedState()
- protected void handleBrokenJobException()
- protected null|Member setRunAsUser()
- protected void unsetRunAsUser()
- protected void markStarted()
- protected bool hasPassedTimeLimit()
- protected bool isMemoryTooHigh()
- protected float getMemoryUsage()
- protected float getMemoryLimit()
- protected float getPHPMemoryLimit()
- protected float parseMemory()
- protected void humanReadable()
- public array getJobList()
- public string getJobListFilter()
- public void runQueue()
- public void processJobQueue()
- public void onShutdown()
- public LoggerInterface getLogger()
- public void setLogger()
- public void enableMaintenanceLock()
- public void disableMaintenanceLock()
- public bool isMaintenanceLockActive()
- protected string getWorkerExpiry()
- protected string getInitStateExpiry()
- protected void releaseJobLock()
- protected void markJobAsBroken()
Hierarchy
Members
private
- $dependencies
- $logger
—
array
Not inherited from QueuedJobService unfortunately...
protected
- $startedAt
—
int
Timestamp (in seconds) when the queue was started
public
- $defaultJobs
—
array
Config controlled list of default/required jobs - $queueHandler — Symbiote\QueuedJobs\Services\DefaultQueueHandler
- $queueRunner — Symbiote\QueuedJobs\Tasks\Engines\TaskRunnerEngine
Methods
public
Inherited from Symbiote\QueuedJobs\Services\QueuedJobService
protected
- copyDescriptorToJob()
- copyJobToDescriptor() — Copies data from a job into a descriptor for persisting
- getInitStateExpiry() — Get expiry time for a INIT state of a queued job this helps to identify jobs that have stalled more accurately
- getMemoryLimit() — Determines the memory limit (in bytes) for this application Limits to the smaller of memory_limit configured via php.ini or silverstripe config
- getMemoryUsage() — Get peak memory usage of this application
- getPHPMemoryLimit() — Calculate the current memory limit of the server
- getWorkerExpiry() — Get expiry time for a worker to be operating on a job, helps to identify jobs that have stalled more accurately.
- grabMutex() — Given a {@link QueuedJobDescriptor} mark the job as initialised. Works sort of like a mutex.
- handleBrokenJobException()
- hasPassedTimeLimit() — Is execution time too long?
- humanReadable()
- initialiseJob() — Prepares the given jobDescriptor for execution. Returns the job that will actually be run in a state ready for executing.
- isMemoryTooHigh() — Is memory usage too high?
- markJobAsBroken() — Mark a Job as Broken and release the lock so it can be resumed
- markStarted() — Start timer
- parseMemory() — Convert memory limit string to bytes.
- releaseJobLock() — Release job lock on the descriptor so it can run again
- restartStalledJob() — Attempt to restart a stalled job
- setRunAsUser()
- unsetRunAsUser()
- withNestedState() — Provides a wrapper when executing arbitrary code contained in job implementation this ensures that job specific code doesn't alter the configuration of the queue runner execution
public
- checkDefaultJobs() — Checks through ll the scheduled jobs that are expected to exist
- checkJobHealth() — Runs an explicit check on all currently running jobs to make sure their "processed" count is incrementing between each run. If it's not, then we need to flag it as paused due to an error.
- disableMaintenanceLock()
- enableMaintenanceLock()
- getJobList() — Gets a list of all the current jobs (or jobs that have recently finished)
- getJobListFilter() — Return the SQL filter used to get the job list - this is used by the UI for displaying the job list...
- getLogger() — Get a logger
- getNextPendingJob() — Check the current job queues and see if any of the jobs currently in there should be started. If so, return the next job that should be executed
- isAtMaxJobs() — Check if maximum number of jobs are currently initialised.
- isMaintenanceLockActive()
- onShutdown() — When PHP shuts down, we want to process all of the immediate queue items
- processJobQueue() — Process all jobs from a given queue
- queueJob() — Adds a job to the queue to be started
- runJob() — Start the actual execution of a job.
- runQueue() — Process the job queue with the current queue runner
- setLogger()
- startJob() — Start a job (or however the queue handler determines it should be started)