docs: function initiateBatch(batch, cancellable, context) {
    const task = this;
  
    // Extract all of the messages from all of the batch's records and then sequence the messages
    const extractAndSequenceMessagesTask = task.getSubTask(extractAndSequenceMessages.name);
    const p1 = extractAndSequenceMessagesTask.execute(batch, context);
    const messagesExtractedPromise = whenDone(extractAndSequenceMessagesTask, p1, cancellable, context);
  
    return messagesExtractedPromise.then(
      extractOutcomes => {
        // Load and restore the previous state (if any) of the current batch
        const loadBatchStateTask = task.getSubTask(loadBatchState.name);
        const p2 = loadBatchStateTask.execute(batch, context);
        const batchStateLoadedPromise = whenDone(loadBatchStateTask, p2, cancellable, context);
  
        return batchStateLoadedPromise.then(
          loadOutcomes => {
            // Revive all of the tasks on all of the messages, on all of the unusable records and on the batch itself
            const reviveTasksTask = task.getSubTask(reviveTasks.name);
            const p3 = reviveTasksTask.execute(batch, context);
            const tasksRevivedPromise = whenDone(reviveTasksTask, p3, cancellable, context);
  
            return tasksRevivedPromise.then(
              reviveOutcomes => {
                // Pre-process the batch
                const preProcessBatchTask = task.getSubTask(preProcessBatch.name);
                const p4 = preProcessBatchTask.execute(batch, context);
                const preProcessedPromise = whenDone(preProcessBatchTask, p4, cancellable, context);
  
                return preProcessedPromise.then(
                  preProcessOutcomes => {
                    return [extractOutcomes, loadOutcomes, reviveOutcomes, preProcessOutcomes];
                  },
                  err => {
                    context.error(`Failed to pre-process ${batch.describe(true)}`, err);
                    throw err;
                  }
                );
              },
              err => {
                context.error(`Failed to revive tasks for ${batch.describe(true)}`, err);
                throw err;
              }
            );
          },
          err => {
            context.error(`Failed to load state for ${batch.describe(true)}`, err);
            throw err;
          }
        );
      },
      err => {
        context.error(`Unexpected error during extraction of messages for batch (${batch.shardOrEventID})`, err);
        throw err;
      }
    );
  }