| IGLib 1.7.2 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Properties | Private Attributes | Static Private Attributes | List of all members
IG.Num.ParallelJobContainerBase Class Reference

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...

Inheritance diagram for IG.Num.ParallelJobContainerBase:
[legend]
Collaboration diagram for IG.Num.ParallelJobContainerBase:
[legend]

## 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

## Detailed Description

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;

## Constructor & Destructor Documentation

IG.Num.ParallelJobContainerBase.ParallelJobContainerBase | ( |  | ) |
| inline

Constructs a new parallel data container.

## Member Function Documentation

static int IG.Num.ParallelJobContainerBase.GetNextId | ( |  | ) |
| inline static protected

Returns another ID that is unique for objects of the containing class its and derived classes.

References IG.Num.ParallelJobContainerBase.LockId.

virtual void IG.Num.ParallelJobContainerBase.RunOnStarted | ( |  | ) |
| inline protected virtual

Called when 'started' notification is triggered (within the method NotifyJobStarted).

Reimplemented in IG.Num.ParallelJobContainerGen< InputType, ResultType >.

virtual void IG.Num.ParallelJobContainerBase.RunOnFinished | ( |  | ) |
| inline protected virtual

Called when 'finished' notification is triggered (within the method NotifyJobFinished).

Reimplemented in IG.Num.ParallelJobContainerGen< InputType, ResultType >.

virtual void IG.Num.ParallelJobContainerBase.RunOnAborted | ( |  | ) |
| inline protected virtual

Called when 'aborted' notification is triggered (within the method NotifyJobAborted).

Reimplemented in IG.Num.ParallelJobContainerGen< InputType, ResultType >.

void IG.Num.ParallelJobContainerBase.NotifyJobStarted | ( |  | ) |
| inline

Notifies this job data container that its job has started.

void IG.Num.ParallelJobContainerBase.NotifyJobFinished | ( |  | ) |
| inline

Notifies this job data container that its job has finished.

void IG.Num.ParallelJobContainerBase.NotifyJobAborted | ( |  | ) |
| inline

Notifies this job data container that its job has been aborted.

void IG.Num.ParallelJobContainerBase.WaitJobCompletion | ( |  | ) |
| inline

Waits for job completion.

bool IG.Num.ParallelJobContainerBase.WaitJobCompletion | ( | double | timeoutInSeconds | ) |
| 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).

Parameters

  timeoutInSeconds | Timeot in seconds.

Returns
  A flag indicating whether the job was actually completed when the function returned. If false is returned then timeout occurred.

override string IG.Num.ParallelJobContainerBase.ToString | ( |  | ) |
| inline

Returns a string representation of the current job dispatcher, which contains relevent data about the server state.

static void IG.Num.ParallelJobContainerBase.TestPerformance | ( | int | numPoints,
|  | int | numServers,
|  | int | maxEnqueued,
|  | double | delayTimeSeconds,
|  | double | delayTimeRelativeError,
|  | int | sleepTimeMs,
|  | int | clientOutputLevel
| ) |  |
| inline static

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.

Parameters

  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.

Returns
  Array of calculated results.

Parameters

  sleepTimeMs | Sleeping time for server threads.

static void IG.Num.ParallelJobContainerBase.TestPerformance | ( | double | from,
|  | double | to,
|  | int | numPoints,
|  | SimpleFunctionDelegate< double, double > | evaluationFunction,
|  | int | numServers,
|  | int | maxEnqueued,
|  | double | delayTimeSeconds,
|  | double | delayTimeRelativeError,
|  | int | sleepTimeMs,
|  | int | clientOutputLevel
| ) |  |
| inline static

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.

Parameters

  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.

Returns
  Array of calculated results.

Parameters

  sleepTimeMs | Sleeping time for server threads.

## Member Data Documentation

object IG.Num.ParallelJobContainerBase._mainLock = new object()
| private

ParallelJobState IG.Num.ParallelJobContainerBase._state = ParallelJobState.Uninitialized
| protected

object IG.Num.ParallelJobContainerBase._lockId
| static private

int IG.Num.ParallelJobContainerBase._nextId = 0
| static private

int IG.Num.ParallelJobContainerBase._id = GetNextId()
| private

int IG.Num.ParallelJobContainerBase._dispatcherJobId = -1
| protected

int IG.Num.ParallelJobContainerBase._clientJobId = -1
| protected

object IG.Num.ParallelJobContainerBase._clientData
| protected

int IG.Num.ParallelJobContainerBase._defaultSleepTimeMs = 5
| static private

int IG.Num.ParallelJobContainerBase._sleepTimeMs = DefaultSleepTimeMs
| protected

ParallelJobDispatcherBase IG.Num.ParallelJobContainerBase._dispatcher
| protected

volatile int IG.Num.ParallelJobContainerBase.DefaultOutputLevel = -1
| static

Default output level for objects of this and derived types.

Also used for classes derived from ParallelJobServerBase{JT} and ParallelJobDispatcherBase

int IG.Num.ParallelJobContainerBase._outputLevel = DefaultOutputLevel
| protected

Output level for objects of this class.

Specifies how much output is printed to console during operation.

volatile bool IG.Num.ParallelJobContainerBase.DefaultIsTestMode = false
| static

Default value of the testmode flag.

Also used for classes derived from ParallelJobServerBase{CT} and ParallelJobDispatcherBase

bool IG.Num.ParallelJobContainerBase._isTestMode = DefaultIsTestMode
| protected

volatile int IG.Num.ParallelJobContainerBase._numTestDelays = 1
| protected

double IG.Num.ParallelJobContainerBase._testDelayInSeconds = 1.0
| protected

double IG.Num.ParallelJobContainerBase._testDelayRelativeError = 0.0
| protected

ParallelJobCallback IG.Num.ParallelJobContainerBase._onStarted = null
| protected

ParallelJobCallback IG.Num.ParallelJobContainerBase._onFinished = null
| protected

ParallelJobCallback IG.Num.ParallelJobContainerBase._onAborted = null
| protected

## Property Documentation

object IG.Num.ParallelJobContainerBase.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.

ParallelJobState IG.Num.ParallelJobContainerBase.State
| get set

State of the parallel job whose data is contained in the current object.

bool IG.Num.ParallelJobContainerBase.IsJobCompleted
| 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.

object IG.Num.ParallelJobContainerBase.LockId
| static get

Lock used for acquiring IDs.

Referenced by IG.Num.ParallelJobServerBase< JobContainerType >.GetNextId(), IG.Num.ParallelJobContainerBase.GetNextId(), and IG.Num.ParallelJobDispatcherBase.GetNextId().

virtual int IG.Num.ParallelJobContainerBase.Id
| get

Unique ID for objects of the currnet and derived classes.

Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().

int IG.Num.ParallelJobContainerBase.DispatcherJobId
| get protected set

Dispatcher's Id of the job contained in the current job data container.

Id is normally assigned by the dispatcher.

int IG.Num.ParallelJobContainerBase.ClientJobId
| get set

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().

object IG.Num.ParallelJobContainerBase.ClientData
| get protected 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.

int IG.Num.ParallelJobContainerBase.DefaultSleepTimeMs
| static 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.

int IG.Num.ParallelJobContainerBase.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.

DefaultSleepTimeMs specifies the default value that is set when object is created.

int IG.Num.ParallelJobContainerBase.OutputLevel
| get set

Output level for the current object.

Specifies how much output is printed to console during operation.

bool IG.Num.ParallelJobContainerBase.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.

Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().

int IG.Num.ParallelJobContainerBase.NumTestDelays
| get set

Number of time intervals into which the total delay interval (property TestDelayInSeconds) is divided.

Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().

double IG.Num.ParallelJobContainerBase.TestDelayInSeconds
| get set

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().

double IG.Num.ParallelJobContainerBase.TestDelayRelativeError
| get set

Interval of random errors added to the test delay time, relative to unnoisy delay time.

Referenced by IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance().

int IG.Num.ParallelJobContainerBase.TestDelaySingleMs
| get protected

Single test delay interval in milliseconds.

ParallelJobCallback IG.Num.ParallelJobContainerBase.OnStarted
| get set

Delegate that is executed on started event.

When executing, job container is locked.

ParallelJobCallback IG.Num.ParallelJobContainerBase.OnFinished
| get set

Delegate that is executed on started event.

When executing, job container is locked.

ParallelJobCallback IG.Num.ParallelJobContainerBase.OnAborted
| get set

Delegate that is executed on started event.

When executing, job container is locked.

The documentation for this class was generated from the following file:

- igbase/numeric/parallel/ParallelJobContainerBase.cs