The Cost data class allows you to compare the cost of a process with custom values.
Cost class attributes
Attribute | Description |
---|---|
strategy | str | required The pricing strategy used to calculate the cost. |
credits | int | required The process cost, in credits. |
size | int The size of the input STAC item. |
unit | str The unit of measurement used to calculate the size. |
Operator | Description |
---|---|
< | Greater than |
> | Greater than or equal to |
<= | Less than |
=> | Less than or equal to |
An example with the Cost class
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
The Job data class allows you to view and monitor processing jobs.
Job class attributes
Attribute | Description |
---|---|
process_id | str | required The process ID in a name format. |
id | str | required The job ID. |
account_id | str | required The account ID. |
workspace_id | str The workspace ID. |
definition | dict | required The inputs and other parameters used to execute the job. |
status | JobStatus | required The job status. |
created | datetime | required The timestamp when the job was created. |
updated | datetime | required The timestamp when the job was last updated. |
collection_url | str The URL of the resulting STAC collection. Available only if the job status is SUCCESSFUL or CAPTURED . |
errors | list[ValidationError] Job errors. Available only if the job status is INVALID . |
credits | int The job cost, in credits. |
started | datetime The timestamp when the job was started. |
finished | datetime The timestamp when the job was finished. |
Job class properties
Property | Description |
---|---|
collection | pystac.Collection The resulting STAC collection. Available only if the job status is SUCCESSFUL or CAPTURED . |
The all
class method allows you to view all jobs in your account.
The returned data type is Iterator["Job"]
.
Argument | Description |
---|---|
process_id | list[str] Process IDs. Use to search for jobs running any of the provided processes. |
workspace_id | str The workspace ID. Use to get jobs from a specific workspace. Otherwise, jobs from the entire account will be returned. |
status | list[JobStatus] Job statuses. Use to search for jobs with any of the provided statuses. |
min_duration | 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:
|
max_duration | 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:
|
sort_by | 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 . |
An example with all
Python
up42.Job.all(
max_duration=500,
sort_by=up42.JobSorting.process_id
)
The get
class method allows you to retrieve a specific job by its ID.
The returned data type is Job
.
An example with get
Python
up42.Job.get(id="d290f1ee-6c54-4b01-90e6-d701748f0851")
The track
instance method allows you to track the job status until it changes to CAPTURED
or RELEASED
. It will query the job status every 60 seconds for 3 days.
An example with track
Python
job.track()
The JobSorting class contains possible sorting parameters for the Job::all
method.
Sorting field | Description |
---|---|
process_id | Sorts by process ID. The default order is ascending. |
status | Sorts by status. The default order is descending. |
created | Sorts by creation date. The default order is descending. |
credits | Sorts by the amount of credits. The default order is descending. |
Examples with the JobSorting class
Sort by credit amount, from the least to the most expensive:
Python
up42.Job.all(sort_by=up42.JobSorting.credits.asc)
Sort by creation date, from the most recent to the earliest:
Python
up42.Job.all(sort_by=up42.JobSorting.created.desc)
The JobStatus class allows you to check the status of a processing job.
Status | Description |
---|---|
CREATED | The job has been created, but not yet accepted. |
LICENSED | The EULA has been accepted for this process. The job will move on to the validation stage. |
UNLICENSED | The EULA hasn’t been accepted for this process. The job will fail. Accept the EULA through the console or the API and try again. |
VALID | The job has been validated. |
ACCEPTED | The job has been validated and accepted. The credits corresponding to the price are temporarily withheld until the job is completed. |
INVALID | The job has failed validation. Fix your input parameters and try again. |
REJECTED | The job has been canceled due to an insufficient account balance. Top up your balance and try again. |
RUNNING | The job is in progress. |
SUCCESSFUL | The job has been completed, and the results have been delivered to your storage. |
CAPTURED | The job has been completed, the results have been delivered to your storage, and any withheld credits have been deducted from your account balance. |
RELEASED | The job has failed. Any withheld credits have been released. Try again, and if the issue persists, contact support. |
FAILED | The job has failed. |
The JobTemplate class serves as a parent class for all process-specific job templates.
JobTemplate class properties
Property | Description |
---|---|
is_valid | bool Whether the job is valid.
|
errors | set[ValidationError] A list of errors populated if the job isn’t valid. |
cost | Cost The cost of the execution available only if the job is valid. |
An example with the JobTemplate class
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]
)
if not template.is_valid:
print(template.errors)
The execute
instance method allows you to run a job.
An example with execute
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]
)
job = template.execute()
The MultiItemJobTemplate data class is used in the templates of those processes that require multiple STAC items as input:
Process | Data class |
---|---|
Change detection | DetectionChangeSpacept |
Infrastructure change detection (Pléiades) | DetectionChangePleiadesHyperverge |
Infrastructure change detection (SPOT) | DetectionChangeSPOTHyperverge |
MultiItemJobTemplate class atributes
Attribute | Description |
---|---|
title | str | required The title of the output objects: STAC item and STAC collection. |
items | list[pystac.Item] | required The STAC items retrieved from Asset::stac_items or Storage::pystac_client . |
The SingleItemJobTemplate data class is used in the templates of those processes that require one STAC item as input:
Process | Data class |
---|---|
Aircraft detection | DetectionAircraftOI |
Building detection | DetectionBuildingsSpacept |
Car detection | DetectionCarsOI |
Pansharpening | Pansharpening |
Shadow detection | DetectionShadowsSpacept |
Ship detection | DetectionShipsAirbus |
Storage tank detection | DetectionStorageTanksAirbus |
Tree detection | DetectionTreesSpacept |
Tree and tree height detection | DetectionTreesHeightsSpacept |
Truck detection | DetectionTrucksOI |
Wind turbine detection | DetectionWindTurbinesAirbus |
Upsampling | UpsamplingNS |
SingleItemJobTemplate class atributes
Attribute | Description |
---|---|
title | str | required The title of the output objects: STAC item and STAC collection. |
item | pystac.Item | required The STAC item retrieved from Asset::stac_items or Storage::pystac_client . |
The ValidationError data class represents information about validation errors in processing jobs.
ValidationError class attributes
Attribute | Description |
---|---|
message | str The message of the validation error. |
name | str The name of the validation error. |