marketValue

Compute.marketValue(factor=1)

Return a special object that represents the current market value

Arguments:
  • factor (number) – OPTIONAL multiplier. default: 1.0

Note

Jobs default to cost marketValue per slice. The scheduler prioirtizes slices with a higher per slice cost when allocating work to workers.

By increasing this, a job will cost more, but be completed faster (compute.marketValue(2)).

By decreasing this, a job will cost less, but take longer to complete (compute.marketValue(0.5)).

Example:

/**
 * Creating a job with a per slice cost two times the current market value.
 */
const doubleMarketValue = compute.marketValue(2);
console.log(doubleMarketValue);
/* ... */
const results = await job.exec(doubleMarketValue);
/**
 * Creating a job with a per slice cost of half the current market value.
 */
const results = await job.exec(compute.marketValue(0.5));