23 const PRE_JOB_QUEUE =
'preJq';
26 public $Name =
"agent_abstract";
27 public $Dependency = array();
28 public $Title =
'how to show checkbox';
29 public $PluginLevel = 10;
30 public $State = PLUGIN_STATE_READY;
33 function __construct()
39 function postInstall()
45 menu_insert(
"Agents::" . $this->Title, 0, $this->Name);
83 public function AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $arguments=null)
85 $dependencies[] =
"agent_adj2nest";
91 if ($jobQueueId != 0) {
95 $args = is_array($arguments) ?
'' : $arguments;
96 return $this->
doAgentAdd($jobId, $uploadId, $errorMsg, $dependencies, $uploadId, $args);
110 protected function doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs =
"", $jq_cmd_args = null)
113 foreach ($dependencies as $dependency) {
121 if (empty($jqargs)) {
124 $jobQueueId =
\JobQueueAdd($jobId, $this->AgentName, $jqargs,
"", $deps, NULL, $jq_cmd_args);
125 if (empty($jobQueueId)) {
126 $errorMsg =
"Failed to insert agent $this->AgentName into job queue. jqargs: $jqargs";
131 $errorMsg .=
"\n" . $output;
146 if (is_array($dependency)) {
147 $pluginName = $dependency[
'name'];
148 $depArgs = array_key_exists(
'args', $dependency) ? $dependency[
'args'] : null;
149 $preJq = array_key_exists(self::PRE_JOB_QUEUE, $dependency) ? $dependency[self::PRE_JOB_QUEUE] : array();
151 $pluginName = $dependency;
157 $errorMsg =
"Invalid plugin name: $pluginName, (implicitAgentAdd())";
161 return $depPlugin->AgentAdd($jobId, $uploadId, $errorMsg, $preJq, $depArgs);
164 function __toString()
IsAlreadyScheduled($job_pk, $AgentName, $upload_pk)
Check if an agent is already scheduled in a job.
implicitAgentAdd($jobId, $uploadId, &$errorMsg, $dependency)
JobQueueAdd($job_pk, $jq_type, $jq_args, $jq_runonpfile, $Depends, $host=NULL, $jq_cmd_args=NULL)
Insert a jobqueue + jobdepends records.
getStringRepresentation($vars, $classname)
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.
fo_communicate_with_scheduler($input, &$output, &$error_msg)
Communicate with scheduler, send commands to the scheduler, then get the output.
AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $arguments=null)
AgentHasResults($uploadId=0)
#define PLUGIN_DB_WRITE
Plugin requires write permission on DB.
doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs="", $jq_cmd_args=null)