On-Demand Request API

The On-Demand Request API is a higher-level abstract for end-users of how to make a request that may constitute a set of associated jobs. An on-demand request may be for example, “process all S1-GUNW, over this AOI, from start time to end time, using nearest 2-neighbors, with skip 365 days”. So all related jobs for the aoi-tracks over the AOI spatial extent and temporal extent will be associated with this one request. Requests are also associated with a user to enable tracking and data management clean up.

See Standard Product S1-GUNW Processing Pipeline for more details on the processing pipeline.

program_pi_id tag

Each request will contain a program_pi_id tag to help associate the user and program that is making the request. Can be added as machine tag to the internal jobs.

Tag schema: <program funder>-<PI last name>-<processing platform>_<allocation_id>

For HEC processing platform, the <allocation_id> is Pleiades’s GroupID for billing.

For AWS processing platform, the <allocation_id> is project for billing.

Examples:

  • ESI2017-owen-HEC_s2037

  • ESI2017-fielding-HEC_sxxxx

  • ESI2017-peltzer-HEC_sxxxx

  • ESDS2016-GRFN-AWS_grfn

S1-GUNW Requests

Endpoint

Function

Input

Output/Result

Endpoint

Function

Input

Output/Result

POST /request_s1gunw/estimate

Create Request Estimate

  • Estimates the total expected products to be generated for this request.

  • geojson polygon of area

  • enumeration list [

    • {

      • nearest_m_neighbors

      • orbit_direction

      • reference_start time

      • reference_end time

      • skip_n

      • track_number

    • }

    • ]

  • group_id

  • program_pi_id

GET /request_s1gunw/

List Requests

  • queries all requests by user

none

  • returns: json list of request_id

  • requests GUI to make AJAX call for only the requests in viewport.

GET /request_s1gunw/{request_id}

Get Request

  • Gets detailed info on request.

  • request_id

  • returns: json of request

  • status: created | estimated | submitted

  • for each enumerator estimate (acqlist)

    • grq count acqlist

    • mozart count topsapp running

    • mozart count topsapp completed

    • mozart count topsapp queued

    • mozart count topsapp failed

POST /request_s1gunw/

Submit Request

  • Given a request id, starts the bulk processing.

  • request_id

  • additional layers (dict of layers)

  • starts bulk processing in SDS

DEL /request_s1gunw/{request_id}

Remove Request

  • Removes the request from the system state.

  • request id

  • status of removal

User Profile Management

Leverage NASA ESDIS URS

Leverage existing application for aria-products

 

Implementation Notes

The state of requests are stored as datasets in GRQ cluster. The My Request set of API calls effectively interact with Mozart API calls to trigger processing and summarize results into requests.

The on-demand Request API will be generating a new dataset on GRQ:

Request dataset schema naming convention

  • request-s1gunw-<start time>-<end time>-<aoi name>-<username>-<timestamp of request>

The request dataset is internal use and not visible to users.

See Mozart API (swagger openapi) endpoint for mamba cluster

see: https://hysds-core.atlassian.net/wiki/spaces/HYS/pages/450101273/Mozart+REST-like+Interface

Follow PGE versions from the S1-GUNW pipeline reference sheet.

Create Request Estimate

A request estimate is the result of running the enumerator on acquisitions, orbits, along a temporal and spatial extent constraint to generatge S1-GUNW-acq-list datasets. For each enumeration list item in the input, submit an on-demand enumerator_submitter, (which calls the acquistion_enumerator to generate S1-GUNW-acq-list).

Calls via Mozart API the on-demand variant of enumerator_submitter job, passing in geojson, start time, end time, etc.

  • The on-demand variant of enumerator_submitter job then looks up GRQ to find all POEORBs and submits an on-demand variant of the acquistion_enumerator job--one for each POEORB

  • Each enumerator job checks for completeness of all IPFs in aoi-track.

  • Associate that entire request with a Request ID tag to mozart.

  • when done, publishes new request dataset containing:

    • geojson

    • start time

    • end time

    • user who made request

    • program_pi_id

    • request_id

The the state of the enumeration run and set of S1-GUNW-acq-list datasets are associated with a request dataset.

Submit Request

On-demand submits Localizer jobs to take the S1-GUNW-acq-list datasets and moves them forward to produciton.

  • Call Mozart API to submit on-demand Localizer jobs for all S1-GUNW-acq-list datasets

    • Selects all S1-GUNW-acq-list for request id and on-demand submits to all slc_locaizer jobs.

    • Elasticsearch to GRQ would be of template:

    •  

      { "bool": { "must": [ { "term": { "dataset.raw": "S1-GUNW-acq-list" } }, { "term": { "metadata.tags.raw": "request_id-ABCXYZ" } } ] } }
    • It is analogous to an operator doing the following via on-demand grq:

    •  

  • This then flows the S1-GUNW-acq-list, to slc localizer, to evaluator to S1-GUNW-ifg-cfg, job-standard_product-s1gunw-topsapp-singularity:standard-product_singularity on pleiades.

  • For the AOI region, create a “megarule-like” trigger rule for all S1-GUNW-ifgcfg in that AOI to run to target that user’s HEC Group ID as specified in topsapp-singularity-plieades_<group ID> queue.

    • Submits to HySDS queue (not Pleiades queue) that is associated with known HEC Pleiades Group ID for billing.

    • auto-scaling script on pleiades needs to map HySDS queue name (which contains GroupID suffix) onto qsub with the associated Group ID to PBS for billing allocations.

List Requests

GRQ query for all dataset=request-s1gunw for given user.

Get Request

Gets the request information split between estimate and processing stages. For a given request_id, return two top-level dicts:

request { geojson, start time, end time, user, # who made request program_pi_id, estimate { acqlist count, enumerators status dict } processing { s1gunw count, topsapp status dict } }

 

  1. GRQ query for dataset=request-s1gunw of a given request_id.

  2. use request_id, in Mozart, look up estimate enumerator job status.

    1. Elasticsearch query on grq/tosca would look like this:

    2.  

      { "bool": { "must": [ { "term": { "resource": "job" } }, { "term": { "type": "job-standard_product-s1gunw-acq_enumerator:aria414" } }, { "term": { "tags.untouched": "request_id-ABCXYZ" } }, { "query_string": { "query": "enumerator", "default_operator": "OR" } } ] } }
    3. acq_enumerator status dict such as { job-completed: 24206, job-queued: 5276, job-revoked: 4075, job-failed: 2651, job-started: 196, job-offline: 104 }

  3. use request_id, in Mozart, look up total number of job-standard_product-s1gunw-topsapp-singularity:standard-product_singularity jobs (queued, running, failed, completed)

    1. Elasticsearch query on mozart/figaro would look like this:

    2. topsapp status dict such as { job-completed: 24206, job-queued: 5276, job-revoked: 4075, job-failed: 2651, job-started: 196, job-offline: 104 }

  4. use request_id, in GRQ, look up total number of S1-GUNW-acq-list, which is the estimated number of products to be processed for this request.

  5. use request_id, in GRQ, look up total number of S1-GUNW which is the number of products generated for this request.

Remove Request

Removes all context associated with that request. The following is removed in this one transactional API call:

This helps to maintain consistency.