Manual Reference Source
public class | source

Job

Extends:

events~EventEmitter → Job

The Job class is used for job operations.

Constructor Summary

Public Constructor
public

constructor(client: Client, jobId: string, progressCallback: function(info: JobProgressInfo), startedCallback: function(info: JobStartedInfo))

Member Summary

Public Members
public

The job Id.

Private Members
private

_client: *

private
private

_jobURL: *

private

Method Summary

Public Methods
public

cancel(force: boolean): Promise<true, error>

Cancels the job.

public

delete(): Promise<true, error>

Deletes the job.

public

file(fileName: *): Promise<arraybuffer, error>

Retrieves a workspace file.

public

info(): Promise<JobInfo, error>

Retrieves the job information.

public

wait(): Promise<JobResults, error>

Waits for the job to complete.

public

workspace(): Promise<Object[], error>

Retrieves a list of the workspace files.

Public Constructors

public constructor(client: Client, jobId: string, progressCallback: function(info: JobProgressInfo), startedCallback: function(info: JobStartedInfo)) source

Params:

NameTypeAttributeDescription
client Client

The GSF Client object.

jobId string

The jobId.

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.

Emit:

JobFailed

JobSucceeded

JobCompleted

JobStarted

JobAccepted

JobProgress

Public Members

public jobId: number source

The job Id.

Private Members

private _client: * source

private _handler: * source

private _jobURL: * source

private _waiting: * source

Public Methods

public cancel(force: boolean): Promise<true, error> source

Cancels the job.

Params:

NameTypeAttributeDescription
force boolean

If true, the job will force cancel. Please note that setting force to true may be unsafe depending on the type of job as it may not be able to properly shut down or clean up.

Return:

Promise<true, error>

Returns a promise when cancel is submitted. If request is successfully submitted, the promise will be resolved with a value of true. If the request fails, the promise will be resolved with an error message. Note that this only represents the success of the request made to the server, not the cancellation itself. Use the Job.Info() function (or Job events) to retrieve the status of the job and to learn when it is actually cancelled.

public delete(): Promise<true, error> source

Deletes the job.

Return:

Promise<true, error>

Returns a promise when delete is submitted. If request is successfully submitted, the promise will be resolved with a value of true. If the request fails, the promise will be resolved with an error message. Note that this only represents the success of the request made to the server, not the deletion itself. Use the Job.Info() function (or Job events) to retrieve the status of the job and to learn when it is actually deleted.

public file(fileName: *): Promise<arraybuffer, error> source

Retrieves a workspace file.

Params:

NameTypeAttributeDescription
fileName *

Return:

Promise<arraybuffer, error>

Returns a promise to an ArrayBuffer of the file contents.

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

Retrieves the job information.

Return:

Promise<JobInfo, error>

Returns a promise to a JobInfo object.

public wait(): Promise<JobResults, error> source

Waits for the job to complete.

Return:

Promise<JobResults, error>

Returns a promise that is resolved when a job is successful, returning the job results object. If a job fails, the promise is rejected with an error message.

public workspace(): Promise<Object[], error> source

Retrieves a list of the workspace files.

Return:

Promise<Object[], error>

Returns a promise to an array of fs.stat objects.