Updates the state of the job.
int $state: The new state of the job. Has to be one of the job state constants.
string $message: (optional) The log message to be saved along with the state change.
array $variables: (optional) An array of variables to replace in the message on display.
string $type: (optional) The message type.
int The updated state of the job if it could be set.
Job::addMessage()
public function setState($state, $message = NULL, $variables = array(), $type = 'debug');