Documentation

JobParallelWorker extends Worker
in package

Worker class for parallel job execution.

Table of Contents

Properties

$_id  : string
Thread ID.
$_key  : string
Unique key for identifying the process.
$_log  : Logger
Worker's logger.
$_params  : mixed
Parameters passed to the worker.
$_prio  : int
Process priority; requires the presence of 'nohup'.
$_timeLimit  : int
Time limit for executing the process.

Methods

__construct()  : mixed
Creates a new instance of the Worker class.
__get()  : mixed
Getter function to retrieve data related to the worker.
__set()  : mixed
Setter function to set data in the worker process.
Exists()  : bool
Checks if another instance of the process is running.
Prepare()  : void
Parses parameters from a string into an object.
PrepareParams()  : string
Prepares parameters for passing to the process.
Run()  : void
Runs the job routine.
Serialize()  : string
Serializes the worker object.
Unserialize()  : Worker
Deserializes the worker object.
WriteResults()  : bool
Writes results obtained from the worker.

Properties

$_id

Thread ID.

protected string $_id = ''

$_key

Unique key for identifying the process.

protected string $_key = ''

$_params

Parameters passed to the worker.

protected mixed $_params

$_prio

Process priority; requires the presence of 'nohup'.

protected int $_prio = 0

$_timeLimit

Time limit for executing the process.

protected int $_timeLimit = 0

Methods

__construct()

Creates a new instance of the Worker class.

public __construct([int $timeLimit = 0 ][, int $prio = 0 ][, string $key = '' ]) : mixed
Parameters
$timeLimit : int = 0

Time limit for executing the worker

$prio : int = 0

Process priority

$key : string = ''

Unique key for identifying the process

__get()

Getter function to retrieve data related to the worker.

public __get(string $prop) : mixed
Parameters
$prop : string

Property name

Return values
mixed

Property value

__set()

Setter function to set data in the worker process.

public __set(string $prop, mixed $val) : mixed
Parameters
$prop : string

Property name

$val : mixed

Property value

Exists()

Checks if another instance of the process is running.

public Exists() : bool
Return values
bool

true if running, false otherwise

Prepare()

Parses parameters from a string into an object.

public Prepare(mixed $params) : void
Parameters
$params : mixed

Serialized parameters to be deserialized

PrepareParams()

Prepares parameters for passing to the process.

public PrepareParams(mixed $params) : string
Parameters
$params : mixed

Parameters to be serialized

Return values
string

Serialized parameters

Serialize()

Serializes the worker object.

public Serialize() : string
Return values
string

Serialized worker object

Unserialize()

Deserializes the worker object.

public static Unserialize(string $workerString) : Worker
Parameters
$workerString : string

Serialized worker object string

Return values
Worker

Deserialized worker object

WriteResults()

Writes results obtained from the worker.

public WriteResults(object $args) : bool
Parameters
$args : object

Results obtained from the worker

Return values
bool

true if successfully written, false otherwise


        
On this page

Search results