IGLib
1.7.2
The IGLib base library for development of numerical, technical and business applications.
|
Contains input data and results of a parallel job to be executed, oropertied indicating the state of the job, and methods for interaction with job performer and dispatcher. More...
Public Member Functions | |
ParallelJobContainerBase () | |
Constructs a new parallel data container. More... | |
void | NotifyJobStarted () |
Notifies this job data container that its job has started. More... | |
void | NotifyJobFinished () |
Notifies this job data container that its job has finished. More... | |
void | NotifyJobAborted () |
Notifies this job data container that its job has been aborted. More... | |
void | WaitJobCompletion () |
Waits for job completion. More... | |
bool | WaitJobCompletion (double timeoutInSeconds) |
Wait until the current job whose data is contained in this object completes, or timeout occurs (timeout specified in seconds), and returns a flag indicating whether the job has actually completed (i.e. stop was not due to timeout). More... | |
override string | ToString () |
Returns a string representation of the current job dispatcher, which contains relevent data about the server state. More... | |
Static Public Member Functions | |
static void | TestPerformance (int numPoints, int numServers, int maxEnqueued, double delayTimeSeconds, double delayTimeRelativeError, int sleepTimeMs, int clientOutputLevel) |
Test of parallel job execution by calculating the specified real function of one variable in a number of points. Calculatin is performed in parallel threads by using job dispatcher with parallel servers. More... | |
static void | TestPerformance (double from, double to, int numPoints, SimpleFunctionDelegate< double, double > evaluationFunction, int numServers, int maxEnqueued, double delayTimeSeconds, double delayTimeRelativeError, int sleepTimeMs, int clientOutputLevel) |
Test of parallel job execution by calculating the specified real function of one variable in a number of points. Calculatin is performed in parallel threads by using job dispatcher with parallel servers. More... | |
Static Public Attributes | |
static volatile int | DefaultOutputLevel = -1 |
Default output level for objects of this and derived types. More... | |
static volatile bool | DefaultIsTestMode = false |
Default value of the testmode flag. More... | |
Protected Member Functions | |
virtual void | RunOnStarted () |
Called when 'started' notification is triggered (within the method NotifyJobStarted). More... | |
virtual void | RunOnFinished () |
Called when 'finished' notification is triggered (within the method NotifyJobFinished). More... | |
virtual void | RunOnAborted () |
Called when 'aborted' notification is triggered (within the method NotifyJobAborted). More... | |
Static Protected Member Functions | |
static int | GetNextId () |
Returns another ID that is unique for objects of the containing class its and derived classes. More... | |
Protected Attributes | |
ParallelJobState | _state = ParallelJobState.Uninitialized |
int | _dispatcherJobId = -1 |
int | _clientJobId = -1 |
object | _clientData |
int | _sleepTimeMs = DefaultSleepTimeMs |
ParallelJobDispatcherBase | _dispatcher |
int | _outputLevel = DefaultOutputLevel |
Output level for objects of this class. More... | |
bool | _isTestMode = DefaultIsTestMode |
volatile int | _numTestDelays = 1 |
double | _testDelayInSeconds = 1.0 |
double | _testDelayRelativeError = 0.0 |
ParallelJobCallback | _onStarted = null |
ParallelJobCallback | _onFinished = null |
ParallelJobCallback | _onAborted = null |
Properties | |
object | Lock [get] |
This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More... | |
ParallelJobState | State [get, set] |
State of the parallel job whose data is contained in the current object. More... | |
bool | IsJobCompleted [get] |
Flag indicating whether a job has finished. More... | |
static object | LockId [get] |
Lock used for acquiring IDs. More... | |
virtual int | Id [get] |
Unique ID for objects of the currnet and derived classes. More... | |
int | DispatcherJobId [get, protected set] |
Dispatcher's Id of the job contained in the current job data container. More... | |
int | ClientJobId [get, set] |
Client's Id of the job contained in the current job data container. More... | |
object | ClientData [get, protected set] |
Client's data for the job contained in the current job data container. More... | |
static int | DefaultSleepTimeMs [get, set] |
Default sleeping time, in milliseconds, used by parallel job data objects when waiting for fulfillment of some condition in a loop that includes sleeping when condition is not met. More... | |
int | SleepTimeMs [get, set] |
Sleeping time, in milliseconds, used by the current object when waiting for fulfillment of some condition in a loop that includes sleeping when condition is not met. More... | |
int | OutputLevel [get, set] |
Output level for the current object. More... | |
bool | IsTestMode [get, set] |
Whether the current job data conntainer is in test mode. In this mode, delays specified by internal variables are automatically added in job execution. More... | |
int | NumTestDelays [get, set] |
Number of time intervals into which the total delay interval (property TestDelayInSeconds) is divided. More... | |
double | TestDelayInSeconds [get, set] |
Delay time in the testing mode (in seconds), which is caused by calling sleep for the Thread.Sleep(int) method. More... | |
double | TestDelayRelativeError [get, set] |
Interval of random errors added to the test delay time, relative to unnoisy delay time. More... | |
int | TestDelaySingleMs [get] |
Single test delay interval in milliseconds. More... | |
ParallelJobCallback | OnStarted [get, set] |
Delegate that is executed on started event. More... | |
ParallelJobCallback | OnFinished [get, set] |
Delegate that is executed on started event. More... | |
ParallelJobCallback | OnAborted [get, set] |
Delegate that is executed on started event. More... | |
Properties inherited from IG.Lib.ILockable | |
object | Lock [get] |
Properties inherited from IG.Lib.IIdentifiable | |
int | Id [get] |
Returns unique ID (in the scope of a given type) of the current object. More... | |
Private Attributes | |
object | _mainLock = new object() |
int | _id = GetNextId() |
Static Private Attributes | |
static object | _lockId |
static int | _nextId = 0 |
static int | _defaultSleepTimeMs = 5 |
Contains input data and results of a parallel job to be executed, oropertied indicating the state of the job, and methods for interaction with job performer and dispatcher.
This class interacts with parallel job dispatcher that sends a job to the specific server, and with the parallel server that executes the job.
$A Igor Aug08;
|
inline |
Constructs a new parallel data container.
|
inlinestaticprotected |
Returns another ID that is unique for objects of the containing class its and derived classes.
References IG.Num.ParallelJobContainerBase.LockId.
|
inlineprotectedvirtual |
Called when 'started' notification is triggered (within the method NotifyJobStarted).
Reimplemented in IG.Num.ParallelJobContainerGen< InputType, ResultType >.
|
inlineprotectedvirtual |
Called when 'finished' notification is triggered (within the method NotifyJobFinished).
Reimplemented in IG.Num.ParallelJobContainerGen< InputType, ResultType >.
|
inlineprotectedvirtual |
Called when 'aborted' notification is triggered (within the method NotifyJobAborted).
Reimplemented in IG.Num.ParallelJobContainerGen< InputType, ResultType >.
|
inline |
Notifies this job data container that its job has started.
|
inline |
Notifies this job data container that its job has finished.
|
inline |
Notifies this job data container that its job has been aborted.
|
inline |
Waits for job completion.
|
inline |
Wait until the current job whose data is contained in this object completes, or timeout occurs (timeout specified in seconds), and returns a flag indicating whether the job has actually completed (i.e. stop was not due to timeout).
timeoutInSeconds | Timeot in seconds. |
|
inline |
Returns a string representation of the current job dispatcher, which contains relevent data about the server state.
|
inlinestatic |
Test of parallel job execution by calculating the specified real function of one variable in a number of points. Calculatin is performed in parallel threads by using job dispatcher with parallel servers.
numPoints | Number of equidistand points in which function is evaluated. |
numServers | Number of servers to be used. |
maxEnqueued | Maximal allowed number of jobs enquied. |
delayTimeSeconds | Delay tie iin seconds. |
delayTimeRelativeError | |
clientOutputLevel | Level of output on dispatching activity within the method. |
sleepTimeMs | Sleeping time for server threads. |
|
inlinestatic |
Test of parallel job execution by calculating the specified real function of one variable in a number of points. Calculatin is performed in parallel threads by using job dispatcher with parallel servers.
from | Lower bount of the interval on which function is evaluated. |
to | Upper bound of teh interval on which function is evaluated. |
numPoints | Number of equidistand points in which function is evaluated. |
evaluationFunction | Delegate that is used to evaluate functions. |
numServers | Number of servers to be used. |
maxEnqueued | Maximal allowed number of jobs enquied. |
delayTimeSeconds | Delay tie iin seconds. |
delayTimeRelativeError | |
clientOutputLevel | Level of output on dispatching activity within the method. |
sleepTimeMs | Sleeping time for server threads. |
|
private |
|
protected |
|
staticprivate |
|
staticprivate |
|
private |
|
protected |
|
protected |
|
protected |
|
staticprivate |
|
protected |
|
protected |
|
static |
Default output level for objects of this and derived types.
Also used for classes derived from ParallelJobServerBase{JT} and ParallelJobDispatcherBase
|
protected |
Output level for objects of this class.
Specifies how much output is printed to console during operation.
|
static |
Default value of the testmode flag.
Also used for classes derived from ParallelJobServerBase{CT} and ParallelJobDispatcherBase
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
get |
This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.
|
getset |
State of the parallel job whose data is contained in the current object.
|
get |
Flag indicating whether a job has finished.
Flag is undefined (exception thrown) if state is earlier than ParallelJobState.DataReady or it equals to or is later than ParallelJobState.ResultsProcessed.
|
staticget |
Lock used for acquiring IDs.
Referenced by IG.Num.ParallelJobServerBase< JobContainerType >.GetNextId(), IG.Num.ParallelJobContainerBase.GetNextId(), and IG.Num.ParallelJobDispatcherBase.GetNextId().
|
get |
Unique ID for objects of the currnet and derived classes.
Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().
|
getprotected set |
Dispatcher's Id of the job contained in the current job data container.
Id is normally assigned by the dispatcher.
|
getset |
Client's Id of the job contained in the current job data container.
Assigned (or not) by the client.
Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().
|
getprotected set |
Client's data for the job contained in the current job data container.
Assigned (or not) by the client who creates and sends this job.
This can be used to help the client determine how to treat results when finished.
|
staticgetset |
Default sleeping time, in milliseconds, used by parallel job data objects when waiting for fulfillment of some condition in a loop that includes sleeping when condition is not met.
|
getset |
Sleeping time, in milliseconds, used by the current object when waiting for fulfillment of some condition in a loop that includes sleeping when condition is not met.
DefaultSleepTimeMs specifies the default value that is set when object is created.
|
getset |
Output level for the current object.
Specifies how much output is printed to console during operation.
|
getset |
Whether the current job data conntainer is in test mode. In this mode, delays specified by internal variables are automatically added in job execution.
Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().
|
getset |
Number of time intervals into which the total delay interval (property TestDelayInSeconds) is divided.
Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().
|
getset |
Delay time in the testing mode (in seconds), which is caused by calling sleep for the Thread.Sleep(int) method.
Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().
|
getset |
Interval of random errors added to the test delay time, relative to unnoisy delay time.
Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().
|
getprotected |
Single test delay interval in milliseconds.
|
getset |
Delegate that is executed on started event.
When executing, job container is locked.
|
getset |
Delegate that is executed on started event.
When executing, job container is locked.
|
getset |
Delegate that is executed on started event.
When executing, job container is locked.