Task Class

Represents an individual task in the system. The task provides the function to run remotely.
Inheritance Hierarchy
SystemObject
  AGI.Parallel.InfrastructureTask
Namespace:  AGI.Parallel.Infrastructure
Assembly:  AGI.Parallel.Infrastructure (in AGI.Parallel.Infrastructure.dll) Version: 1.4.0.476 (1.4.0.476)
Syntax
[SerializableAttribute]
public abstract class Task

The Task type exposes the following members.

Constructors
  Name Description
Protected method Task
Initializes a new instance of the Task class
Top
Properties
  Name Description
Public property Id
Gets the unique handle of task.
Public property IsCancelling
Gets a value indicating whether this task is cancelling.
Public property IsFinishedTaskStatus
Gets a value indicating whether this task is finished.
Public property Name
Gets or sets the display name of the task.
Public propertyCode example Properties
Gets the properties of the task.
Public propertyCode example Result
Gets or sets Task's execution result.
Public propertyCode example StandardError
Gets the standard error of the host that executed the task.
Public propertyCode example StandardOutput
Gets the standard output of the host that executed the task.
Public propertyCode example TaskCancellationMessage
Gets the optional task cancellation message.
Public property TaskCancellationReason
Gets the reason why the task was canceled.
Public propertyCode example TaskStatus
Gets the task status.
Top
Methods
  Name Description
Public method Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public method Execute
Main entry point into Task when it is run on a Host.
Protected method Finalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public method GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public method GetProperty(String)
Returns property value by name. You can find common values for properties using TaskProperties.
Public method GetPropertyT(String)
Returns property value by name. You can find common values for properties using TaskProperties.
Public method GetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected method MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public method RemoveProperty
Removes the property from the property bag. You can find common values for properties using TaskProperties.
Public methodCode example SetProgress(Int32)
Sets progress of task. This value will be returned with AGI.Parallel.Client.Job.TaskProgressUpdated event.
Public methodCode example SetProgress(Int32, Object)
Sets progress of task. This value will be returned with AGI.Parallel.Client.Job.TaskProgressUpdated event.
Public method SetProperty(String, Object)
Sets properties on Task. You can find common values for properties using TaskProperties.
Public method SetPropertyT(String, T)
Sets property value. You can find common values for properties using TaskProperties.
Public method ToString
Returns a String that represents this instance.
(Overrides ObjectToString.)
Top
Events
  Name Description
Public event Completed
An event that is raised when this task is completed.
Public event ProgressUpdated
An event that is raised when this task's progress is updated.
Public event StatusChanged
An event that is raised when this task's TaskStatus changes.
Top
Remarks
You must implement this class so that it can be serialized by the .NET binary serializer. Add the SerializableAttribute attribute to your class and any other fields that this class references.
Examples
// You must always make the Task class serializable
[Serializable]
public class SimpleTask : Task
{
    // The instance of the class is automatically serialized with the task
    private int a;
    private int b;

    public SimpleTask(int first, int second)
    {
        a = first;
        b = second;
    }

    public override void Execute()
    {
        // Put your application logic in the Execute method
        Result = a + b;
    }
}
See Also

STK Scalability 1.4 API for .NET