FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
Library of functions used by the UI to manage jobs. More...
Go to the source code of this file.
Functions | |
JobAddUpload ($userId, $groupId, $job_name, $filename, $desc, $UploadMode, $folder_pk, $public_perm=Auth::PERM_NONE, $setGlobal=0) | |
Insert a new upload record, and update the foldercontents table. More... | |
JobQueueAdd ($job_pk, $jq_type, $jq_args, $jq_runonpfile, $Depends, $host=NULL, $jq_cmd_args=NULL) | |
Insert a jobqueue + jobdepends records. More... | |
GetJobList ($status) | |
Gets the list of jobqueue records with the requested $status. More... | |
QueueUploadsOnAgents ($upload_pk_list, $agent_list, $Verbose) | |
Schedule agent tasks on upload ids. More... | |
QueueUploadsOnDelagents ($upload_pk_list) | |
Schedule delagent on upload ids. More... | |
IsAlreadyScheduled ($job_pk, $AgentName, $upload_pk) | |
Check if an agent is already scheduled in a job. More... | |
CommonAgentAdd ($plugin, $job_pk, $upload_pk, &$ErrorMsg, $Dependencies, $jqargs="", $jq_cmd_args=NULL) | |
Queue an agent. This is a simple version of AgentAdd() that can be used by multiple plugins that only use upload_pk as jqargs. More... | |
isAlreadyRunning ($agentName, $upload_pk) | |
Check if an agent is already running in a job. More... | |
Library of functions used by the UI to manage jobs.
Jobs information is stored in the jobs, jobdepends and jobqueue tables.
JobQueue tasks may have dependencies upon the completion of other JobQueue tasks. The jobdepends tables keep those parent child relationships.
Definition in file common-job.php.
CommonAgentAdd | ( | $plugin, | |
$job_pk, | |||
$upload_pk, | |||
& | $ErrorMsg, | ||
$Dependencies, | |||
$jqargs = "" , |
|||
$jq_cmd_args = NULL |
|||
) |
Queue an agent. This is a simple version of AgentAdd() that can be used by multiple plugins that only use upload_pk as jqargs.
Before queuing, check if agent needs to be queued. It doesn't need to be queued if:
Plugin | $plugin | Caller plugin object | |
int | $job_pk | ||
int | $upload_pk | ||
[out] | string | &$ErrorMsg | Error message on failure |
array | $Dependencies | Array of named dependencies. Each array element is the plugin name. For example, array(agent_adj2nest, agent_pkgagent). Typically, this will just be array(agent_adj2nest). | |
string | $jqargs | (optional) jobqueue.jq_args |
Definition at line 433 of file common-job.php.
GetJobList | ( | $status | ) |
Gets the list of jobqueue records with the requested $status.
string | $status | The status might be: Started, Completed, Restart, Failed, Paused, etc. The status 'Started' and 'Restart', you can call them as running status to get all the running job list, you can set the $status as 'tart' |
Definition at line 244 of file common-job.php.
isAlreadyRunning | ( | $agentName, | |
$upload_pk | |||
) |
Check if an agent is already running in a job.
This is used to make sure dependencies don't get scheduled multiple times when the latest scan is not finished.
string | $agentName | The agent name (from agent.agent_name) |
int | $upload_pk | The upload id |
Definition at line 498 of file common-job.php.
IsAlreadyScheduled | ( | $job_pk, | |
$AgentName, | |||
$upload_pk | |||
) |
Check if an agent is already scheduled in a job.
This is used to make sure dependencies, like unpack don't get scheduled multiple times within a single job.
int | $job_pk | The job to be checked |
string | $AgentName | The agent name (from agent.agent_name) |
Definition at line 378 of file common-job.php.
JobAddUpload | ( | $userId, | |
$groupId, | |||
$job_name, | |||
$filename, | |||
$desc, | |||
$UploadMode, | |||
$folder_pk, | |||
$public_perm = Auth::PERM_NONE , |
|||
$setGlobal = 0 |
|||
) |
Insert a new upload record, and update the foldercontents table.
int | $userId | User creating the job |
int | $groupId | Group creating the job |
string | $job_name | Job name |
string | $filename | For upload from URL, this is the URL. For upload from file, this is the filename. For upload from server, this is the file path. |
string | $desc | Optional user file description. |
int | $UploadMode | 1<<2=URL, 1<<3=upload from server or file |
int | $folder_pk | The folder to contain this upload |
int | $public_perm | The public permission on this upload |
** Add user permission to perm_upload ****
Definition at line 56 of file common-job.php.
JobQueueAdd | ( | $job_pk, | |
$jq_type, | |||
$jq_args, | |||
$jq_runonpfile, | |||
$Depends, | |||
$host = NULL , |
|||
$jq_cmd_args = NULL |
|||
) |
Insert a jobqueue + jobdepends records.
int | $job_pk | The job primary key (returned by JobAddJob) |
string | $jq_type | Name of agent (should match the name in agent.conf |
string | $jq_args | Arguments to pass to the agent in the form of $jq_args="folder_pk='$Folder' name='$Name' description='$Desc' ..."; |
string | $jq_runonpfile | Column name |
array | $Depends | Array of jq_pk's this jobqueue is dependent on. |
string | $host | Host required for the job |
string | $jq_cmd_args | Command line arguments |
Definition at line 157 of file common-job.php.
QueueUploadsOnAgents | ( | $upload_pk_list, | |
$agent_list, | |||
$Verbose | |||
) |
Schedule agent tasks on upload ids.
string | $upload_pk_list | Upload ids, The string can be a comma-separated list of upload ids. Or, use 'ALL' to specify all upload ids. |
array | $agent_list | Array of agent plugin objects to schedule. |
bool | $Verbose | Verbose output, not empty: output, empty: does not output |
Definition at line 268 of file common-job.php.
QueueUploadsOnDelagents | ( | $upload_pk_list | ) |
Schedule delagent on upload ids.
string | $upload_pk_list | Upload ids, The string can be a comma-separated list of upload ids. Or, use 'ALL' to specify all upload ids. |
Definition at line 333 of file common-job.php.