SparkBulkScheduler

Provides access to the bulk scheduler.

var bulkScheduler = Spark.getBulkScheduler();

submitJobModule

signature submitJobModule(JSON playerQuery, string module, JSON data, number delaySeconds)

returns string

validity All Scripts

Submit a job to be executed by running a Cloud Code module.

params

playerQuery - A query to be run against the player collection to identify the players to execute against

module - A Cloud Code module short code, to be executed against each player

data - Data to be passed in to the Cloud Code module

delaySeconds - The number of seconds in the future to execute the job

returns

The jobId if the job was accepted, or null

example

var jobId = Spark.getBulkScheduler().submitJobModule(query, module, data, delaySeconds);

submitJobScript

signature submitJobScript(JSON playerQuery, string script, JSON data, number delaySeconds)

returns string

validity All Scripts

Submit a job to be executed by running an ad-hoc script.

params

playerQuery - A query to be run against the player collection to identify the players to execute against

script - A Cloud Code script to be executed against each player

data - Data to be passed in to the script

delaySeconds - The number of seconds in the future to execute the job

returns

The jobId if the job was accepted, or null

example

var jobId = Spark.getBulkScheduler().submitJobScript(query, script, data, delaySeconds);

cancelJob

signature cancelJob(string jobId)

returns boolean

validity All Scripts

Cancel a previously scheduled bulk job.

params

jobId - The ID of the job to cancel

returns

true if the job was cancelled, false otherwise

example

var cancelled = Spark.getBulkScheduler().cancelJob(jobIdToCancel);

listBulkJobs

signature listBulkJobs(string[] jobIds)

returns SparkBulkJob[]

validity All Scripts

List previously scheduled bulk jobs.

params

jobIds - The IDs of the jobs to list, or null to list all pending jobs

returns

An array of bulk jobs

example

var cancelled = Spark.getBulkScheduler().listBulkJobs(null);
Did this page help you? Please enter your feedback below. For questions about using this part of the platform, please contact support here