Home Manual Reference Source Repository
public class | source

Task

The Task class is used to submit and inspect tasks.

Constructor Summary

Public Constructor
public

constructor(service: Service, taskName: string)

Member Summary

Public Members
public

The task name.

public

The parent service.

Method Summary

Public Methods
public

info(): Promise<TaskInfo, error>

Retrieves the task information.

public

submit(submitOptions: SubmitOptions, progressCallback: function(info: JobProgressInfo), startedCallback: function(info: JobStartedInfo)): Promise<Job, error>

Submits the job.

public

submitAndWait(submitOptions: SubmitOptions, progressCallback: function(info: JobProgressInfo), startedCallback: function(info: JobStartedInfo)): Promise<JobResults, error>

Submits the job and waits for results.

Public Constructors

public constructor(service: Service, taskName: string) source

Params:

NameTypeAttributeDescription
service Service

The service object.

taskName string

The name of the task.

Public Members

public name: string source

The task name.

public service: Service source

The parent service.

Public Methods

public info(): Promise<TaskInfo, error> source

Retrieves the task information.

Return:

Promise<TaskInfo, error>

Returns a promise to the TaskInfo object.

public submit(submitOptions: SubmitOptions, progressCallback: function(info: JobProgressInfo), startedCallback: function(info: JobStartedInfo)): Promise<Job, error> source

Submits the job.

Params:

NameTypeAttributeDescription
submitOptions SubmitOptions

The job submit options.

progressCallback function(info: JobProgressInfo)
  • optional

The callback to handle job progress.

startedCallback function(info: JobStartedInfo)
  • optional

The callback that is called when the job starts. For more reliable job started information, listen to the GSF JobStarted events as this callback may not always get called. In some cases the job can start before the callback is registered.

Return:

Promise<Job, error>

Returns a promise to a Job object.

public submitAndWait(submitOptions: SubmitOptions, progressCallback: function(info: JobProgressInfo), startedCallback: function(info: JobStartedInfo)): Promise<JobResults, error> source

Submits the job and waits for results. Resolves the promise if the job succeeds and rejects the promise if the job fails.

Params:

NameTypeAttributeDescription
submitOptions SubmitOptions

The job submit options.

progressCallback function(info: JobProgressInfo)
  • optional

The callback to handle job progress.

startedCallback function(info: JobStartedInfo)
  • optional

The callback that is called when the job starts. For more reliable job started information, listen to the GSF JobStarted events as this callback may not always get called. In some cases the job can start before the callback is registered.

Return:

Promise<JobResults, error>

Returns a promise to a Job object.