concept checkActiveJobs in category aws

appears as: checkActiveJobs
AI as a Service: Serverless machine learning with AWS

This is an excerpt from Manning's book AI as a Service: Serverless machine learning with AWS.

const MAX_BATCH_SIZE = 25
const INCOMING_TEXTS_PREFIX = 'incoming-texts/'
...
 
function getTextBatch() {
  ...
  return s3
    .listObjectsV2({
      Bucket: itemStoreBucketName,
      Prefix: INCOMING_TEXTS_PREFIX,                                       #1
      MaxKeys: MAX_BATCH_SIZE
    })
    .promise()
    .then(({ Contents: items }) =>
      items.map(item => item.Key.substring(INCOMING_TEXTS_PREFIX.length))  #2
    )
    .then(paths => {
      log.info({ paths }, 'Text batch')
      return {                                                             #3
        paths,
        count: paths.length
      }
    })
}