How to use the @cumulus/ingest/aws.StepFunction.getExecution function in @cumulus/ingest

To help you get started, we’ve selected a few @cumulus/ingest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nasa / cumulus / packages / api / lambdas / jobs.js View on Github external
async function checkExecution(arn, url, timestamp, esClient) {
  let error = {
    Error: 'Unknown',
    Cause: 'The error cause could not be determined'
  };
  const r = await StepFunction.getExecution(arn, true);
  r.status = r.status.toLowerCase();
  r.status = r.status === 'succeeded' ? 'completed' : r.status;


  if (r.status === 'not_found') {
    log.error(`Execution does not exist: ${arn}`);
    error = {
      Error: 'Not Found',
      Cause: 'Execution was not found. If an execution is '
             + 'finished and the state machine is deleted, this error is thrown'
    };
    await partialRecordUpdate(esClient, arn, 'execution', { status: 'failed', error });
    await updateGranulesAndPdrs(esClient, url, error);
    return;
  }