A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-request/Job/ below:

Job | ArcGIS REST JS

Class

Jobs represent long running processing tasks running on ArcGIS Services. Typically these represent complex analysis tasks such as geoprocessing tasks, logistics analysis such as fleet routing or spatial analysis tasks.

To create a Job, use the Job.submitJob method which will return an instance of the Job class with a unique id.

If you have an existing job you can use Job.serialize and Job.deserialize to save job information as a string and recreate the job to get results later.

Use dark colors for code blocks Copy

1
2
3
4
5
6
7
8
9
import { Job,  JOB_STATUSES  } from "@esri/arcgis-rest-request";

const job  = async Job.submitJob(options);

// will automatically wait for job completion and get results when the job is finished.
job.getAllResults().then((results) => {console.log(results)})

// watch for all status updates
job.on("status", ({jobStatus}) => {console.log(job.status)})

By default event monitoring is started when you call Job.waitForCompletion, Job.getAllResults or, Job.getResult and stops automatically when those promises complete. Use Job.startEventMonitoring and Job.stopEventMonitoring to manually start and stop event monitoring outside those methods. Starting monitoring with Job.startEventMonitoring will not stop monitoring when Job.waitForCompletion, Job.getAllResults or, Job.getResult complete.

Constructors Properties Property Type Notes authentication string | IAuthenticationManager

Authentication manager or access token to use for all job requests.

id string

The job id indicating the specific job.

url string

The base URL of the job.

authentication Class Property authentication: string | IAuthenticationManager

Authentication manager or access token to use for all job requests.

id Class Property id: string

The job id indicating the specific job.

url Class Property url: string

The base URL of the job.

Accessors Accessor Returns Notes get isMonitoring() boolean

Returns true if the job is polling for status changes.

get pollingRate() number

The rate at which event monitoring is occurring in milliseconds.

isMonitoring Class Accessor get isMonitoring(): boolean

Returns true if the job is polling for status changes.

Returns boolean pollingRate Class Accessor get pollingRate(): number

The rate at which event monitoring is occurring in milliseconds.

Returns number Methods Method Returns Notes cancelJob() Promise<any>

Cancels the job request and voids the job.

getAllResults() Promise<any>

Gets all the results from a successful job by ordering all the result paramUrl requests and calling each of them until all of them are complete and returns an object with all the results.

getJobInfo() Promise<IJobInfo>

Retrieves the status of the current job.

getResult(result) Promise<any>

Get the specific results of a successful job by result name. To get all results see Job.getAllResults.

off(eventName, handler) void

A handler that will remove a listener after its emitted and returns a custom handler.

on(eventName, handler) void

A handler that listens for an eventName and returns custom handler.

once(eventName, handler) void

A handler that listens for an event once and returns a custom handler.

serialize() string

Converts the Job to a JSON string. You can rehydrate the state of the Job with Job.deserialize.

startEventMonitoring(pollingRate) void

Starts the event polling if the user enables the startMonitoring param.

stopEventMonitoring() void

Stops the event polling rate. This is can only be enabled if the user calls this method directly.

toJSON() IJobOptions

Formats the requestOptions to JSON format.

waitForCompletion() Promise<IJobInfo>

Checks for job status and if the job status is successful it resolves the job information. Otherwise will throw a ArcGISJobError if it encounters a cancelled or failure status in the job.

deserialize(serializeString, options?) Promise<Job> fromExistingJob(options) Promise<Job>

Creates a new instance of Job from an existing job id.

submitJob(requestOptions) Promise<Job>

Submits a job request that will return a new instance of Job.

cancelJob Class Method cancelJob(): Promise<any>

Cancels the job request and voids the job.

Returns Promise<any>

An object that has job id, job status and messages array sequencing the status of the cancellation being submitted and completed.

getAllResults Class Method getAllResults(): Promise<any>

Gets all the results from a successful job by ordering all the result paramUrl requests and calling each of them until all of them are complete and returns an object with all the results.

If monitoring is disabled it will be enabled until the job classes resolves or rejects this promise.

Use dark colors for code blocks Copy

1
2
3
4
5
6
7
8
9
10
Job.submitJob(options)
 .then((job) => {
   return job.getAllResults();
 }).then(allResults => {
   console.log(allResults);
 }).catch(e => {
   if(e.name === "ArcGISJobError") {
     console.log("Something went wrong while running the job", e.jobInfo);
   }
 })

Will throw a ArcGISJobError if it encounters a cancelled or failure status in the job.

Returns Promise<any>

An object representing all the results from a job.

getJobInfo Class Method getJobInfo(): Promise<IJobInfo>

Retrieves the status of the current job.

Returns Promise<IJobInfo>

An object with the job id and jobStatus.

getResult Class Method getResult(result: string): Promise<any>

Get the specific results of a successful job by result name. To get all results see Job.getAllResults.

If monitoring is disabled it will be enabled until the job classes resolves or rejects this promise.

Use dark colors for code blocks Copy

1
2
3
4
5
6
7
8
9
10
Job.submitJob(options)
 .then((job) => {
   return job.getResult("result_name")
 }).then(result => {
   console.log(result);
 }).catch(e => {
   if(e.name === "ArcGISJobError") {
     console.log("Something went wrong while running the job", e.jobInfo);
   }
 })

Will throw a ArcGISJobError if it encounters a cancelled or failure status in the job.

Parameters Parameter Type Notes result string

The name of the result that you want to retrieve.

Returns Promise<any>

An object representing the individual result of the job.

off Class Method off(eventName: string, handler: (e: IJobInfo) => void): void

A handler that will remove a listener after its emitted and returns a custom handler.

Parameters Parameter Type Notes eventName string

A string of what event to listen for.

handler (e: IJobInfo) => void

A function of what to do when eventName was called.

Returns void on Class Method on(eventName: string, handler: (e: IJobInfo) => void): void

A handler that listens for an eventName and returns custom handler.

Parameters Parameter Type Notes eventName string

A string of what event to listen for.

handler (e: IJobInfo) => void

A function of what to do when eventName was called.

Returns void once Class Method once(eventName: string, handler: (e: IJobInfo) => void): void

A handler that listens for an event once and returns a custom handler.

Parameters Parameter Type Notes eventName string

A string of what event to listen for.

handler (e: IJobInfo) => void

A function of what to do when eventName was called.

Returns void serialize Class Method serialize(): string

Converts the Job to a JSON string. You can rehydrate the state of the Job with Job.deserialize.

Returns string

A JSON string representing the Job.

startEventMonitoring Class Method startEventMonitoring(pollingRate: number): void

Starts the event polling if the user enables the startMonitoring param.

Parameters Parameter Type Default Notes pollingRate number ...

Able to pass in a specific number or will default to 5000.

Returns void stopEventMonitoring Class Method stopEventMonitoring(): void

Stops the event polling rate. This is can only be enabled if the user calls this method directly.

Returns void toJSON Class Method toJSON(): IJobOptions

Formats the requestOptions to JSON format.

Returns IJobOptions

The Job as a plain JavaScript object.

waitForCompletion Class Method waitForCompletion(): Promise<IJobInfo>

Checks for job status and if the job status is successful it resolves the job information. Otherwise will throw a ArcGISJobError if it encounters a cancelled or failure status in the job.

Use dark colors for code blocks Copy

1
2
3
4
5
6
7
8
9
10
11
12
Job.submitJob(options)
 .then((job) => {
   return job.waitForCompletion();
 })
.then((jobInfo) => {
   console.log("job finished", e.jobInfo);
 })
.catch(e => {
   if(e.name === "ArcGISJobError") {
     console.log("Something went wrong while running the job", e.jobInfo);
   }
 })
Returns Promise<IJobInfo>

An object with a successful job status, id, and results.

deserialize

static

Class Method deserialize(serializeString: string, options?: IJobOptions): Promise<Job> Parameters Parameter Type serializeString string options IJobOptions Returns Promise<Job> fromExistingJob

static

Class Method fromExistingJob(options: IJobOptions): Promise<Job>

Creates a new instance of Job from an existing job id.

Parameters Parameter Type Notes options IJobOptions

Requires request endpoint url and id from an existing job id.

Returns Promise<Job>

An new instance of Job class with options.

submitJob

static

Class Method submitJob(requestOptions: ISubmitJobOptions): Promise<Job>

Submits a job request that will return a new instance of Job.

Parameters Parameter Type Notes requestOptions ISubmitJobOptions

Requires url and params from requestOptions.

Returns Promise<Job>

An new instance of Job class with the returned job id from submitJob request and requestOptions;


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4