FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
Structure of an Agent with all required parameters. More...
Public Member Functions | |
__construct ($agentName, $version, $revision) | |
scheduler_connect () | |
Connect with scheduler and initialize options. More... | |
heartbeat ($newProcessed) | |
Send hear beat to the scheduler. More... | |
bail ($exitvalue) | |
Bail the agent, print the stack and disconnect from scheduler. More... | |
scheduler_disconnect ($exitvalue) | |
Closes connection from scheduler. More... | |
scheduler_greet () | |
Greet the scheduler at the beginning of connection. More... | |
initArsTable () | |
Initialize ARS table. | |
run_scheduler_event_loop () | |
Runs a loop to read commands from scheduler and process them. More... | |
Static Public Member Functions | |
static | heartbeat_handler ($signo) |
Function to handle hear beats from the agent and send them to the scheduler from STDOUT. More... | |
Protected Member Functions | |
processUploadId ($uploadId) | |
Given an upload ID, process the items in it. More... | |
Protected Attributes | |
$userId | |
$groupId | |
$jobId | |
$agentSpecifOptions = "" | |
$agentSpecifLongOptions = array() | |
$args = array() | |
$dbManager | |
$agentDao | |
$container | |
$schedulerMode | |
Private Member Functions | |
scheduler_current () | |
Read the commands from scheduler. More... | |
Private Attributes | |
$agentName | |
$agentVersion | |
$agentRev | |
$agentDesc | |
$agentArs | |
$agentId | |
Structure of an Agent with all required parameters.
All PHP language based agents should inherit from this class.
Fossology\Lib\Agent\Agent::__construct | ( | $agentName, | |
$version, | |||
$revision | |||
) |
Fossology\Lib\Agent\Agent::bail | ( | $exitvalue | ) |
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.
int | $newProcessed | Number of items processed since last call. |
|
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
.
int | $signo | Interrupt signal. |
|
abstractprotected |
Given an upload ID, process the items in it.
This function is implemented by agent and should call heartbeat() at regular intervals.
int | $uploadId | Upload to be processed by the agent. |
Reimplemented in UnifiedReport, Fossology\SpdxTwo\SpdxTwoAgent, Fossology\Spasht\SpashtAgent, Fossology\SoftwareHeritage\softwareHeritageAgent, Fossology\Reuser\ReuserAgent, Fossology\Reso\ResoAgent, Fossology\ReportImport\ReportImportAgent, ReadmeOssAgent, Fossology\DecisionImporter\DecisionImporterAgent, DecisionExporter, Fossology\DeciderJob\DeciderJobAgent, Fossology\Decider\DeciderAgent, Fossology\CycloneDX\CycloneDXAgent, and Fossology\CliXml\CliXml.
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:
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.
|
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.
Fossology\Lib\Agent\Agent::scheduler_disconnect | ( | $exitvalue | ) |
Fossology\Lib\Agent\Agent::scheduler_greet | ( | ) |
|
private |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
protected |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |