Structure of an Agent with all required parameters.
More...
|
static | heartbeat_handler ($signo) |
| Function to handle hear beats from the agent and send them to the scheduler from STDOUT. More...
|
|
Structure of an Agent with all required parameters.
All PHP language based agents should inherit from this class.
Definition at line 51 of file Agent.php.
Fossology\Lib\Agent\Agent::__construct |
( |
|
$agentName, |
|
|
|
$version, |
|
|
|
$revision |
|
) |
| |
Constructor for Agent class
- Parameters
-
string | $agentName | Name of the agent |
string | $version | Version of the agent |
string | $revision | Revision of the agent |
Definition at line 119 of file Agent.php.
Fossology\Lib\Agent\Agent::bail |
( |
|
$exitvalue | ) |
|
Bail the agent, print the stack and disconnect from scheduler.
- Parameters
-
int | $exitvalue | Exit value to sent to scheduler |
- Exceptions
-
Definition at line 232 of file Agent.php.
Fossology\Lib\Agent\Agent::heartbeat |
( |
|
$newProcessed | ) |
|
Send hear beat to the scheduler.
If the agent is running in scheduler mode, it will dispatch the heart beat signal for the scheduler. This signal is handled by heartbeat_handler() .
The function set the global processed
variable and alive
variable.
- Parameters
-
int | $newProcessed | Number of items processed since last call. |
Definition at line 214 of file Agent.php.
static Fossology\Lib\Agent\Agent::heartbeat_handler |
( |
|
$signo | ) |
|
|
static |
Function to handle hear beats from the agent and send them to the scheduler from STDOUT.
The function reads from global parameters processed
and alive
to know the state of the agent. processed
contains the number of items processed by the agent and alive
flag have to be reset to TRUE
by the agent to signal its status. The function resets the alive
flag to FALSE
.
- Parameters
-
int | $signo | Interrupt signal. |
Definition at line 195 of file Agent.php.
Fossology\Lib\Agent\Agent::processUploadId |
( |
|
$uploadId | ) |
|
|
abstractprotected |
Given an upload ID, process the items in it.
This function is implemented by agent and should call heartbeat() at regular intervals.
- Parameters
-
int | $uploadId | Upload to be processed by the agent. |
Fossology\Lib\Agent\Agent::run_scheduler_event_loop |
( |
| ) |
|
Runs a loop to read commands from scheduler and process them.
The function loops till scheduler_current() returns FALSE
(end of connection).
The flow of the function:
- Send new heat beat to the scheduler.
- Extract upload id from the scheduler.
- Write the ARS record.
- Process the upload using processUploadId().
- Write processed ARS record.
- Loop back and read for next command from scheduler.
Definition at line 321 of file Agent.php.
Fossology\Lib\Agent\Agent::scheduler_connect |
( |
| ) |
|
Connect with scheduler and initialize options.
This function reads arguments passed from the CLI to the agent and initialize parameters according to them. It also greets the scheduler and setup signal alarms to keep connection active.
- See also
- scheduler_greet()
Definition at line 150 of file Agent.php.
Fossology\Lib\Agent\Agent::scheduler_current |
( |
| ) |
|
|
private |
Read the commands from scheduler.
Read the commands sent from scheduler (from STDIN). The function returns FALSE
if the connection is closed by the scheduler (received CLOSE
or END
) otherwise the command received.
- Returns
- boolean|string Command from scheduler (FALSE if CLOSE or END is received).
Definition at line 294 of file Agent.php.
Fossology\Lib\Agent\Agent::scheduler_disconnect |
( |
|
$exitvalue | ) |
|
Closes connection from scheduler.
The function sends a BYE <exit-value>
to the scheduler to close the connection along with final heart beat only if the agent is running in scheduler mode.
- Parameters
-
int | $exitvalue | Exit value to sent to scheduler |
Definition at line 247 of file Agent.php.
Fossology\Lib\Agent\Agent::scheduler_greet |
( |
| ) |
|
Greet the scheduler at the beginning of connection.
The function sends the agent version and an OK
message through STDOUT.
Definition at line 260 of file Agent.php.
string Fossology\Lib\Agent\Agent::$agentArs |
|
private |
AgentDao Fossology\Lib\Agent\Agent::$agentDao |
|
protected |
string Fossology\Lib\Agent\Agent::$agentDesc |
|
private |
int Fossology\Lib\Agent\Agent::$agentId |
|
private |
string Fossology\Lib\Agent\Agent::$agentName |
|
private |
Name of the agent
Definition at line 55 of file Agent.php.
string Fossology\Lib\Agent\Agent::$agentRev |
|
private |
array Fossology\Lib\Agent\Agent::$agentSpecifLongOptions = array() |
|
protected |
Agent specific CLI long options (used for communication with scheduler)
Definition at line 91 of file Agent.php.
string Fossology\Lib\Agent\Agent::$agentSpecifOptions = "" |
|
protected |
Agent specific CLI options (used for communication with scheduler)
Definition at line 86 of file Agent.php.
string Fossology\Lib\Agent\Agent::$agentVersion |
|
private |
Version of the agent
Definition at line 58 of file Agent.php.
array Fossology\Lib\Agent\Agent::$args = array() |
|
protected |
Arguments value (from CLI) map for current agent
Definition at line 95 of file Agent.php.
ContainerBuilder Fossology\Lib\Agent\Agent::$container |
|
protected |
Symfony DI container
Definition at line 107 of file Agent.php.
DbManager Fossology\Lib\Agent\Agent::$dbManager |
|
protected |
DB manager used by agent
Definition at line 99 of file Agent.php.
int Fossology\Lib\Agent\Agent::$groupId |
|
protected |
Current group ID
Definition at line 77 of file Agent.php.
int Fossology\Lib\Agent\Agent::$jobId |
|
protected |
Job ID for the agent to work on
Definition at line 80 of file Agent.php.
bool Fossology\Lib\Agent\Agent::$schedulerMode |
|
protected |
Running in scheduler mode or standalone
Definition at line 111 of file Agent.php.
int Fossology\Lib\Agent\Agent::$userId |
|
protected |
Current user ID
Definition at line 74 of file Agent.php.
The documentation for this class was generated from the following file: