Skip to main content

1E 9.x (on-premises)

Nomad.PauseJobQueue

Method

PauseJobQueue

Module

Nomad

Library

1E

Action

Pause the Nomad job queue so that no jobs will run.

Parameters

PauseDurationMinutes (int; optional, default 1440): For how long to pause the Nomad job queue, in minutes. After this interval Nomad will automatically resume the job queue, if it has not been resumed already using a ResumeJobQueue instruction. The value must be > 0. Default is 1 day.

PauseFrom (string; optional): The absolute UTC time, in ISO 8601 format as a string, from which the pause "clock" should start. If this is not given, the start time is when the instruction is executed on the Agent. The intent is that an instruction using this method specifies the value as "%environment:now%" (see Environment variables). This is a special value understood by the consumer API, which plugs in the time that the instruction was created. This has the effect that even if execution of the instruction is delayed on any Agents for any significant time, then the Nomad queue will resume exactly this time + PauseDurationMinutes minutes on all Agents after the instruction was submitted, not some semi-random time dependent on when a laptop, say, is booted up. See the example below. Of course you can hard-code an ISO 8601 time, but that is rarely useful.

If the time given by PauseFrom + PauseDurationMinutes has passed when the Agent executes the instruction, i.e. the resume-time has already passed, then the Agent does not pause the Nomad queue at all. This is not considered an error - the instruction has run successfully but done nothing.

Return values

Success (boolean): true if the request was successfully sent to Nomad (or if the resume time has already passed). Also if Nomad is installed (and of a sufficient version) but the service is not currently running, Tachyon itself will write the registry value that controls how long Nomad will pause for when its service is restarted; true or false is returned depending on the success of the write. If Nomad is not installed or is not a supported version then the method (and hence usually the instruction running it) fails with an execution error.

Example

The following instruction was submitted at 2017-06-27T12:00:00Z. Consider a laptop which has been off but is turned on 18 hours later. The Agent catches up with instructions from the Switch, and runs the instruction. The default pause duration for the Nomad job queue is 1 day from when the instruction was submitted, so the Agent on the laptop pauses Nomad's job queue for 24 - 18 = 6 hours, and the queue resumes at 2017-06-28T12:00:00Z.

Nomad.PauseJobQueue(PauseFrom : "%environment:now%");

if the instruction's execution had been delayed and ran after 2017-06-28T12:00:00Z then there would be no pause at all.

Platforms

  • Windows

Notes

Because of the way Nomad works, this action sends a fire-and-forget request to Nomad. The return value reflects whether Nomad was able to accept the request, not necessarily whether Nomad acted on it. It is not an error if no Nomad job is currently running to be paused.

The calculated resume time becomes irrelevant if the pause is explicitly cancelled by a subsequent ResumeJobQueue instruction.