progress

progress([n])

Emits a progress event. Every work function must invoke this function. If a progress event is not emitted within 30 seconds, the scheduler will throw an ENOPROGRESS error.

Arguments
  • n (string|number|undefined()) – An estimate between 0 and 1 (inclusive) for the ratio of completed work to total work of a task estimated between 6 significant digits. Must be greater than the value of the previous call.

Return type

boolean

Example:

const job = compute.for(
  1,
  100,
  1,
  async (sliceIndex, data) => {
    progress(sliceIndex / 100);
  },
  [100],
);

Tutorials: