Submitting jobs to DPS with R

Author: Grace Llewellyn (JPL)

Date: December 11, 2024

Description: In this example, we show how to submit a job in an R kernel using maap-py and reticulate. We used GEDI subsetting as the example job.

Run This Notebook

To access and run this tutorial within MAAP’s Algorithm Development Environment (ADE), please refer to the “Getting started with the MAAP” section of our documentation.

MAAP offers an R/Python workspace with maap-py and reticulate already installed.

[1]:
#aoi = f"https://maap-ops-workspace.s3.amazonaws.com/shared/{username}/langtang_np.geojson"

#for your convenience you can use this geoJSON file but if you have your own geojson, use the commented link as example format
aoi <- "https://maap-ops-workspace.s3.amazonaws.com/shared/anisbhsl/langtang_np.geojson"

# Import the R library Reitculate to interface with Python
library(reticulate)
# Import the Python maap-py library
maap <- import("maap.maap")
maap_obj <- maap$MAAP()

result <- maap_obj$submitJob(identifier="gedi-algorithm-test",
    algo_id="gedi-subset",
    version="0.7.0",
    queue="maap-dps-worker-32gb",
    aoi=aoi,
    doi="L4A",
    lat="lat_lowestmode",
    lon="lon_lowestmode",
    beams="coverage",
    columns="agbd, agbd_se, sensitivity, geolocation/sensitivity_a2, elev_lowestmode",
    query="l2_quality_flag == 1 and l4_quality_flag == 1 and sensitivity > 0.95 and `geolocation/sensitivity_a2` > 0.95",
    limit=10,
    temporal="-",
    output="gedi_subset.gpkg"
    )

print(result)
{'job_id': '89ec6af8-6665-4e46-b5bf-267c850a1633', 'status': 'success', 'machine_type': None, 'architecture': None, 'machine_memory_size': None, 'directory_size': None, 'operating_system': None, 'job_start_time': None, 'job_end_time': None, 'job_duration_seconds': None, 'cpu_usage': None, 'cache_usage': None, 'mem_usage': None, 'max_mem_usage': None, 'swap_usage': None, 'read_io_stats': None, 'write_io_stats': None, 'sync_io_stats': None, 'async_io_stats': None, 'total_io_stats': None, 'error_details': None, 'response_code': 200, 'outputs': []}

Documentation for how to check the job status and see the outputs via the Jobs UI is here

You can see this GEDI subsetter job example in Python here