# \[ANN\] rq-3.0.0 : ruby queue gets gem'd

**URL:** <https://rubytalk.org/t/ann-rq-3-0-0-ruby-queue-gets-gemd/35787>\
**Category:** ruby-talk\
**Created:** [2 March 2007 02:02 UTC](https://rubytalk.org/t/ann-rq-3-0-0-ruby-queue-gets-gemd/35787 "2007-03-02T02:02:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ara.T.Howard6](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Ara.T.Howard6](https://rubytalk.org/u/Ara.T.Howard6)\
**Post date:** [2 March 2007 02:02 UTC](https://rubytalk.org/t/ann-rq-3-0-0-ruby-queue-gets-gemd/35787/1 "2007-03-02T02:02:57Z")

</div>

NAME  
&nbsp;&nbsp;&nbsp;rq v3.0.0

SYNOPSIS  
&nbsp;&nbsp;&nbsp;rq (queue | export RQ\_Q=q) mode [mode\_args]\* [options]\*

URIS

&nbsp;&nbsp;&nbsp;[http://rubyforge.org/projects/codeforpeople](http://rubyforge.org/projects/codeforpeople)  
&nbsp;&nbsp;&nbsp;[http://codeforpeople.com/lib/ruby/rq](http://codeforpeople.com/lib/ruby/rq)

INSTALL

&nbsp;&nbsp;&nbsp;gem install rq --no-wrappers

DESCRIPTION  
&nbsp;&nbsp;&nbsp;ruby queue (rq) is a tool used to create instant linux clusters by managing  
&nbsp;&nbsp;&nbsp;sqlite databases as nfs mounted priority work queues. multiple instances of  
&nbsp;&nbsp;&nbsp;rq running from multiples hosts can work from these queues to distribute  
&nbsp;&nbsp;&nbsp;processing load to n nodes - bringing many dozens of otherwise powerful cpus  
&nbsp;&nbsp;&nbsp;to their knees with a single blow. clearly this software should be kept out  
&nbsp;&nbsp;&nbsp;of the hands of free radicals, seti enthusiasts, and j. safran.

&nbsp;&nbsp;&nbsp;the central concept of rq is that n nodes work in isolation to pull jobs from  
&nbsp;&nbsp;&nbsp;an central nfs mounted priority work queue in a synchronized fashion. the  
&nbsp;&nbsp;&nbsp;nodes have absolutely no knowledge of each other and all communication if done  
&nbsp;&nbsp;&nbsp;via the queue meaning that, so long as the queue is available via nfs and a  
&nbsp;&nbsp;&nbsp;single node is running jobs from it, the system will continue to process jobs.  
&nbsp;&nbsp;&nbsp;there is no centralized process whatsoever - all nodes work to take jobs from  
&nbsp;&nbsp;&nbsp;the queue and run them as fast as possible. this creates a system which load  
&nbsp;&nbsp;&nbsp;balances automatically and is robust in face of node failures.

&nbsp;&nbsp;&nbsp;the first argument to any rq command is the name of the queue. this name may  
&nbsp;&nbsp;&nbsp;be omitted if, and only if, the environment variable RQ\_Q has been set to  
&nbsp;&nbsp;&nbsp;contain the absolute path of target queue.

&nbsp;&nbsp;&nbsp;rq operates in one of the modes create, submit, list, status, delete, update,  
&nbsp;&nbsp;&nbsp;query, execute, configure, snapshot, lock, backup, rotate, feed, or help.  
&nbsp;&nbsp;&nbsp;depending on the mode of operation and the options used the meaning of  
&nbsp;&nbsp;&nbsp;'mode\_args' may change.

MODES

&nbsp;&nbsp;&nbsp;the following mode abbreviations exist

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c =\> create  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s =\> submit  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l =\> list  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ls =\> list  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t =\> status  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d =\> delete  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rm =\> delete  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;u =\> update  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;q =\> query  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e =\> execute  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C =\> configure  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S =\> snapshot  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L =\> lock  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b =\> backup  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r =\> rotate  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f =\> feed  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h =\> help

&nbsp;&nbsp;&nbsp;create, c :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;create a queue. the queue must be located on an nfs mounted file system  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;visible from all nodes intended to run jobs from it.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) to create a queue  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq /path/to/nfs/mounted/q create  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or simply  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq /path/to/nfs/mounted/q c

&nbsp;&nbsp;&nbsp;submit, s :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;submit jobs to a queue to be proccesed by a feeding node. any 'mode\_args'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;are taken as the command to run. note that 'mode\_args' are subject to shell  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;expansion - if you don't understand what this means do not use this feature  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and pass jobs on stdin.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when running in submit mode a file may by specified as a list of commands to  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;run using the '--infile, -i' option. this file is taken to be a newline  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;separated list of commands to submit, blank lines and comments (#) are  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;allowed. if submitting a large number of jobs the input file method is  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MUCH, more efficient. if no commands are specified on the command line rq  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;automatically reads them from STDIN. yaml formatted files are also allowed  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as input ([http://www.yaml.org/](http://www.yaml.org/)) - note that the output of nearly all rq  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;commands is valid yaml and may, therefore, be piped as input into the submit  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when submitting the '--priority, -p' option can be used here to determine  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the priority of jobs. priorities may be any whole number - zero is the  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default. note that submission of a high priority job will NOT supplant  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currently running low priority jobs, but higher priority jobs WILL always  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;migrate above lower priority jobs in the queue in order that they be run as  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soon as possible. constant submission of high priority jobs may create a  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;starvation situation whereby low priority jobs are never allowed to run.  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;avoiding this situation is the responsibility of the user. the only  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;guaruntee rq makes regarding job execution is that jobs are executed in an  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'oldest highest priority' order and that running jobs are never supplanted.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) submit the job ls to run on some feeding host

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q s ls

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) submit the job ls to run on some feeding host, at priority 9

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq -p9 q s ls

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2) submit 42000 jobs (quietly) from a command file, marking them as  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;restartable should the node they are running on reboot.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> wc -l cmdfile  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;42000  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q s --quiet --restartable \< cmdfile

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3) submit 42 priority 9 jobs from a command file.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> wc -l cmdfile  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;42  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq -p9 q s \< cmdfile

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4) submit 42 priority 9 jobs from a command file, marking them as  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'important' using the '--tag, -t' option.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> wc -l cmdfile  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;42  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq -p9 -timportant q s \< cmdfile

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5) re-submit all the 'important' jobs (see 'query' section below)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q query tag=important | rq q s

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6) re-submit all jobs which are already finished (see 'list' section  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;below)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q l f | rq q s

&nbsp;&nbsp;&nbsp;list, l, ls :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list mode lists jobs of a certain state or job id. state may be one of  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pending, running, finished, dead, or all. any 'mode\_args' that are numbers  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;are taken to be job id's to list.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;states may be abbreviated to uniqueness, therefore the following shortcuts  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apply :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p =\> pending  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r =\> running  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f =\> finished  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d =\> dead  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a =\> all

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) show everything in q  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q list all  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q l all  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> export RQ\_Q=q  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq l

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) show q's pending jobs  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q list pending

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2) show q's running jobs  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q list running

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3) show q's finished jobs  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q list finshed

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4) show job id 42  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q l 42

&nbsp;&nbsp;&nbsp;status, t :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;status mode shows the global state the queue. there are no 'mode\_args'.  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the meaning of each state is as follows:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pending =\> no feeder has yet taken this job  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;running =\> a feeder has taken this job  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;finished =\> a feeder has finished this job  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dead =\> rq died while running a job, has restarted, and moved  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this job to the dead state

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;note that rq cannot move jobs into the dead state unless it has been  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;restarted. this is because no node has any knowledge of other nodes and  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cannot possibly know if a job was started on a node that died, or is simply  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;taking a very long time. only the node that dies, upon restart, can  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;determine that is has jobs that 'were started before it started' and move  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;these jobs into the dead state. normally only a machine crash would cause a  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;job to be placed into the dead state. dead jobs are never automatically  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;restarted, this is the responsibility of an operator.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) show q's status

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q t

&nbsp;&nbsp;&nbsp;delete, d :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete combinations of pending, finished, dead, or jobs specified by jid.  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the delete mode is capable of parsing the output of list and query modes,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;making it possible to create custom filters to delete jobs meeting very  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;specific conditions.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'mode\_args' are the same as for list.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;note that it is NOT possible to delete a running job. rq has a  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;decentralized architechture which means that compute nodes are completely  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;independant of one another; an extension is that there is no way to  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;communicate the deletion of a running job from the queue the the node  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;actually running that job. it is not an error to force a job to die using a  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;facility such as an ssh command spawned on the remote host. once a job has  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;been noted to have finished, whatever the exit status, it can be deleted  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from the queue.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) delete all pending, finished, and dead jobs from a queue

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q d all

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) delete all pending jobs from a queue

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q d p

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2) delete all finished jobs from a queue

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q d f

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3) delete jobs via hand crafted filter program

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q list | yaml\_filter\_prog | rq q d

&nbsp;&nbsp;&nbsp;update, u :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;update assumes all leading arguments are jids to update with subsequent  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key=value pairs. currently only the 'command', 'priority', and 'tag' fields  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of pending jobs can be updated.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) update the priority of job 42

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q update 42 priority=7

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) update the priority of all pending jobs

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q update pending priority=7

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2) query jobs with a command matching 'foobar' and update their command  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to be 'barfoo'

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q q "command like '%foobar%'" |\  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rq q u command=barfoo

&nbsp;&nbsp;&nbsp;query, q :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query exposes the database more directly the user, evaluating the where  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clause specified on the command line (or from STDIN). this feature can be  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;used to make a fine grained slection of jobs for reporting or as input into  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the delete command. you must have a basic understanding of SQL syntax to  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;use this feature, but it is fairly intuitive in this limited capacity.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) show all jobs submitted within a specific 10 minute range

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q query "started \>= '2004-06-29 22:51:00' and started \< '2004-06-29 22:51:10'"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) shell quoting can be tricky here so input on STDIN is also allowed to  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;avoid shell expansion

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> cat constraints.txt  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;started \>= '2004-06-29 22:51:00' and  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;started \< '2004-06-29 22:51:10'

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q query \< contraints.txt  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or (same thing)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> cat contraints.txt| rq q query

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\*\* in general all but numbers will need to be surrounded by single quotes \*\*

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2) this query output might then be used to delete those jobs

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> cat contraints.txt | rq q q | rq q d

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3) show all jobs which are either finished or dead

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q q "state='finished' or state='dead'"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4) show all jobs which have non-zero exit status

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q query exit\_status!=0

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5) if you plan to query groups of jobs with some common feature consider  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;using the '--tag, -t' feature of the submit mode which allows a user to  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tag a job with a user defined string which can then be used to easily  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query that job group

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q submit --tag=my\_jobs \< joblist  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q query tag=my\_jobs

&nbsp;&nbsp;&nbsp;execute, e :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;execute mode is to be used by expert users with a knowledge of sql syntax  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;only. it follows the locking protocol used by rq and then allows the user  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to execute arbitrary sql on the queue. unlike query mode a write lock on  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the queue is obtained allowing a user to definitively shoot themselves in  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the foot. for details on a queue's schema the file 'db.schema' in the queue  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directory should be examined.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) list all jobs

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q execute 'select \* from jobs'

&nbsp;&nbsp;&nbsp;configure, C :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this mode is not supported yet.

&nbsp;&nbsp;&nbsp;snapshot, p :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;snapshot provides a means of taking a snapshot of the q. use this feature  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when many queries are going to be run; for example when attempting to figure  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out a complex pipeline command your test queries will not compete with the  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;feeders for the queue's lock. you should use this option whenever possible  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to avoid lock competition.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) take a snapshot using default snapshot naming, which is made via the  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;basename of the q plus '.snapshot'

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq /path/to/nfs/q snapshot

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) use this snapshot to chceck status

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq ./q.snapshot status

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2) use the snapshot to see what's running on which host

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq ./q.snapshot list running | grep `hostname`

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;note that there is also a snapshot option - this option is not the same as  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the snapshot command. the option can be applied to ANY command. if in  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;effect then that command will be run on a snapshot of the database and the  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;snapshot then immediately deleted. this is really only useful if one were  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to need to run a command against a very heavily loaded queue and did not  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wish to wait to obtain the lock. eg.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) get the status of a heavily loaded queue

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q t --snapshot

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) same as above

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q t -s

&nbsp;&nbsp;&nbsp;lock, L :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lock the queue and then execute an arbitrary shell command. lock mode uses  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the queue's locking protocol to safely obtain a lock of the specified type  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and execute a command on the user's behalf. lock type must be one of

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(r)ead | (sh)ared | (w)rite | (ex)clusive

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) get a read lock on the queue and make a backup

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q L read -- cp -r q q.bak

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(the '--' is needed to tell rq to stop parsing command line  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;options which allows the '-r' to be passed to the 'cp' command)

&nbsp;&nbsp;&nbsp;backup, b :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;backup mode is exactly the same as getting a read lock on the queue and  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;making a copy of it. this mode is provided as a convenience.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) make a backup of the queue using default naming ( qname + timestamp + .bak )

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q b

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) make a backup of the queue as 'q.bak'

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q b q.bak

&nbsp;&nbsp;&nbsp;rotate, r :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rotate mode is conceptually similar to log rolling. normally the list of  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;finished jobs will grow without bound in a queue unless they are manually  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deleted. rotation is a method of trimming finished jobs from a queue  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;without deleting them. the method used is that the queue is copied to a  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'rotation'; all jobs that are dead or finished are deleted from the original  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;queue and all pending and running jobs are deleted from the rotation. in  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this way the rotation becomes a record of the queue's finished and dead jobs  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at the time the rotation was made.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) rotate a queue using default rotation name

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q rotate

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) rotate a queue naming the rotation

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q rotate q.rotation

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2) a crontab entry like this could be used to rotate a queue daily

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;59 23 \* \* \* rq q rotate `date +q.%Y%m%d`

&nbsp;&nbsp;&nbsp;feed, f :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;take jobs from the queue and run them on behalf of the submitter as quickly  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as possible. jobs are taken from the queue in an 'oldest highest priority'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;first order.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;feeders can be run from any number of nodes allowing you to harness the CPU  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;power of many nodes simoultaneously in order to more effectively clobber  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;your network, anoy your sysads, and set output raids on fire.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the most useful method of feeding from a queue is to do so in daemon mode so  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;that if the process loses it's controling terminal it will not exit when you  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit your terminal session. use the '--daemon, -d' option to accomplish  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this. by default only one feeding process per host per queue is allowed to  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;run at any given moment. because of this it is acceptable to start a feeder  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at some regular interval from a cron entry since, if a feeder is alreay  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;running, the process will simply exit and otherwise a new feeder will be  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;started. in this way you may keep feeder processing running even acroess  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;machine reboots without requiring sysad intervention to add an entry to the  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;machine's startup tasks.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples :

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) feed from a queue verbosely for debugging purposes, using a minimum and  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maximum polling time of 2 and 4 respectively. you would NEVER specify  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;polling times this brief except for debugging purposes!!!

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q feed -v4 -m2 -M4

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1) same as above, but viewing the executed sql as it is sent to the  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;database

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> RQ\_SQL\_DEBUG=1 rq q f -v4 -m2 -M4

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2) feed from a queue in daemon mode - logging to /home/ahoward/rq.log

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> rq q f -d -l/home/ahoward/rq.log

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log rolling in daemon mode is automatic so your logs should never need  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to be deleted to prevent disk overflow.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3) use something like this sample crontab entry to keep a feeder running  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;forever - it attempts to (re)start every fifteen minutes but exits if  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;another process is already feeding.

> **···**
>
> #  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# your crontab file - sample only  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\*/15 \* \* \* \* /full/path/to/bin/rq /full/path/to/nfs/mounted/q f -d -l/home/username/cfq.log -q
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the '--quiet, -q' here tells rq to exit quietly (no STDERR)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when another process is found to already be feeding so that no cron  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message would be sent under these conditions.
> 
> &nbsp;&nbsp;&nbsp;help, h :
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this message
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;examples :
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0) get this message
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~\> rq q help  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~\> rq help
> 
> NOTES  
> &nbsp;&nbsp;&nbsp;- realize that your job is going to be running on a remote host and this has  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;implications. paths, for example, should be absolute, not relative.  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;specifically the submitted job script must be visible from all hosts  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currently feeding from a queue as must be the input and output  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;files/directories.
> 
> &nbsp;&nbsp;&nbsp;- jobs are currently run under the bash shell using the --login option.  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;therefore any settings in your .bashrc will apply - specifically your PATH  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setting. you should not, however, rely on jobs running with any given  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;environment.
> 
> &nbsp;&nbsp;&nbsp;- you need to consider \_\_CAREFULLY\_\_ what the ramifications of having multiple  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;instances of your program all potentially running at the same time will be.  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for instance, it is beyond the scope of rq to ensure multiple instances of a  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;given program will not overwrite each others output files. coordination  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of programs is left entirely to the user.
> 
> &nbsp;&nbsp;&nbsp;- the list of finished jobs will grow without bound unless you sometimes  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete some (all) of them. the reason for this is that rq cannot know when  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the user has collected the exit\_status of a given job, and so keeps this  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;information in the queue forever until instructed to delete it. if you have  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collected the exit\_status of you job(s) it is not an error to then delete  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;that job from the finished list - the information is kept for your  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;informational purposes only. in a production system it would be normal to  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;periodically save, and then delete, all finished jobs.
> 
> ENVIRONMENT  
> &nbsp;&nbsp;&nbsp;RQ\_Q: set to the full path of nfs mounted queue
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the queue argument to all commands may be omitted if, and only if, the  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;environment variable 'RQ\_Q' contains the full path to the q. eg.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~ \> export RQ\_Q=/full/path/to/my/q
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this feature can save a considerable amount of typing for those weak of  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wrist.
> 
> DIAGNOSTICS  
> &nbsp;&nbsp;success : $? == 0  
> &nbsp;&nbsp;failure : $? != 0
> 
> AUTHOR  
> &nbsp;&nbsp;&nbsp;[ara.t.howard@noaa.gov](mailto:ara.t.howard@noaa.gov)
> 
> BUGS  
> &nbsp;&nbsp;0 \< bugno && bugno \<= 42
> 
> &nbsp;&nbsp;reports to [ara.t.howard@noaa.gov](mailto:ara.t.howard@noaa.gov)
> 
> OPTIONS  
> &nbsp;&nbsp;&nbsp;--priority=priority, -p  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<submit\> : set the job(s) priority - lowest(0) .. highest(n) -  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(default 0)  
> &nbsp;&nbsp;&nbsp;--tag=tag, -t  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<submit\> : set the job(s) user data tag  
> &nbsp;&nbsp;&nbsp;--runner=runner  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<submit\> : set the job(s) required runner(s)  
> &nbsp;&nbsp;&nbsp;--restartable  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<submit\> : set the job(s) to be restartable on node reboot  
> &nbsp;&nbsp;&nbsp;--infile=infile  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<submit\> : infile  
> &nbsp;&nbsp;&nbsp;--quiet, -q  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<submit, feed\> : do not echo submitted jobs, fail silently if  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;another process is already feeding  
> &nbsp;&nbsp;&nbsp;--daemon, -D  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<feed\> : spawn a daemon  
> &nbsp;&nbsp;&nbsp;--max\_feed=max\_feed  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<feed\> : the maximum number of concurrent jobs run  
> &nbsp;&nbsp;&nbsp;--retries=retries  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<feed\> : specify transaction retries  
> &nbsp;&nbsp;&nbsp;--min\_sleep=min\_sleep  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<feed\> : specify min sleep  
> &nbsp;&nbsp;&nbsp;--max\_sleep=max\_sleep  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modes \<feed\> : specify max sleep  
> &nbsp;&nbsp;&nbsp;--snapshot, -s  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;operate on snapshot of queue  
> &nbsp;&nbsp;&nbsp;--verbosity=verbostiy, -v  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0|fatal \< 1|error \< 2|warn \< 3|info \< 4|debug - (default info)  
> &nbsp;&nbsp;&nbsp;--log=path, -l  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set log file - (default stderr)  
> &nbsp;&nbsp;&nbsp;--log\_age=log\_age  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;daily | weekly | monthly - what age will cause log rolling (default  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nil)  
> &nbsp;&nbsp;&nbsp;--log\_size=log\_size  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size in bytes - what size will cause log rolling (default nil)  
> &nbsp;&nbsp;&nbsp;--help, -h  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this message  
> &nbsp;&nbsp;&nbsp;--version  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;show version number
> 
> -a  
> --  
> be kind whenever possible... it is always possible.  
> - the dalai lama

---

<div class="post-metadata">

**Author:** ![Ara.T.Howard6](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Ara.T.Howard6](https://rubytalk.org/u/Ara.T.Howard6)\
**Post date:** [2 March 2007 15:55 UTC](https://rubytalk.org/t/ann-rq-3-0-0-ruby-queue-gets-gemd/35787/2 "2007-03-02T15:55:32Z")

</div>

YO - i'm cc'ing ruby-talk on this. FYI.

> Ara, what the heck has rq turned into :-). A chicken and the egg situation?
> 
> &nbsp;&nbsp;&nbsp;% gem specification rq | grep packages  
> &nbsp;&nbsp;&nbsp;&nbsp;- all/packages  
> &nbsp;&nbsp;&nbsp;&nbsp;- all/packages/arrayfields-3.6.0.tgz  
> &nbsp;&nbsp;&nbsp;&nbsp;- all/packages/sqlite-ruby-1.3.1.tar.gz  
> &nbsp;&nbsp;&nbsp;&nbsp;- all/packages/lockfile-1.4.1.tgz  
> &nbsp;&nbsp;&nbsp;&nbsp;- all/packages/INSTALL  
> &nbsp;&nbsp;&nbsp;&nbsp;- all/packages/posixlock-0.0.1.tgz  
> &nbsp;&nbsp;&nbsp;&nbsp;- all/packages/ruby-1.8.6.tgz # !!!!!  
> &nbsp;&nbsp;&nbsp;&nbsp;- all/packages/sqlite-2.8.15.tar.gz  
> &nbsp;&nbsp;&nbsp;&nbsp;- all/packages/rubygems-0.9.2.tgz # !!!!!  
> &nbsp;&nbsp;&nbsp;%
> 
> Now I completely understand shipping lockfile, posixlock, arrayfields,  
> sqlite-ruby and sqlite-2.8.15 with rq. But shipping ruby 1.8.6 and rubygems  
> 0.9.2 with rq? I have to know why!

because the typical installation scenario is

&nbsp;&nbsp;&nbsp;ls /clusterwide/nfs/ # ./bin ./lib ./man for our cluster

&nbsp;&nbsp;&nbsp;tar xvfz rq-3.0.0.tgz

&nbsp;&nbsp;&nbsp;cd rq-3.0.0/all

&nbsp;&nbsp;&nbsp;./install.sh /clusterwide/nfs

&nbsp;&nbsp;&nbsp;export PATH /clusterwide/nfs/bin:$PATH

&nbsp;&nbsp;&nbsp;# done

say you have 30 machines, like we do. if you want to use 'gem install rq' to  
actually populate an nfs installed location, then you first need ruby and  
sqlite installed on that location, then you need LD\_RUN\_PATH and  
LD\_LIBRARY\_PATH setup too, then you need to install the gem. so, intead, it's  
all in one. the tar ball with everything is also the gem so, now matter what  
you grab, you're good.

the only reason i made a gem is so people could do

&nbsp;&nbsp;&nbsp;gem install rq --no-wrappers

and play around on the local machine but, in reality, rubygems is rather  
useless for managing a cluster - unless you're advanced, like you are.

now, having said that, i'm all ears as to how best manage rq's installation.  
here are the issues

first some rubygems ones (arrgghh)

&nbsp;&nbsp;&nbsp;- users cannot use rubygmes if ANY softlinks exist along the installation  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;path - this is \_\_very\_\_ common when a shared nfs location is involved

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8811&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=8811&group_id=126&atid=575)

&nbsp;&nbsp;&nbsp;- wrappers don't work

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8819&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=8819&group_id=126&atid=575)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8985&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=8985&group_id=126&atid=575)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8987&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=8987&group_id=126&atid=575)

&nbsp;&nbsp;&nbsp;- finally, gem cannot be used easily to install a bunch of stuff into  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;another location, even though, in theory, it's possible a.k.a  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LD\_RUN\_PATH/-R encoding. in otherwords, GEM\_HOME isn't that useful

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8818&group\_id=126&atid=578](http://rubyforge.org/tracker/index.php?func=detail&aid=8818&group_id=126&atid=578)

&nbsp;&nbsp;&nbsp;- depdencies don't work correctly when mixing local/remote installs (that's  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;why i bundled them)

second, some generic ones

&nbsp;&nbsp;&nbsp;- people who actually use clusters (scientists) tend not to be too good at  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compiling things, especially into non-standard locations

&nbsp;&nbsp;&nbsp;- people who use clusters tend to be on 'stable' (crappy) operating systems  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with auto-updates of crappy rubys. we're still on 1.6.8 with  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enterprise!!!!!!!! only our newest machines switched.

&nbsp;&nbsp;&nbsp;- sqlite is a biatch to install. sqlite1,2,3, wtf? the ruby installer loses  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;some information during install (i'm forgetting the issue attm). plus the  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ruby bindings have not remained backward comptible over time. same goes  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for the sql understood by the api. thus the choice to bundle it.

so, my thinking was that an rq gem install is really just marketing: download  
it, play with it, then you have all the stuff locally to do a \_\_real\_\_ install  
onto your cluster without doing another thing.

> And does rq need to do its own cleanup? There's a 'build' directory in  
> the gem which has the dross from building sqlite-2.8.15 and  
> sqlite-ruby-1.3.1.

you mean it should blow it away after building? the only issue with that is  
that an error along the way means all the compilation is for nothing (you have  
to start over) but that's proably fine. i'll tweak it

> I still want to create ActiveQueue based upon rq at some point.

yeah, sure. i'm all ears. maybe we could get it out before mtnwest  
rubyconf!?

thanks a bunch for the feedback.

-a

> **···**
>
> On Thu, 1 Mar 2007, Jeremy Hinegardner wrote:  
> --  
> be kind whenever possible... it is always possible.  
> - the dalai lama

---

<div class="post-metadata">

**Author:** ![Jeremy\_Hinegardner](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Jeremy\_Hinegardner](https://rubytalk.org/u/Jeremy_Hinegardner)\
**Post date:** [2 March 2007 16:19 UTC](https://rubytalk.org/t/ann-rq-3-0-0-ruby-queue-gets-gemd/35787/3 "2007-03-02T16:19:42Z")

</div>

> say you have 30 machines, like we do. if you want to use 'gem install rq'  
> to  
> actually populate an nfs installed location, then you first need ruby and  
> sqlite installed on that location, then you need LD\_RUN\_PATH and  
> LD\_LIBRARY\_PATH setup too, then you need to install the gem. so, intead,  
> it's  
> all in one. the tar ball with everything is also the gem so, now matter  
> what  
> you grab, you're good.
> 
> the only reason i made a gem is so people could do
> 
> &nbsp;&nbsp;gem install rq --no-wrappers
> 
> and play around on the local machine but, in reality, rubygems is rather  
> useless for managing a cluster - unless you're advanced, like you are.

Yeah right, I learn someting new every time you post :-). Especially  
this time.

> now, having said that, i'm all ears as to how best manage rq's installation.  
> here are the issues
> 
> first some rubygems ones (arrgghh)
> 
> &nbsp;&nbsp;- users cannot use rubygmes if ANY softlinks exist along the installation  
> &nbsp;&nbsp;&nbsp;&nbsp;path - this is \_\_very\_\_ common when a shared nfs location is involved
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8811&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=8811&group_id=126&atid=575)
> 
> &nbsp;&nbsp;- wrappers don't work
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8819&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=8819&group_id=126&atid=575)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8985&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=8985&group_id=126&atid=575)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8987&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=8987&group_id=126&atid=575)
> 
> &nbsp;&nbsp;- finally, gem cannot be used easily to install a bunch of stuff into  
> &nbsp;&nbsp;&nbsp;&nbsp;another location, even though, in theory, it's possible a.k.a  
> &nbsp;&nbsp;&nbsp;&nbsp;LD\_RUN\_PATH/-R encoding. in otherwords, GEM\_HOME isn't that useful
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://rubyforge.org/tracker/index.php?func=detail&aid=8818&group\_id=126&atid=578](http://rubyforge.org/tracker/index.php?func=detail&aid=8818&group_id=126&atid=578)
> 
> &nbsp;&nbsp;- depdencies don't work correctly when mixing local/remote installs  
> &nbsp;&nbsp;(that's  
> &nbsp;&nbsp;&nbsp;&nbsp;why i bundled them)
> 
> second, some generic ones
> 
> &nbsp;&nbsp;- people who actually use clusters (scientists) tend not to be too good at  
> &nbsp;&nbsp;&nbsp;&nbsp;compiling things, especially into non-standard locations
> 
> &nbsp;&nbsp;- people who use clusters tend to be on 'stable' (crappy) operating  
> &nbsp;&nbsp;systems  
> &nbsp;&nbsp;&nbsp;&nbsp;with auto-updates of crappy rubys. we're still on 1.6.8 with  
> &nbsp;&nbsp;&nbsp;&nbsp;enterprise!!!!!!!! only our newest machines switched.
> 
> &nbsp;&nbsp;- sqlite is a biatch to install. sqlite1,2,3, wtf? the ruby installer  
> &nbsp;&nbsp;loses  
> &nbsp;&nbsp;&nbsp;&nbsp;some information during install (i'm forgetting the issue attm). plus  
> &nbsp;&nbsp;&nbsp;&nbsp;the  
> &nbsp;&nbsp;&nbsp;&nbsp;ruby bindings have not remained backward comptible over time. same goes  
> &nbsp;&nbsp;&nbsp;&nbsp;for the sql understood by the api. thus the choice to bundle it.
> 
> so, my thinking was that an rq gem install is really just marketing:  
> download it, play with it, then you have all the stuff locally to do a  
> \_\_real\_\_ install onto your cluster without doing another thing.

Ah, I was thinking the gem would be what you would install on each  
machine in the cluster. I'm flip flopped, thinking each machine in the  
cluster would have local copies of all the libs/applications/etc that  
it would need to run the cluters jobs, but instead each machine in the  
cluster is more barebones and the common apps/libs/etc are all from the  
NFS location.

> \>And does rq need to do its own cleanup? There's a 'build' directory in  
> \>the gem which has the dross from building sqlite-2.8.15 and  
> \>sqlite-ruby-1.3.1.
> 
> you mean it should blow it away after building? the only issue with that is  
> that an error along the way means all the compilation is for nothing (you  
> have  
> to start over) but that's proably fine. i'll tweak it

Maybe a bad assumption on my part, after a successful build I would  
think it would blow away the dross. Maybe if there are error/warning it  
leaves it around.

This is probably the most complex gem install I've seen, I'll have to  
dig through it and see how it all works :-).

> \>I still want to create ActiveQueue based upon rq at some point.
> 
> yeah, sure. i'm all ears. maybe we could get it out before mtnwest  
> rubyconf!?

Probably not, I'm not going to make it to the conf.

> thanks a bunch for the feedback.

this was all just wondering how things worked :-).

enjoy,

-jeremy

> **···**
>
> On Sat, Mar 03, 2007 at 12:55:32AM +0900, ara.t.howard@noaa.gov wrote:
> 
> # --
> 
> Jeremy Hinegardner jeremy@hinegardner.org

---

<div class="post-metadata">

**Author:** ![Ara.T.Howard6](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Ara.T.Howard6](https://rubytalk.org/u/Ara.T.Howard6)\
**Post date:** [2 March 2007 16:37 UTC](https://rubytalk.org/t/ann-rq-3-0-0-ruby-queue-gets-gemd/35787/4 "2007-03-02T16:37:49Z")

</div>

> Yeah right, I learn someting new every time you post :-). Especially  
> this time.

heh, me too - i'm amazed someone actually insalls and looks at what it does!  
😉

> Ah, I was thinking the gem would be what you would install on each machine  
> in the cluster. I'm flip flopped, thinking each machine in the cluster  
> would have local copies of all the libs/applications/etc that it would need  
> to run the cluters jobs, but instead each machine in the cluster is more  
> barebones and the common apps/libs/etc are all from the NFS location.

right. but that's not to say one wouldn't flip flop - if you had net:ssh or  
capistrano or puppet installed then a per node installation would be fine. on  
the otherhand, why? it's do dang easy to upgrade when there is one ruby to  
rule them all sitting on nfs, and it's not to say each node would also have a  
local ruby, but it's not required. for instance, on our cluster all we need  
to do to add a node from scratch is

&nbsp;&nbsp;&nbsp;- build new redhat box. 5-15 min.  
&nbsp;&nbsp;&nbsp;- add user account, in our case it's cfadmin  
&nbsp;&nbsp;&nbsp;- mount nfs drive  
&nbsp;&nbsp;&nbsp;- edit .bashrc so PATH=/nfs/bin:$PATH  
&nbsp;&nbsp;&nbsp;- rq /nfs/q cron start

done. the node is a node forever, even across reboots.

> Maybe a bad assumption on my part, after a successful build I would think it  
> would blow away the dross. Maybe if there are error/warning it leaves it  
> around.

no, you're right. i'll add that functionality.

> This is probably the most complex gem install I've seen, I'll have to dig  
> through it and see how it all works :-).

the rmagick gem is even crazier! all rq does that's weird is to install it's  
own local copy of sqlite and sqlite-ruby into it's lib dir. the bin script  
alters it's environment (PATH/LD\_LIBRARY\_PATH) on startup such that the local  
sqlite and sqlite-ruby will be the ones used. so i don't clobber any local  
sqlite installation, don't care if you have another version installed, don't  
care if you've altered you libpath to point some crazy place, it just works (i  
think ;-)).

seriously though, i'm really open to suggestion because this was chore to  
setup!

ciao.

-a

> **···**
>
> On Sat, 3 Mar 2007, Jeremy Hinegardner wrote:  
> --  
> be kind whenever possible... it is always possible.  
> - the dalai lama
