Processing

Run processing jobs using the SDK.


Overview

Apply advanced processing to purchased geospatial data.

View repository

Class: ValidationError

A data class that represents errors encountered during job validation.

Attributes
AttributeDescription
messagestr
The message of the validation error.
namestr
The name of the validation error.

Class: JobStatus

An enumeration class that defines possible statuses for a job.

Constants
ConstantDescriptionValue
CREATEDThe job has been created, but not yet accepted.created
LICENSEDThe EULA has been accepted for this process. The job will move on to the validation stage.licensed
UNLICENSEDThe EULA hasn’t been accepted for this process. The job will fail. Accept the EULA through the console or the API and try again.unlicensed
VALIDThe job has been validated.valid
INVALIDThe job has failed validation. Fix your input parameters and try again.invalid
ACCEPTEDThe job has been validated and accepted. The credits corresponding to the price are temporarily withheld until the job is completed.accepted
REJECTEDThe job has been canceled due to an insufficient account balance. Top up your balance and try again.rejected
RUNNINGThe job is in progress.running
SUCCESSFULThe job has been completed, and the results have been delivered to your storage.successful
FAILEDThe job has failed.failed
CAPTUREDThe job has been completed, the results have been delivered to your storage, and any withheld credits have been deducted from your account balance.captured
RELEASEDThe job has failed. Any withheld credits have been released. Try again, and if the issue persists, contact support.released

Terminal statuses:

  • CAPTURED
  • RELEASED
  • INVALID
  • REJECTED
  • UNLICENSED

Class: JobResults

A dictionary class that contains job results.

Attributes
AttributeDescription
collectionOptional[str]
The URL of the resulting STAC collection.
errorsOptional[List[dict]]
A list of errors.

Class: JobMetadata

A dictionary class that contains job metadata.

Attributes
AttributeDescription
processIDstr
The process ID in a name format.
jobIDstr
The job ID.
accountIDstr
The account ID.
workspaceIDOptional[str]
The workspace ID.
definitiondict
An implementation of the OGC Standard, but with different default response values. Results are always provided with permanent links and a job’s results field only contains references or errors.
resultsOptional[JobResults]
Job results.
creditConsumptionOptional[dict]
The number of consumed credits. If the process has failed, the value is null.
statusstr
The job status.
createdstr
The timestamp when the job was created.
startedOptional[str]
The timestamp when the job was started.
finishedOptional[str]
The timestamp when the job was finished.
updatedstr
The timestamp when the job was last updated.

Class: UnfinishedJob

An exception class that is raised when a job hasn’t yet been finished.

Class: JobSorting

A class that contains predefined sorting fields.

Attributes
AttributeDescription
process_idutils.SortingField
Sorts by process ID. The default order is ascending.
statusutils.SortingField
Sorts by job status. The default order is descending.
createdutils.SortingField
Sorts by creation date. The default order is descending.
creditsutils.SortingField
Sorts by credit consumption. The default order is descending.

Python

    up42.Job.all(sort_by=up42.JobSorting.credits.asc) # Sort by credit amount, from the least to the most expensive

up42.Job.all(sort_by=up42.JobSorting.created.desc) # Sort by creation date, from the most recent to the earliest

  

Class: Job

A data class that represents a job in the system.

Attributes
AttributeDescription
process_idstr
The process ID in a name format.
idstr
The job ID.
account_idstr
The account ID.
workspace_idOptional[str]
The workspace ID.
definitiondict
The inputs and other parameters used to execute the job.
statusJobStatus
The job status.
createddatetime.datetime
The timestamp when the job was created.
updateddatetime.datetime
The timestamp when the job was last updated.
collection_urlOptional[str] = None
The URL of the resulting STAC collection. Available only if the job status is terminal.
errorsOptional[List[ValidationError]]
Job errors. Available only if the job status is INVALID.
creditsOptional[int]
The job cost, in credits.
startedOptional[datetime.datetime]
The timestamp when the job was started.
finishedOptional[datetime.datetime]
The timestamp when the job was finished.

Functions

collection

Contains the URL of the resulting STAC collection. Available only if the job status is terminal. Returns pystac.Collection.

Python

    up42.Job.get(id="d290f1ee-6c54-4b01-90e6-d701748f0851")

up42.Job.collection()

  

track

Tracks the job status by retrying until the status changes to a terminal status. It will query the job status every 60 seconds for 3 days.

ParameterDescription
waitint
An interval between queries, in seconds. The value is 60.
retriesint
The duration of querying. The value is 60 * 24 * 3.

Python

    up42.Job.get(id="d290f1ee-6c54-4b01-90e6-d701748f0851")

up42.Job.track()

  

get

Fetches a specific job by its ID. Returns Job.

ParameterDescription
job_idstr
The job ID.

Python

    up42.Job.get(id="d290f1ee-6c54-4b01-90e6-d701748f0851")

  

all

Retrieves all jobs, with optional filtering. Returns Iterator["Job"].

ParameterDescription
process_idOptional[List[str]]
Process IDs. Use to search for jobs running any of the provided processes.
workspace_idOptional[str]
The workspace ID. Use to get jobs from a specific workspace. Otherwise, jobs from the entire account will be returned.
statusOptional[List[JobStatus]]
Job statuses. Use to search for jobs with any of the provided statuses.
min_durationOptional[int]
The minimum duration of a job. Use to get jobs with runtimes greater than or equal to a specific number of seconds. Only jobs with the following statuses will be displayed:
  • RUNNING
  • SUCCESSFUL
  • CAPTURED
  • RELEASED
  • FAILED
max_durationOptional[int]
The maximum duration of a job. Use to get jobs with runtimes less than or equal to a specific number of seconds. Only jobs with the following statuses will be displayed:
  • RUNNING
  • SUCCESSFUL
  • CAPTURED
  • RELEASED
  • FAILED
sort_byOptional[utils.SortingField]
The results sorting method that arranges elements in ascending or descending order based on a chosen field. To view the list of possible values, see JobSorting.

Python

    up42.Job.all(
    max_duration=500,
    sort_by=up42.JobSorting.process_id,
)

  

Class: Cost

A data class that compares the cost of a process with custom values. Supported comparison operators:

  • Greater than: <
  • Greater than or equal to: >
  • Less than: <=
  • Less than or equal to: =>
Attributes
AttributeDescription
strategystr
The pricing strategy used to calculate the cost.
creditsint
The process cost, in credits.
sizeOptional[int]
The size of the input STAC item.
unitOptional[str]
The unit of measurement used to calculate the size.

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

template = processing_templates.DetectionTreesSpacept(
  title="Detect trees over UK",
  item=asset.stac_items[0],
)

assert template.cost <= 100
template.cost

  

Class: JobTemplate

A class for job templates that define the process ID and input validation logic.

Attributes
AttributeDescription
process_idClassVar[str]
The process ID in a name format.
workspace_idUnion[str, base.WorkspaceId]
The workspace ID.
errorsset[ValidationError]
A list of errors populated if the job isn’t valid.

Functions

is_valid

Checks if the job is valid. Returns bool:

  • True: the job is valid.
  • False: the job isn’t valid.

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

job = processing_templates.DetectionTreesSpacept(
    title="Detect trees over UK",
    item=asset.stac_items[0]
)

if not job.is_valid:
    print(template.errors)

  

execute

Executes the job. Returns Job.

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

job = processing_templates.DetectionTreesSpacept(
    title="Detect trees over UK",
    item=asset.stac_items[0]
)

job.execute()

  

Class: SingleItemJobTemplate

A data class for the process templates that require one STAC item as input:

Python

    {
  "title": self.title,
  "item": self.item.get_self_href()
}

  
Atributes
AttributeDescription
titlestr
The title of the resulting objects: STAC item and STAC collection.
itempystac.Item
The STAC item to process.

Class: MultiItemJobTemplate

A data class for the process templates that require multiple STAC items as input:

Python

    {
  "title": self.title,
  "items": [item.get_self_href() for item in self.items]
}

  
Atributes
AttributeDescription
titlestr
The title of the resulting objects: STAC item and STAC collection.
itemsList[pystac.Item]
The STAC items to process.

Learn more