How to use the @cumulus/ingest/aws.StepFunction.stop 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
}

  log.info(`Checking ${arn}`);

  if (r.status === 'running') {
    // check if it the execution has passed the five hours limit
    const now = Date.now();
    const late = (now - timestamp) > 18000000;

    if (late) {
      error = {
        Error: 'Stopped By Cumulus',
        Cause: 'Execution was stopped by Cumulus because it did not finish in 5 hours.'
      };

      await StepFunction.stop(
        arn,
        error.Cause,
        error.Error
      );

      await partialRecordUpdate(esClient, arn, 'execution', { status: 'failed', error });
      await updateGranulesAndPdrs(esClient, url, error);
    }
  } else {
    if (output.error) {
      input.exception = output.error;
      input.meta.status = 'failed';
      await handlePayload(output);
      return;
    }