ZendAPI_Job
class ZendAPI_Job (View source)
Describing a job in a queue In order to add/modify a job in the queue, a Job class must be created/retrieved and than saved in a queue
For simplicity, a job can be added directly to a queue and without creating an instant of a Queue object
Properties
int | $_id | Unique id of the Job in the job queue |
|
string | $_script | Full path of the script that this job calls when it's processed |
|
string | $_host | The host that the job was submit from |
|
string | $_name | A short string describing the job |
|
string | $_output | The job output after executing |
|
int | $_status | The status of the job By default, the job status is waiting to being execute. |
|
string | $_application_id | The application id of the job If the application id is not set, this job may get an application id automatically from the queue (if the queue was assigned one). By default it is null (which indicates no application id is assigned) |
|
int | $_priority | The priority of the job, options are the priority constants By default the priority is set to normal (JOB_QUEUE_PRIORITY_NORMAL) |
|
array | $_user_variables | Array holding all the variables that the user wants the job's script to have when it's called The structure is variable_name => variable_value i.e. if the user_variables array is array('my_var' => 8), when the script is called, a global variable called $my_var will have the int value of 8 By default there are no variables that we want to add to the job's script |
|
int | $_global_variables | Bit mask holding the global variables that the user want the job's script to have when it's called Options are prefixed with "JOB_QUEUESAVE" and may be: POST|GET|COOKIE|SESSION|RAW_POST|SERVER|FILES|ENV By default there are no global variables we want to add to the job's script i.e. In order to save the current GET and COOKIE global variables, this property should be JOB_QUEUE_SAVE_GET|JOB_QUEUE_SAVE_COOKIE (or the integer 6) In that case (of GET and COOKIE), when the job is added, the current $_GET and $_COOKIE variables should be saved, and when the job's script is called, those global variables should be populated |
|
mixed | $_predecessor | The job may have a dependency (another job that must be performed before this job) This property hold the id of the job that must be performed. if this variable is an array of integers, it means that there are several jobs that must be performed before this job By default there are no dependencies |
|
int | $_scheduled_time | The time that this job should be performed, this variables is the UNIX timestamp. |
|
int | $_interval | The job running frequency in seconds. The job should run every _internal seconds This property applys only to recurrent job. |
|
int | $_end_time | UNIX timestamp that it's the last time this job should occurs. If _interval was set, and _end_time was not, then this job will run forever. |
|
int | $_preserved | A bit that determine whether job can be deleted from history. When set, removeJob will not delete the job from history. |
Methods
Instantiate a Job object, describe all the information and properties of a job
Add the job the the specified queue (without instantiating a JobQueue object) This function should be used for extreme simplicity of the user when adding a single job, when the user want to insert more than one job and/or manipulating other jobs (or job tasks) he should create and use the JobQueue object Actually what this function do is to create a new JobQueue, login to it (with the given parameters), add this job to it and logout
Set a new priority to the job
No description
No description
No description
No description
No description
No description
No description
No description
No description
Get the job properties
Get the job output
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Get the current status of the job If this job was created and not returned from a queue (using the JobQueue::GetJob() function), the function will return false The status is one of the constants with the "JOB_QUEUESTATUS" prefix.
Get how much seconds there are until the next time the job will run.
For recurring job get the status of the last execution. For simple job, getLastPerformedStatus is equivalent to getJobStatus.
Details
Job
ZendAPI_Job(string $script)
Instantiate a Job object, describe all the information and properties of a job
int|false
addJobToQueue(string $jobqueue_url, string $password)
Add the job the the specified queue (without instantiating a JobQueue object) This function should be used for extreme simplicity of the user when adding a single job, when the user want to insert more than one job and/or manipulating other jobs (or job tasks) he should create and use the JobQueue object Actually what this function do is to create a new JobQueue, login to it (with the given parameters), add this job to it and logout
setJobPriority(int $priority)
Set a new priority to the job
setJobName($name)
No description
setScript($script)
No description
setApplicationID($app_id)
No description
setUserVariables($vars)
No description
setGlobalVariables($vars)
No description
setJobDependency($job_id)
No description
setScheduledTime($timestamp)
No description
setRecurrenceData($interval, $end_time = null)
No description
setPreserved($preserved)
No description
array
getProperties()
Get the job properties
mixed
getOutput()
Get the job output
getID()
No description
getHost()
No description
getScript()
No description
getJobPriority()
No description
getJobName()
No description
getApplicationID()
No description
getUserVariables()
No description
getGlobalVariables()
No description
getJobDependency()
No description
getScheduledTime()
No description
getInterval()
No description
getEndTime()
No description
getPreserved()
No description
int|false
getJobStatus()
Get the current status of the job If this job was created and not returned from a queue (using the JobQueue::GetJob() function), the function will return false The status is one of the constants with the "JOB_QUEUESTATUS" prefix.
E.g. job was performed and failed, job is waiting etc.
int
getTimeToNextRepeat()
Get how much seconds there are until the next time the job will run.
If the job is not recurrence or it past its end time, then return 0.
int
getLastPerformedStatus()
For recurring job get the status of the last execution. For simple job, getLastPerformedStatus is equivalent to getJobStatus.
jobs that haven't been executed yet will return STATUS_WAITING