The previous version of The Queue has been replaced. Much of the general outline of the document below is true, however some of it is out of date. We will replace this with a new document describing the new Queuing system when time allows.
The queue is a tool used by the NICE server to manage commands and has the ability perform certain tasks sequentially. This is useful for users running an experiment because they need to put the instrument into a series of states (sometimes repeatedly) by moving motors, aligning the sample, adjusting the temperature of the sample, etc. Likewise, they need to perform neutron counts while in these various instrument states. As such, the queue is a major component of automating experiments run at the NCNR.
The queue only accepts queued commands, whether singularly or as part of a sequence of commands. Commands can be broken down into two types: immediate commands and queued commands. Immediate commands are generally commands that query the system or carry out actions that do not involve manipulation of real hardware. An example of this is the read command, which directly polls the hardware for values of specified nodes.
Queued commands, on the other hand, generally manipulate real (and simulated) hardware by moving motors, adjusting temperature controllers, adding/removing/ calibrating devices, running scans, etc. Commands that manipulate the hardware are generally performed sequentially not only to conform to experimental methodology, but also to prevent instrument wreckage and, most importantly, ensure participant safety.
Like all queues in programming, the NICE queue is a first-in-first-out (FIFO) data structure. This means that the oldest (or first) entry in the queue is processed first: “First come, first served.”
To begin illustrating this property of the queue, let’s use the example of moving two motors.
The first move command is added to the queue and, because it’s the only command, it runs immediately. The second command is also added but does not and will not run until the first move command finishes. This is true for all commands in the queue: you can queue up multiple commands while the queue is already running a command and they will run one-by-one in the order they were added.
Commands can be added to the queue by:
Dragging is a very useful way of repeating a command, not only because it doesn’t require any typing, but also because it allows you to place the copied command anywhere within the sequence on un-run queued commands. More on dragging later.
There are several indicators for telling apart running commands from un-run and completed commands.
If commands haven’t been run yet, then you can reorder them by dragging and dropping them.
All warnings and errors will show up in the console; however, commands in the queue can also show warnings and errors. Errors will propagate to a visible node in the queue. If you are running a trajectory, which may have multiple levels of nested commands, then you will have to expand through these levels to find exactly where the error occurred.
One command that is exclusive to the queue is the sleep command.
Typing sleep followed by the desired number of seconds will cause the queue to wait for the specified period.
The queue has several built-in features to make it easier to use. This includes a section of the status bar and click operations on queued commands.
The right-most section of the console status bar is devoted to the queue. It includes a word identifier for the queue state and two usa-buttons, one for pausing/resuming the queue and one for stopping it. Pause/Resume and Stop are the primary queue operations and by residing in the status bar, they are made available in every window.
A breakdown of the Pause/Resume and Stop usa-buttons:
A breakdown of the word identifiers used in the status bar:
Right-clicking a command will open a drop-down list of operations that can be performed on the selected (i.e., right-clicked) command.
These include:
The right-click operations can also be used in conjunction with some more subtle features of the queue.
Go to the Queue section in the Trajectory Guide – Reference for a detailed write-up of how the queue interacts with trajectories.