Class: Job

Job(connection, jobId)

A Batch Job.

Constructor

new Job(connection, jobId)

Creates an object representing a batch job stored at the back-end.

Parameters:
Name Type Description
connection Connection

A Connection object representing an established connection to an openEO back-end.

jobId string

The batch job ID.

Source:

Extends

Members

(protected) apiToClientNames :object.<string, string>

Type:
  • object.<string, string>
Overrides:
Source:

(readonly, nullable) budget :number

Maximum amount of costs the request is allowed to produce in the currency specified by the back-end.

Type:
  • number
Source:

(protected) clientToApiNames :object.<string, string>

Type:
  • object.<string, string>
Overrides:
Source:

(protected) connection :Connection

Type:
Overrides:
Source:

(readonly, nullable) costs :number

An amount of money or credits in the currency specified by the back-end.

Type:
  • number
Source:

(readonly) created :string

Date and time of creation, formatted as a RFC 3339 date-time.

Type:
  • string
Source:

(readonly, nullable) description :string

Type:
  • string
Source:

(protected) extra :object.<string, *>

Additional (non-standardized) properties received from the API.

Type:
  • object.<string, *>
Overrides:
Source:

(readonly) id :string

The identifier of the batch job.

Type:
  • string
Source:

(protected) lastRefreshTime :number

Type:
  • number
Overrides:
Source:

(readonly) plan :string

The billing plan to process and charge the batch job with.

Type:
  • string
Source:

(readonly) process :Process

The process chain to be executed.

Type:
Source:

(readonly) progress :number

Indicates the process of a running batch job in percent.

Type:
  • number
Source:

(readonly) status :string

The current status of a batch job. One of "created", "queued", "running", "canceled", "finished" or "error".

Type:
  • string
Source:

(readonly, nullable) title :string

Type:
  • string
Source:

(readonly) updated :string

Date and time of the last status change, formatted as a RFC 3339 date-time.

Type:
  • string
Source:

Methods

(protected) _convertToRequest(parameters) → {object.<string, *>}

Converts the object to a valid objects for API requests.

Parameters:
Name Type Description
parameters object.<string, *>
Overrides:
Source:
Returns:
Type
object.<string, *>

(protected) _supports(feature) → {boolean}

Checks whether a features is supported by the API.

Parameters:
Name Type Description
feature string
Overrides:
Source:
See:
Returns:
Type
boolean

debugJob() → {Logs}

Get logs for the batch job from the back-end.

Source:
Returns:
Type
Logs

(async) deleteJob()

Deletes the batch job from the back-end.

Source:
Throws:
Error

(async) describeJob() → {Promise.<Job>}

Updates the batch job data stored in this object by requesting the metadata from the back-end.

Source:
Throws:
Error
Returns:

The update job object (this).

Type
Promise.<Job>

(async) downloadResults(targetFolder) → {Promise.<(Array.<string>|void)>}

Downloads the results to the specified target folder. The specified target folder must already exist!

NOTE: This method is only supported in a NodeJS environment. In a browser environment this method throws an exception!

Parameters:
Name Type Description
targetFolder string

A target folder to store the file to, which must already exist.

Source:
Throws:
Error
Returns:

Depending on the environment: A list of file paths of the newly created files (Node), throws in Browsers.

Type
Promise.<(Array.<string>|void)>

(async) estimateJob() → {Promise.<JobEstimate>}

Calculate an estimate (potentially time/costs/volume) for a batch job.

Source:
Throws:
Error
Returns:

A response compatible to the API specification.

Type
Promise.<JobEstimate>

get(name) → {*}

Get a value from the additional data that is not part of the core model, i.e. from proprietary extensions.

Parameters:
Name Type Description
name string

Name of the property.

Overrides:
Source:
Returns:

The value, which could be of any type.

Type
*

getAll() → {object.<string, *>}

Returns all data in the model.

Overrides:
Source:
Returns:
Type
object.<string, *>

getDataAge() → {number}

Returns the age of the data in seconds.

Overrides:
Source:
Returns:

Age of the data in seconds as integer.

Type
number

(async) getResultsAsStac() → {Promise.<object.<string, *>>}

Retrieves the STAC Item or Collection produced for the job results.

The Item or Collection returned always complies to the latest STAC version (currently 1.0.0).

Source:
Throws:
Error
Returns:

The JSON-based response compatible to the API specification, but also including a costs property if present in the headers.

Type
Promise.<object.<string, *>>

(async) listResults() → {Promise.<Array.<Link>>}

Retrieves download links.

Source:
Throws:
Error
Returns:

A list of links (object with href, rel, title, type and roles).

Type
Promise.<Array.<Link>>

monitorJob(callback, intervalopt, requestLogsopt) → {function}

Checks for status changes and new log entries every x seconds.

On every status change observed or on new log entries (if supported by the back-end and not disabled via requestLogs), the callback is executed. It may also be executed once at the beginning. The callback receives the updated job (this object) and the logs (array) passed.

The monitoring stops once the job has finished, was canceled or errored out.

This is only supported if describeJob is supported by the back-end.

Returns a function that can be called to stop monitoring the job manually.

Parameters:
Name Type Attributes Default Description
callback function
interval number <optional>
60

Interval between update requests, in seconds as integer.

requestLogs boolean <optional>
true

Enables/Disables requesting logs

Source:
Throws:
Error
Returns:
Type
function

setAll(metadata) → {BaseEntity}

Converts the data from an API response into data suitable for our JS client models.

Parameters:
Name Type Description
metadata object.<string, *>

JSON object originating from an API response.

Overrides:
Source:
Returns:

Returns the object itself.

Type
BaseEntity

(async) startJob() → {Promise.<Job>}

Starts / queues the batch job for processing at the back-end.

Source:
Throws:
Error
Returns:

The updated job object (this).

Type
Promise.<Job>

(async) stopJob() → {Promise.<Job>}

Stops / cancels the batch job processing at the back-end.

Source:
Throws:
Error
Returns:

The updated job object (this).

Type
Promise.<Job>

toJSON() → {object.<string, *>}

Returns a JSON serializable representation of the data that is API compliant.

Overrides:
Source:
Returns:
Type
object.<string, *>

(async) updateJob(parameters) → {Promise.<Job>}

Modifies the batch job at the back-end and afterwards updates this object, too.

Parameters:
Name Type Description
parameters object

An object with properties to update, each of them is optional, but at least one of them must be specified. Additional properties can be set if the server supports them.

Properties
Name Type Description
process Process

A new process.

title string

A new title.

description string

A new description.

plan string

A new plan.

budget number

A new budget.

Source:
Throws:
Error
Returns:

The updated job object (this).

Type
Promise.<Job>