rq 0.1.7 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +21 -0
- data/README +752 -190
- data/TODO +18 -11
- data/TUTORIAL +230 -0
- data/all/install.rb +127 -0
- data/all/install.sh +165 -0
- data/all/packages/INSTALL +5 -0
- data/all/packages/arrayfields-3.6.0.tgz +0 -0
- data/all/packages/lockfile-1.4.1.tgz +0 -0
- data/all/packages/posixlock-0.0.1.tgz +0 -0
- data/all/packages/ruby-1.8.6.tgz +0 -0
- data/all/packages/rubygems-0.9.2.tgz +0 -0
- data/all/packages/sqlite-2.8.15.tar.gz +0 -0
- data/all/packages/sqlite-ruby-1.3.1.tar.gz +0 -0
- data/bin/rq +830 -361
- data/bin/rq-3.0.0 +860 -0
- data/doc/classes/ARGV.html +134 -0
- data/doc/classes/ARGV.src/M000036.html +36 -0
- data/doc/classes/ARGV.src/M000037.html +25 -0
- data/doc/classes/OrderedHash.html +1043 -0
- data/doc/classes/OrderedHash.src/M000003.html +26 -0
- data/doc/classes/OrderedHash.src/M000004.html +31 -0
- data/doc/classes/OrderedHash.src/M000005.html +23 -0
- data/doc/classes/OrderedHash.src/M000006.html +23 -0
- data/doc/classes/OrderedHash.src/M000007.html +24 -0
- data/doc/classes/OrderedHash.src/M000009.html +24 -0
- data/doc/classes/OrderedHash.src/M000010.html +24 -0
- data/doc/classes/OrderedHash.src/M000011.html +24 -0
- data/doc/classes/OrderedHash.src/M000012.html +24 -0
- data/doc/classes/OrderedHash.src/M000013.html +24 -0
- data/doc/classes/OrderedHash.src/M000014.html +24 -0
- data/doc/classes/OrderedHash.src/M000016.html +26 -0
- data/doc/classes/OrderedHash.src/M000017.html +25 -0
- data/doc/classes/OrderedHash.src/M000018.html +23 -0
- data/doc/classes/OrderedHash.src/M000019.html +25 -0
- data/doc/classes/OrderedHash.src/M000020.html +23 -0
- data/doc/classes/OrderedHash.src/M000021.html +24 -0
- data/doc/classes/OrderedHash.src/M000022.html +24 -0
- data/doc/classes/OrderedHash.src/M000023.html +24 -0
- data/doc/classes/OrderedHash.src/M000024.html +29 -0
- data/doc/classes/OrderedHash.src/M000025.html +29 -0
- data/doc/classes/OrderedHash.src/M000026.html +24 -0
- data/doc/classes/OrderedHash.src/M000027.html +25 -0
- data/doc/classes/OrderedHash.src/M000028.html +23 -0
- data/doc/classes/OrderedHash.src/M000029.html +25 -0
- data/doc/classes/OrderedHash.src/M000030.html +24 -0
- data/doc/classes/OrderedHash.src/M000032.html +23 -0
- data/doc/classes/OrderedHash.src/M000033.html +25 -0
- data/doc/classes/OrderedHash.src/M000034.html +36 -0
- data/doc/classes/OrderedHash.src/M000035.html +23 -0
- data/doc/classes/RQ.html +647 -0
- data/doc/classes/RQ/Backer.html +240 -0
- data/doc/classes/RQ/Backer.src/M000121.html +31 -0
- data/doc/classes/RQ/ConfigFile.html +416 -0
- data/doc/classes/RQ/ConfigFile.src/M000100.html +34 -0
- data/doc/classes/RQ/ConfigFile.src/M000101.html +26 -0
- data/doc/classes/RQ/ConfigFile.src/M000102.html +33 -0
- data/doc/classes/RQ/ConfigFile.src/M000103.html +25 -0
- data/doc/classes/RQ/ConfigFile.src/M000104.html +34 -0
- data/doc/classes/RQ/ConfigFile.src/M000105.html +25 -0
- data/doc/classes/RQ/Configurator.html +249 -0
- data/doc/classes/RQ/Configurator.src/M000122.html +40 -0
- data/doc/classes/RQ/Creator.html +264 -0
- data/doc/classes/RQ/Creator.src/M000157.html +32 -0
- data/doc/classes/RQ/Cron.html +461 -0
- data/doc/classes/RQ/Deleter.html +259 -0
- data/doc/classes/RQ/Deleter.src/M000078.html +52 -0
- data/doc/classes/RQ/Executor.html +249 -0
- data/doc/classes/RQ/Executor.src/M000099.html +45 -0
- data/doc/classes/RQ/Feeder.html +1131 -0
- data/doc/classes/RQ/Feeder.src/M000079.html +67 -0
- data/doc/classes/RQ/Feeder.src/M000080.html +47 -0
- data/doc/classes/RQ/Feeder.src/M000081.html +98 -0
- data/doc/classes/RQ/Feeder.src/M000082.html +25 -0
- data/doc/classes/RQ/Feeder.src/M000083.html +30 -0
- data/doc/classes/RQ/Feeder.src/M000084.html +58 -0
- data/doc/classes/RQ/Feeder.src/M000085.html +37 -0
- data/doc/classes/RQ/Feeder.src/M000086.html +40 -0
- data/doc/classes/RQ/Feeder.src/M000087.html +37 -0
- data/doc/classes/RQ/Feeder.src/M000088.html +35 -0
- data/doc/classes/RQ/Feeder.src/M000089.html +47 -0
- data/doc/classes/RQ/Feeder.src/M000090.html +25 -0
- data/doc/classes/RQ/Feeder.src/M000091.html +78 -0
- data/doc/classes/RQ/Feeder.src/M000092.html +34 -0
- data/doc/classes/RQ/Feeder.src/M000093.html +36 -0
- data/doc/classes/RQ/Feeder.src/M000094.html +25 -0
- data/doc/classes/RQ/Feeder.src/M000095.html +27 -0
- data/doc/classes/RQ/IOViewer.html +256 -0
- data/doc/classes/RQ/Job.html +304 -0
- data/doc/classes/RQ/Job.src/M000168.html +26 -0
- data/doc/classes/RQ/Job.src/M000169.html +37 -0
- data/doc/classes/RQ/Job.src/M000170.html +23 -0
- data/doc/classes/RQ/Job/Methods.html +210 -0
- data/doc/classes/RQ/JobQueue.html +1780 -0
- data/doc/classes/RQ/JobQueue.src/M000176.html +31 -0
- data/doc/classes/RQ/JobQueue.src/M000177.html +34 -0
- data/doc/classes/RQ/JobQueue.src/M000178.html +60 -0
- data/doc/classes/RQ/JobQueue.src/M000179.html +63 -0
- data/doc/classes/RQ/JobQueue.src/M000180.html +73 -0
- data/doc/classes/RQ/JobQueue.src/M000181.html +217 -0
- data/doc/classes/RQ/JobQueue.src/M000182.html +50 -0
- data/doc/classes/RQ/JobQueue.src/M000183.html +83 -0
- data/doc/classes/RQ/JobQueue.src/M000184.html +25 -0
- data/doc/classes/RQ/JobQueue.src/M000185.html +83 -0
- data/doc/classes/RQ/JobQueue.src/M000186.html +28 -0
- data/doc/classes/RQ/JobQueue.src/M000187.html +26 -0
- data/doc/classes/RQ/JobQueue.src/M000188.html +26 -0
- data/doc/classes/RQ/JobQueue.src/M000189.html +32 -0
- data/doc/classes/RQ/JobQueue.src/M000190.html +30 -0
- data/doc/classes/RQ/JobQueue.src/M000191.html +37 -0
- data/doc/classes/RQ/JobQueue.src/M000192.html +36 -0
- data/doc/classes/RQ/JobQueue.src/M000193.html +25 -0
- data/doc/classes/RQ/JobQueue.src/M000194.html +25 -0
- data/doc/classes/RQ/JobQueue.src/M000195.html +25 -0
- data/doc/classes/RQ/JobQueue.src/M000196.html +25 -0
- data/doc/classes/RQ/JobQueue.src/M000197.html +25 -0
- data/doc/classes/RQ/JobQueue.src/M000198.html +73 -0
- data/doc/classes/RQ/JobQueue.src/M000199.html +25 -0
- data/doc/classes/RQ/JobQueue.src/M000200.html +38 -0
- data/doc/classes/RQ/JobQueue.src/M000201.html +28 -0
- data/doc/classes/RQ/JobQueue/Error.html +187 -0
- data/doc/classes/RQ/JobRunner.html +386 -0
- data/doc/classes/RQ/JobRunner.src/M000117.html +53 -0
- data/doc/classes/RQ/JobRunner.src/M000118.html +26 -0
- data/doc/classes/RQ/JobRunnerDaemon.html +590 -0
- data/doc/classes/RQ/JobRunnerDaemon.src/M000159.html +94 -0
- data/doc/classes/RQ/JobRunnerDaemon.src/M000160.html +27 -0
- data/doc/classes/RQ/JobRunnerDaemon.src/M000161.html +39 -0
- data/doc/classes/RQ/JobRunnerDaemon.src/M000162.html +27 -0
- data/doc/classes/RQ/JobRunnerDaemon.src/M000163.html +27 -0
- data/doc/classes/RQ/JobRunnerDaemon.src/M000164.html +28 -0
- data/doc/classes/RQ/JobRunnerDaemon.src/M000165.html +28 -0
- data/doc/classes/RQ/JobRunnerDaemon.src/M000166.html +37 -0
- data/doc/classes/RQ/JobRunnerDaemon.src/M000167.html +25 -0
- data/doc/classes/RQ/Lister.html +256 -0
- data/doc/classes/RQ/Lister.src/M000156.html +52 -0
- data/doc/classes/RQ/Locker.html +250 -0
- data/doc/classes/RQ/Locker.src/M000120.html +40 -0
- data/doc/classes/RQ/Logging.html +296 -0
- data/doc/classes/RQ/Logging.src/M000067.html +28 -0
- data/doc/classes/RQ/Logging/LogClassMethods.html +254 -0
- data/doc/classes/RQ/Logging/LogClassMethods.src/M000068.html +32 -0
- data/doc/classes/RQ/Logging/LogClassMethods.src/M000069.html +28 -0
- data/doc/classes/RQ/Logging/LogMethods.html +404 -0
- data/doc/classes/RQ/Logging/LogMethods.src/M000070.html +35 -0
- data/doc/classes/RQ/Logging/LogMethods.src/M000071.html +28 -0
- data/doc/classes/RQ/Logging/LogMethods.src/M000072.html +21 -0
- data/doc/classes/RQ/Logging/LogMethods.src/M000073.html +21 -0
- data/doc/classes/RQ/Logging/LogMethods.src/M000074.html +21 -0
- data/doc/classes/RQ/Logging/LogMethods.src/M000075.html +21 -0
- data/doc/classes/RQ/Logging/LogMethods.src/M000076.html +21 -0
- data/doc/classes/RQ/Logging/LogMethods.src/M000077.html +29 -0
- data/doc/classes/RQ/Logging/LoggerExt.html +194 -0
- data/doc/classes/RQ/Main.html +2110 -0
- data/doc/classes/RQ/MainHelper.html +607 -0
- data/doc/classes/RQ/MainHelper.src/M000171.html +33 -0
- data/doc/classes/RQ/MainHelper.src/M000172.html +32 -0
- data/doc/classes/RQ/MainHelper.src/M000173.html +44 -0
- data/doc/classes/RQ/OrderedAutoHash.html +258 -0
- data/doc/classes/RQ/OrderedAutoHash.src/M000205.html +25 -0
- data/doc/classes/RQ/OrderedAutoHash.src/M000206.html +25 -0
- data/doc/classes/RQ/QDB.html +1653 -0
- data/doc/classes/RQ/QDB.src/M000126.html +25 -0
- data/doc/classes/RQ/QDB.src/M000127.html +37 -0
- data/doc/classes/RQ/QDB.src/M000128.html +27 -0
- data/doc/classes/RQ/QDB.src/M000129.html +27 -0
- data/doc/classes/RQ/QDB.src/M000130.html +27 -0
- data/doc/classes/RQ/QDB.src/M000131.html +31 -0
- data/doc/classes/RQ/QDB.src/M000132.html +32 -0
- data/doc/classes/RQ/QDB.src/M000133.html +30 -0
- data/doc/classes/RQ/QDB.src/M000134.html +91 -0
- data/doc/classes/RQ/QDB.src/M000135.html +26 -0
- data/doc/classes/RQ/QDB.src/M000136.html +46 -0
- data/doc/classes/RQ/QDB.src/M000137.html +26 -0
- data/doc/classes/RQ/QDB.src/M000138.html +51 -0
- data/doc/classes/RQ/QDB.src/M000139.html +61 -0
- data/doc/classes/RQ/QDB.src/M000140.html +57 -0
- data/doc/classes/RQ/QDB.src/M000141.html +25 -0
- data/doc/classes/RQ/QDB.src/M000142.html +25 -0
- data/doc/classes/RQ/QDB.src/M000143.html +37 -0
- data/doc/classes/RQ/QDB.src/M000144.html +107 -0
- data/doc/classes/RQ/QDB.src/M000145.html +40 -0
- data/doc/classes/RQ/QDB.src/M000146.html +34 -0
- data/doc/classes/RQ/QDB.src/M000147.html +33 -0
- data/doc/classes/RQ/QDB.src/M000148.html +32 -0
- data/doc/classes/RQ/QDB.src/M000149.html +98 -0
- data/doc/classes/RQ/QDB.src/M000150.html +26 -0
- data/doc/classes/RQ/QDB.src/M000151.html +31 -0
- data/doc/classes/RQ/QDB.src/M000154.html +26 -0
- data/doc/classes/RQ/QDB/AbortedTransactionError.html +187 -0
- data/doc/classes/RQ/QDB/RollbackTransactionError.html +187 -0
- data/doc/classes/RQ/Querier.html +328 -0
- data/doc/classes/RQ/Querier.src/M000203.html +45 -0
- data/doc/classes/RQ/Querier.src/M000204.html +78 -0
- data/doc/classes/RQ/ReSubmitter.html +307 -0
- data/doc/classes/RQ/ReSubmitter.src/M000098.html +111 -0
- data/doc/classes/RQ/Recoverer.html +247 -0
- data/doc/classes/RQ/Refresher.html +346 -0
- data/doc/classes/RQ/Refresher.src/M000174.html +51 -0
- data/doc/classes/RQ/Refresher.src/M000175.html +44 -0
- data/doc/classes/RQ/Relayer.html +723 -0
- data/doc/classes/RQ/Relayer.src/M000106.html +91 -0
- data/doc/classes/RQ/Relayer.src/M000107.html +47 -0
- data/doc/classes/RQ/Relayer.src/M000108.html +46 -0
- data/doc/classes/RQ/Relayer.src/M000109.html +26 -0
- data/doc/classes/RQ/Relayer.src/M000110.html +46 -0
- data/doc/classes/RQ/Relayer.src/M000111.html +40 -0
- data/doc/classes/RQ/Relayer.src/M000112.html +37 -0
- data/doc/classes/RQ/Relayer.src/M000113.html +40 -0
- data/doc/classes/RQ/Relayer.src/M000114.html +27 -0
- data/doc/classes/RQ/Relayer.src/M000115.html +25 -0
- data/doc/classes/RQ/Relayer.src/M000116.html +38 -0
- data/doc/classes/RQ/Resource.html +187 -0
- data/doc/classes/RQ/ResourceManager.html +276 -0
- data/doc/classes/RQ/Rotater.html +324 -0
- data/doc/classes/RQ/Rotater.src/M000158.html +71 -0
- data/doc/classes/RQ/SleepCycle.html +322 -0
- data/doc/classes/RQ/SleepCycle.src/M000123.html +32 -0
- data/doc/classes/RQ/SleepCycle.src/M000124.html +27 -0
- data/doc/classes/RQ/SleepCycle.src/M000125.html +25 -0
- data/doc/classes/RQ/Snapshotter.html +250 -0
- data/doc/classes/RQ/Snapshotter.src/M000097.html +35 -0
- data/doc/classes/RQ/StatusLister.html +289 -0
- data/doc/classes/RQ/StatusLister.src/M000096.html +26 -0
- data/doc/classes/RQ/Submitter.html +319 -0
- data/doc/classes/RQ/Submitter.src/M000119.html +92 -0
- data/doc/classes/RQ/Toucher.html +384 -0
- data/doc/classes/RQ/Updater.html +304 -0
- data/doc/classes/RQ/Updater.src/M000202.html +97 -0
- data/doc/classes/RQ/Usage.html +346 -0
- data/doc/classes/RQ/Usage.src/M000038.html +29 -0
- data/doc/classes/RQ/Usage.src/M000039.html +72 -0
- data/doc/classes/RQ/Util.html +1043 -0
- data/doc/classes/RQ/Util.src/M000040.html +27 -0
- data/doc/classes/RQ/Util.src/M000041.html +26 -0
- data/doc/classes/RQ/Util.src/M000042.html +25 -0
- data/doc/classes/RQ/Util.src/M000043.html +25 -0
- data/doc/classes/RQ/Util.src/M000044.html +30 -0
- data/doc/classes/RQ/Util.src/M000045.html +25 -0
- data/doc/classes/RQ/Util.src/M000046.html +34 -0
- data/doc/classes/RQ/Util.src/M000047.html +31 -0
- data/doc/classes/RQ/Util.src/M000048.html +41 -0
- data/doc/classes/RQ/Util.src/M000049.html +27 -0
- data/doc/classes/RQ/Util.src/M000050.html +34 -0
- data/doc/classes/RQ/Util.src/M000051.html +28 -0
- data/doc/classes/RQ/Util.src/M000052.html +27 -0
- data/doc/classes/RQ/Util.src/M000053.html +31 -0
- data/doc/classes/RQ/Util.src/M000054.html +31 -0
- data/doc/classes/RQ/Util.src/M000055.html +31 -0
- data/doc/classes/RQ/Util.src/M000056.html +25 -0
- data/doc/classes/RQ/Util.src/M000057.html +25 -0
- data/doc/classes/RQ/Util.src/M000058.html +25 -0
- data/doc/classes/RQ/Util.src/M000059.html +25 -0
- data/doc/classes/RQ/Util.src/M000060.html +25 -0
- data/doc/classes/RQ/Util.src/M000061.html +27 -0
- data/doc/classes/RQ/Util.src/M000062.html +28 -0
- data/doc/classes/RQ/Util.src/M000063.html +39 -0
- data/doc/classes/RQ/Util.src/M000064.html +39 -0
- data/doc/classes/RQ/Util.src/M000065.html +31 -0
- data/doc/classes/RQ/Util.src/M000066.html +29 -0
- data/doc/classes/SQLite.html +120 -0
- data/doc/classes/SQLite/Database.html +546 -0
- data/doc/classes/SQLite/TypeTranslator.html +221 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +14 -0
- data/doc/dot/f_0.jpg +0 -0
- data/doc/dot/f_1.dot +14 -0
- data/doc/dot/f_1.jpg +0 -0
- data/doc/dot/f_10.dot +802 -0
- data/doc/dot/f_10.jpg +0 -0
- data/doc/dot/f_11.dot +14 -0
- data/doc/dot/f_11.jpg +0 -0
- data/doc/dot/f_12.dot +802 -0
- data/doc/dot/f_12.jpg +0 -0
- data/doc/dot/f_13.dot +802 -0
- data/doc/dot/f_13.jpg +0 -0
- data/doc/dot/f_14.dot +802 -0
- data/doc/dot/f_14.jpg +0 -0
- data/doc/dot/f_15.dot +802 -0
- data/doc/dot/f_15.jpg +0 -0
- data/doc/dot/f_16.dot +802 -0
- data/doc/dot/f_16.jpg +0 -0
- data/doc/dot/f_17.dot +802 -0
- data/doc/dot/f_17.jpg +0 -0
- data/doc/dot/f_18.dot +14 -0
- data/doc/dot/f_18.jpg +0 -0
- data/doc/dot/f_19.dot +802 -0
- data/doc/dot/f_19.jpg +0 -0
- data/doc/dot/f_2.dot +14 -0
- data/doc/dot/f_2.jpg +0 -0
- data/doc/dot/f_20.dot +802 -0
- data/doc/dot/f_20.jpg +0 -0
- data/doc/dot/f_21.dot +802 -0
- data/doc/dot/f_21.jpg +0 -0
- data/doc/dot/f_22.dot +802 -0
- data/doc/dot/f_22.jpg +0 -0
- data/doc/dot/f_23.dot +802 -0
- data/doc/dot/f_23.jpg +0 -0
- data/doc/dot/f_24.dot +802 -0
- data/doc/dot/f_24.jpg +0 -0
- data/doc/dot/f_25.dot +817 -0
- data/doc/dot/f_25.jpg +0 -0
- data/doc/dot/f_26.dot +29 -0
- data/doc/dot/f_26.jpg +0 -0
- data/doc/dot/f_27.dot +802 -0
- data/doc/dot/f_27.jpg +0 -0
- data/doc/dot/f_28.dot +802 -0
- data/doc/dot/f_28.jpg +0 -0
- data/doc/dot/f_29.dot +802 -0
- data/doc/dot/f_29.jpg +0 -0
- data/doc/dot/f_3.dot +14 -0
- data/doc/dot/f_3.jpg +0 -0
- data/doc/dot/f_30.dot +802 -0
- data/doc/dot/f_30.jpg +0 -0
- data/doc/dot/f_31.dot +802 -0
- data/doc/dot/f_31.jpg +0 -0
- data/doc/dot/f_32.dot +802 -0
- data/doc/dot/f_32.jpg +0 -0
- data/doc/dot/f_33.dot +802 -0
- data/doc/dot/f_33.jpg +0 -0
- data/doc/dot/f_34.dot +802 -0
- data/doc/dot/f_34.jpg +0 -0
- data/doc/dot/f_35.dot +802 -0
- data/doc/dot/f_35.jpg +0 -0
- data/doc/dot/f_36.dot +802 -0
- data/doc/dot/f_36.jpg +0 -0
- data/doc/dot/f_37.dot +802 -0
- data/doc/dot/f_37.jpg +0 -0
- data/doc/dot/f_38.dot +54 -0
- data/doc/dot/f_38.jpg +0 -0
- data/doc/dot/f_39.dot +802 -0
- data/doc/dot/f_39.jpg +0 -0
- data/doc/dot/f_4.dot +802 -0
- data/doc/dot/f_4.jpg +0 -0
- data/doc/dot/f_40.dot +802 -0
- data/doc/dot/f_40.jpg +0 -0
- data/doc/dot/f_41.dot +802 -0
- data/doc/dot/f_41.jpg +0 -0
- data/doc/dot/f_42.dot +802 -0
- data/doc/dot/f_42.jpg +0 -0
- data/doc/dot/f_43.dot +802 -0
- data/doc/dot/f_43.jpg +0 -0
- data/doc/dot/f_44.dot +802 -0
- data/doc/dot/f_44.jpg +0 -0
- data/doc/dot/f_5.dot +802 -0
- data/doc/dot/f_5.jpg +0 -0
- data/doc/dot/f_6.dot +802 -0
- data/doc/dot/f_6.jpg +0 -0
- data/doc/dot/f_7.dot +802 -0
- data/doc/dot/f_7.jpg +0 -0
- data/doc/dot/f_8.dot +802 -0
- data/doc/dot/f_8.jpg +0 -0
- data/doc/dot/f_9.dot +802 -0
- data/doc/dot/f_9.jpg +0 -0
- data/doc/dot/m_10_0.dot +802 -0
- data/doc/dot/m_10_0.jpg +0 -0
- data/doc/dot/m_11_0.dot +734 -0
- data/doc/dot/m_11_0.jpg +0 -0
- data/doc/dot/m_12_0.dot +802 -0
- data/doc/dot/m_12_0.jpg +0 -0
- data/doc/dot/m_13_0.dot +802 -0
- data/doc/dot/m_13_0.jpg +0 -0
- data/doc/dot/m_14_0.dot +802 -0
- data/doc/dot/m_14_0.jpg +0 -0
- data/doc/dot/m_15_0.dot +802 -0
- data/doc/dot/m_15_0.jpg +0 -0
- data/doc/dot/m_16_0.dot +802 -0
- data/doc/dot/m_16_0.jpg +0 -0
- data/doc/dot/m_17_0.dot +802 -0
- data/doc/dot/m_17_0.jpg +0 -0
- data/doc/dot/m_18_0.dot +734 -0
- data/doc/dot/m_18_0.jpg +0 -0
- data/doc/dot/m_19_0.dot +802 -0
- data/doc/dot/m_19_0.jpg +0 -0
- data/doc/dot/m_20_0.dot +802 -0
- data/doc/dot/m_20_0.jpg +0 -0
- data/doc/dot/m_21_0.dot +802 -0
- data/doc/dot/m_21_0.jpg +0 -0
- data/doc/dot/m_22_0.dot +802 -0
- data/doc/dot/m_22_0.jpg +0 -0
- data/doc/dot/m_23_0.dot +802 -0
- data/doc/dot/m_23_0.jpg +0 -0
- data/doc/dot/m_24_0.dot +802 -0
- data/doc/dot/m_24_0.jpg +0 -0
- data/doc/dot/m_25_0.dot +802 -0
- data/doc/dot/m_25_0.jpg +0 -0
- data/doc/dot/m_26_0.dot +734 -0
- data/doc/dot/m_26_0.jpg +0 -0
- data/doc/dot/m_27_0.dot +802 -0
- data/doc/dot/m_27_0.jpg +0 -0
- data/doc/dot/m_28_0.dot +802 -0
- data/doc/dot/m_28_0.jpg +0 -0
- data/doc/dot/m_29_0.dot +802 -0
- data/doc/dot/m_29_0.jpg +0 -0
- data/doc/dot/m_30_0.dot +802 -0
- data/doc/dot/m_30_0.jpg +0 -0
- data/doc/dot/m_31_0.dot +802 -0
- data/doc/dot/m_31_0.jpg +0 -0
- data/doc/dot/m_32_0.dot +802 -0
- data/doc/dot/m_32_0.jpg +0 -0
- data/doc/dot/m_33_0.dot +802 -0
- data/doc/dot/m_33_0.jpg +0 -0
- data/doc/dot/m_34_0.dot +802 -0
- data/doc/dot/m_34_0.jpg +0 -0
- data/doc/dot/m_35_0.dot +802 -0
- data/doc/dot/m_35_0.jpg +0 -0
- data/doc/dot/m_36_0.dot +802 -0
- data/doc/dot/m_36_0.jpg +0 -0
- data/doc/dot/m_37_0.dot +802 -0
- data/doc/dot/m_37_0.jpg +0 -0
- data/doc/dot/m_38_0.dot +54 -0
- data/doc/dot/m_38_0.jpg +0 -0
- data/doc/dot/m_39_0.dot +802 -0
- data/doc/dot/m_39_0.jpg +0 -0
- data/doc/dot/m_40_0.dot +802 -0
- data/doc/dot/m_40_0.jpg +0 -0
- data/doc/dot/m_41_0.dot +802 -0
- data/doc/dot/m_41_0.jpg +0 -0
- data/doc/dot/m_42_0.dot +802 -0
- data/doc/dot/m_42_0.jpg +0 -0
- data/doc/dot/m_43_0.dot +802 -0
- data/doc/dot/m_43_0.jpg +0 -0
- data/doc/dot/m_44_0.dot +802 -0
- data/doc/dot/m_44_0.jpg +0 -0
- data/doc/dot/m_4_0.dot +802 -0
- data/doc/dot/m_4_0.jpg +0 -0
- data/doc/dot/m_5_0.dot +802 -0
- data/doc/dot/m_5_0.jpg +0 -0
- data/doc/dot/m_6_0.dot +802 -0
- data/doc/dot/m_6_0.jpg +0 -0
- data/doc/dot/m_7_0.dot +802 -0
- data/doc/dot/m_7_0.jpg +0 -0
- data/doc/dot/m_8_0.dot +802 -0
- data/doc/dot/m_8_0.jpg +0 -0
- data/doc/dot/m_9_0.dot +802 -0
- data/doc/dot/m_9_0.jpg +0 -0
- data/doc/files/DEPENDS.html +107 -0
- data/doc/files/HISTORY.html +316 -0
- data/doc/files/INSTALL.html +126 -0
- data/doc/files/README.html +1223 -0
- data/doc/files/TODO.html +148 -0
- data/doc/files/TUTORIAL.html +392 -0
- data/doc/files/VERSION.html +107 -0
- data/doc/files/bin/rq_rb.html +231 -0
- data/doc/files/install_rb.html +188 -0
- data/doc/files/install_rb.src/M000001.html +53 -0
- data/doc/files/install_rb.src/M000002.html +43 -0
- data/doc/files/lib/rq-1_0_0/backer_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/configfile_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/configurator_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/creator_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/defaultconfig_txt.html +110 -0
- data/doc/files/lib/rq-1_0_0/deleter_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/executor_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/feeder_rb.html +178 -0
- data/doc/files/lib/rq-1_0_0/job_rb.html +176 -0
- data/doc/files/lib/rq-1_0_0/jobqueue_rb.html +177 -0
- data/doc/files/lib/rq-1_0_0/jobrunner_rb.html +175 -0
- data/doc/files/lib/rq-1_0_0/jobrunnerdaemon_rb.html +179 -0
- data/doc/files/lib/rq-1_0_0/lister_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/locker_rb.html +175 -0
- data/doc/files/lib/rq-1_0_0/logging_rb.html +178 -0
- data/doc/files/lib/rq-1_0_0/mainhelper_rb.html +175 -0
- data/doc/files/lib/rq-1_0_0/qdb_rb.html +177 -0
- data/doc/files/lib/rq-1_0_0/querier_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/refresher_rb.html +167 -0
- data/doc/files/lib/rq-1_0_0/relayer_rb.html +178 -0
- data/doc/files/lib/rq-1_0_0/sleepcycle_rb.html +167 -0
- data/doc/files/lib/rq-1_0_0/snapshotter_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/statuslister_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/submitter_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/updater_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/usage_rb.html +174 -0
- data/doc/files/lib/rq-1_0_0/util_rb.html +176 -0
- data/doc/files/lib/rq-2_0_0/backer_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/configfile_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/configurator_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/creator_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/defaultconfig_txt.html +110 -0
- data/doc/files/lib/rq-2_0_0/deleter_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/executor_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/feeder_rb.html +184 -0
- data/doc/files/lib/rq-2_0_0/job_rb.html +182 -0
- data/doc/files/lib/rq-2_0_0/jobqueue_rb.html +185 -0
- data/doc/files/lib/rq-2_0_0/jobrunner_rb.html +181 -0
- data/doc/files/lib/rq-2_0_0/jobrunnerdaemon_rb.html +185 -0
- data/doc/files/lib/rq-2_0_0/lister_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/locker_rb.html +181 -0
- data/doc/files/lib/rq-2_0_0/logging_rb.html +184 -0
- data/doc/files/lib/rq-2_0_0/mainhelper_rb.html +181 -0
- data/doc/files/lib/rq-2_0_0/orderedautohash_rb.html +182 -0
- data/doc/files/lib/rq-2_0_0/orderedhash_rb.html +138 -0
- data/doc/files/lib/rq-2_0_0/qdb_rb.html +184 -0
- data/doc/files/lib/rq-2_0_0/querier_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/refresher_rb.html +173 -0
- data/doc/files/lib/rq-2_0_0/relayer_rb.html +184 -0
- data/doc/files/lib/rq-2_0_0/rotater_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/sleepcycle_rb.html +173 -0
- data/doc/files/lib/rq-2_0_0/snapshotter_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/statuslister_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/submitter_rb.html +181 -0
- data/doc/files/lib/rq-2_0_0/updater_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/usage_rb.html +180 -0
- data/doc/files/lib/rq-2_0_0/util_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/backer_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/configfile_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/configurator_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/creator_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/defaultconfig_txt.html +110 -0
- data/doc/files/lib/rq-2_3_1/deleter_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/executor_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/feeder_rb.html +187 -0
- data/doc/files/lib/rq-2_3_1/job_rb.html +185 -0
- data/doc/files/lib/rq-2_3_1/jobqueue_rb.html +187 -0
- data/doc/files/lib/rq-2_3_1/jobrunner_rb.html +184 -0
- data/doc/files/lib/rq-2_3_1/jobrunnerdaemon_rb.html +187 -0
- data/doc/files/lib/rq-2_3_1/lister_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/locker_rb.html +183 -0
- data/doc/files/lib/rq-2_3_1/logging_rb.html +186 -0
- data/doc/files/lib/rq-2_3_1/mainhelper_rb.html +183 -0
- data/doc/files/lib/rq-2_3_1/orderedautohash_rb.html +184 -0
- data/doc/files/lib/rq-2_3_1/orderedhash_rb.html +138 -0
- data/doc/files/lib/rq-2_3_1/qdb_rb.html +188 -0
- data/doc/files/lib/rq-2_3_1/querier_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/refresher_rb.html +175 -0
- data/doc/files/lib/rq-2_3_1/relayer_rb.html +186 -0
- data/doc/files/lib/rq-2_3_1/resubmitter_rb.html +183 -0
- data/doc/files/lib/rq-2_3_1/rotater_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/sleepcycle_rb.html +175 -0
- data/doc/files/lib/rq-2_3_1/snapshotter_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/statuslister_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/submitter_rb.html +183 -0
- data/doc/files/lib/rq-2_3_1/updater_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/usage_rb.html +182 -0
- data/doc/files/lib/rq-2_3_1/util_rb.html +184 -0
- data/doc/files/lib/rq-2_3_1_rb.html +153 -0
- data/doc/files/lib/rq-2_3_2/backer_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/configfile_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/configurator_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/creator_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/defaultconfig_txt.html +110 -0
- data/doc/files/lib/rq-2_3_2/deleter_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/executor_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/feeder_rb.html +191 -0
- data/doc/files/lib/rq-2_3_2/ioviewer_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/job_rb.html +189 -0
- data/doc/files/lib/rq-2_3_2/jobqueue_rb.html +192 -0
- data/doc/files/lib/rq-2_3_2/jobrunner_rb.html +188 -0
- data/doc/files/lib/rq-2_3_2/jobrunnerdaemon_rb.html +191 -0
- data/doc/files/lib/rq-2_3_2/lister_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/locker_rb.html +187 -0
- data/doc/files/lib/rq-2_3_2/logging_rb.html +190 -0
- data/doc/files/lib/rq-2_3_2/mainhelper_rb.html +188 -0
- data/doc/files/lib/rq-2_3_2/orderedautohash_rb.html +188 -0
- data/doc/files/lib/rq-2_3_2/orderedhash_rb.html +138 -0
- data/doc/files/lib/rq-2_3_2/qdb_rb.html +193 -0
- data/doc/files/lib/rq-2_3_2/querier_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/recoverer_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/refresher_rb.html +179 -0
- data/doc/files/lib/rq-2_3_2/relayer_rb.html +190 -0
- data/doc/files/lib/rq-2_3_2/resubmitter_rb.html +187 -0
- data/doc/files/lib/rq-2_3_2/rotater_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/sleepcycle_rb.html +179 -0
- data/doc/files/lib/rq-2_3_2/snapshotter_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/statuslister_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/submitter_rb.html +187 -0
- data/doc/files/lib/rq-2_3_2/updater_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/usage_rb.html +186 -0
- data/doc/files/lib/rq-2_3_2/util_rb.html +188 -0
- data/doc/files/lib/rq-2_3_3/backer_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/configfile_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/configurator_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/creator_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/defaultconfig_txt.html +110 -0
- data/doc/files/lib/rq-2_3_3/deleter_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/executor_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/feeder_rb.html +191 -0
- data/doc/files/lib/rq-2_3_3/ioviewer_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/job_rb.html +189 -0
- data/doc/files/lib/rq-2_3_3/jobqueue_rb.html +192 -0
- data/doc/files/lib/rq-2_3_3/jobrunner_rb.html +188 -0
- data/doc/files/lib/rq-2_3_3/jobrunnerdaemon_rb.html +191 -0
- data/doc/files/lib/rq-2_3_3/lister_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/locker_rb.html +187 -0
- data/doc/files/lib/rq-2_3_3/logging_rb.html +190 -0
- data/doc/files/lib/rq-2_3_3/mainhelper_rb.html +188 -0
- data/doc/files/lib/rq-2_3_3/orderedautohash_rb.html +188 -0
- data/doc/files/lib/rq-2_3_3/orderedhash_rb.html +138 -0
- data/doc/files/lib/rq-2_3_3/qdb_rb.html +193 -0
- data/doc/files/lib/rq-2_3_3/querier_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/recoverer_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/refresher_rb.html +179 -0
- data/doc/files/lib/rq-2_3_3/relayer_rb.html +190 -0
- data/doc/files/lib/rq-2_3_3/resubmitter_rb.html +187 -0
- data/doc/files/lib/rq-2_3_3/rotater_rb.html +187 -0
- data/doc/files/lib/rq-2_3_3/sleepcycle_rb.html +179 -0
- data/doc/files/lib/rq-2_3_3/snapshotter_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/statuslister_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/submitter_rb.html +187 -0
- data/doc/files/lib/rq-2_3_3/updater_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/usage_rb.html +186 -0
- data/doc/files/lib/rq-2_3_3/util_rb.html +188 -0
- data/doc/files/lib/rq-3_0_0/backer_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/configfile_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/configurator_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/creator_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/cron_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/defaultconfig_txt.html +110 -0
- data/doc/files/lib/rq-3_0_0/deleter_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/executor_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/feeder_rb.html +199 -0
- data/doc/files/lib/rq-3_0_0/ioviewer_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/job_rb.html +197 -0
- data/doc/files/lib/rq-3_0_0/jobqueue_rb.html +200 -0
- data/doc/files/lib/rq-3_0_0/jobrunner_rb.html +196 -0
- data/doc/files/lib/rq-3_0_0/jobrunnerdaemon_rb.html +199 -0
- data/doc/files/lib/rq-3_0_0/lister_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/locker_rb.html +195 -0
- data/doc/files/lib/rq-3_0_0/logging_rb.html +198 -0
- data/doc/files/lib/rq-3_0_0/mainhelper_rb.html +196 -0
- data/doc/files/lib/rq-3_0_0/orderedautohash_rb.html +196 -0
- data/doc/files/lib/rq-3_0_0/orderedhash_rb.html +138 -0
- data/doc/files/lib/rq-3_0_0/qdb_rb.html +201 -0
- data/doc/files/lib/rq-3_0_0/querier_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/recoverer_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/refresher_rb.html +187 -0
- data/doc/files/lib/rq-3_0_0/relayer_rb.html +198 -0
- data/doc/files/lib/rq-3_0_0/resource_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/resourcemanager_rb.html +187 -0
- data/doc/files/lib/rq-3_0_0/resubmitter_rb.html +195 -0
- data/doc/files/lib/rq-3_0_0/rotater_rb.html +195 -0
- data/doc/files/lib/rq-3_0_0/sleepcycle_rb.html +187 -0
- data/doc/files/lib/rq-3_0_0/snapshotter_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/sqlite_rb.html +160 -0
- data/doc/files/lib/rq-3_0_0/statuslister_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/submitter_rb.html +195 -0
- data/doc/files/lib/rq-3_0_0/toucher_rb.html +195 -0
- data/doc/files/lib/rq-3_0_0/updater_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/usage_rb.html +194 -0
- data/doc/files/lib/rq-3_0_0/util_rb.html +196 -0
- data/doc/files/lib/rq_rb.html +244 -0
- data/doc/fr_class_index.html +73 -0
- data/doc/fr_file_index.html +71 -0
- data/doc/fr_method_index.html +323 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +172 -0
- data/extconf.rb +150 -0
- data/gemspec.rb +32 -0
- data/install.rb +75 -8
- data/lib/{rq-0.1.7.rb → rq-3.0.0.rb} +52 -10
- data/lib/{rq-0.1.7 → rq-3.0.0}/backer.rb +11 -7
- data/lib/{rq-0.1.7 → rq-3.0.0}/configfile.rb +21 -17
- data/lib/{rq-0.1.7 → rq-3.0.0}/configurator.rb +10 -6
- data/lib/rq-3.0.0/creator.rb +46 -0
- data/lib/rq-3.0.0/cron.rb +125 -0
- data/lib/{rq-0.1.7 → rq-3.0.0}/defaultconfig.txt +0 -0
- data/lib/rq-3.0.0/deleter.rb +51 -0
- data/lib/rq-3.0.0/executor.rb +40 -0
- data/lib/{rq-0.1.7 → rq-3.0.0}/feeder.rb +245 -91
- data/lib/rq-3.0.0/i686-linux/_sqlite.so +0 -0
- data/lib/rq-3.0.0/ioviewer.rb +48 -0
- data/lib/rq-3.0.0/job.rb +51 -0
- data/lib/rq-3.0.0/jobqueue.rb +899 -0
- data/lib/rq-3.0.0/jobrunner.rb +104 -0
- data/lib/{rq-0.1.7 → rq-3.0.0}/jobrunnerdaemon.rb +41 -27
- data/lib/rq-3.0.0/lister.rb +47 -0
- data/lib/rq-3.0.0/local/bin/sqlite +0 -0
- data/lib/rq-3.0.0/local/include/sqlite.h +868 -0
- data/lib/rq-3.0.0/local/lib/libsqlite.a +0 -0
- data/lib/rq-3.0.0/local/lib/libsqlite.la +35 -0
- data/lib/rq-3.0.0/local/lib/libsqlite.so +0 -0
- data/lib/rq-3.0.0/local/lib/libsqlite.so.0 +0 -0
- data/lib/rq-3.0.0/local/lib/libsqlite.so.0.8.6 +0 -0
- data/lib/rq-3.0.0/local/lib/pkgconfig/sqlite.pc +12 -0
- data/lib/{rq-0.1.7 → rq-3.0.0}/locker.rb +12 -6
- data/lib/{rq-0.1.7 → rq-3.0.0}/logging.rb +49 -42
- data/lib/rq-3.0.0/mainhelper.rb +184 -0
- data/lib/rq-3.0.0/orderedautohash.rb +39 -0
- data/lib/rq-3.0.0/orderedhash.rb +240 -0
- data/lib/{rq-0.1.7 → rq-3.0.0}/qdb.rb +183 -84
- data/lib/rq-3.0.0/querier.rb +98 -0
- data/lib/rq-3.0.0/recoverer.rb +28 -0
- data/lib/{rq-0.1.7 → rq-3.0.0}/refresher.rb +16 -8
- data/lib/rq-3.0.0/relayer.rb +283 -0
- data/lib/rq-3.0.0/resource.rb +22 -0
- data/lib/rq-3.0.0/resourcemanager.rb +40 -0
- data/lib/rq-3.0.0/resubmitter.rb +96 -0
- data/lib/rq-3.0.0/rotater.rb +98 -0
- data/lib/{rq-0.1.7 → rq-3.0.0}/sleepcycle.rb +14 -14
- data/lib/rq-3.0.0/snapshotter.rb +40 -0
- data/lib/rq-3.0.0/sqlite.rb +293 -0
- data/lib/rq-3.0.0/statuslister.rb +48 -0
- data/lib/rq-3.0.0/submitter.rb +109 -0
- data/lib/rq-3.0.0/toucher.rb +177 -0
- data/lib/rq-3.0.0/updater.rb +95 -0
- data/lib/rq-3.0.0/usage.rb +1157 -0
- data/lib/{rq-0.1.7 → rq-3.0.0}/util.rb +74 -56
- data/lib/rq.rb +52 -12
- data/rdoc.sh +17 -0
- data/rq +3 -1
- data/white_box/joblist +8 -0
- metadata +779 -96
- data/DEPENDS +0 -5
- data/HISTORY +0 -26
- data/VERSION +0 -1
- data/bin/rq-0.1.7 +0 -410
- data/lib/rq-0.1.7/creator.rb +0 -23
- data/lib/rq-0.1.7/deleter.rb +0 -39
- data/lib/rq-0.1.7/executor.rb +0 -41
- data/lib/rq-0.1.7/job.rb +0 -51
- data/lib/rq-0.1.7/jobqueue.rb +0 -432
- data/lib/rq-0.1.7/jobrunner.rb +0 -63
- data/lib/rq-0.1.7/lister.rb +0 -22
- data/lib/rq-0.1.7/mainhelper.rb +0 -53
- data/lib/rq-0.1.7/querier.rb +0 -33
- data/lib/rq-0.1.7/snapshotter.rb +0 -25
- data/lib/rq-0.1.7/statuslister.rb +0 -22
- data/lib/rq-0.1.7/submitter.rb +0 -90
- data/lib/rq-0.1.7/updater.rb +0 -95
- data/lib/rq-0.1.7/usage.rb +0 -609
- data/rdoc.cmd +0 -2
- data/rq.gemspec +0 -36
- data/rq.help +0 -552
@@ -0,0 +1,1780 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: RQ::JobQueue</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<h1>RQ::JobQueue <sup class="type-note">(Class)</sup></h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>In:</strong></td>
|
54
|
+
<td>
|
55
|
+
<a href="../../files/lib/rq-3_0_0/jobqueue_rb.html">
|
56
|
+
lib/rq-3.0.0/jobqueue.rb
|
57
|
+
</a>
|
58
|
+
<br />
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<tr class="top-aligned-row">
|
63
|
+
<td><strong>Parent:</strong></td>
|
64
|
+
<td>
|
65
|
+
Object
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
</table>
|
69
|
+
</div>
|
70
|
+
<!-- banner header -->
|
71
|
+
|
72
|
+
<div id="bodyContent">
|
73
|
+
|
74
|
+
|
75
|
+
<div id="contextContent">
|
76
|
+
<div id="diagram">
|
77
|
+
<map name="map">
|
78
|
+
<area shape="RECT" coords="1093,335,1176,287" href="MainHelper.html" alt="MainHelper">
|
79
|
+
<area shape="RECT" coords="67,453,152,405" href="StatusLister.html" alt="StatusLister">
|
80
|
+
<area shape="RECT" coords="215,453,303,405" href="Snapshotter.html" alt="Snapshotter">
|
81
|
+
<area shape="RECT" coords="363,453,451,405" href="ReSubmitter.html" alt="ReSubmitter">
|
82
|
+
<area shape="RECT" coords="504,453,576,405" href="Feeder.html" alt="Feeder">
|
83
|
+
<area shape="RECT" coords="632,453,704,405" href="Deleter.html" alt="Deleter">
|
84
|
+
<area shape="RECT" coords="763,453,835,405" href="Toucher.html" alt="Toucher">
|
85
|
+
<area shape="RECT" coords="891,453,963,405" href="Relayer.html" alt="Relayer">
|
86
|
+
<area shape="RECT" coords="1027,453,1099,405" href="Executor.html" alt="Executor">
|
87
|
+
<area shape="RECT" coords="1131,453,1205,405" href="Submitter.html" alt="Submitter">
|
88
|
+
<area shape="RECT" coords="1269,453,1341,405" href="Locker.html" alt="Locker">
|
89
|
+
<area shape="RECT" coords="1393,453,1468,405" href="IOViewer.html" alt="IOViewer">
|
90
|
+
<area shape="RECT" coords="1528,453,1600,405" href="Backer.html" alt="Backer">
|
91
|
+
<area shape="RECT" coords="1656,453,1728,405" href="Cron.html" alt="Cron">
|
92
|
+
<area shape="RECT" coords="1773,453,1861,405" href="Configurator.html" alt="Configurator">
|
93
|
+
<area shape="RECT" coords="1924,453,1996,405" href="Lister.html" alt="Lister">
|
94
|
+
<area shape="RECT" coords="2043,453,2115,405" href="Rotater.html" alt="Rotater">
|
95
|
+
<area shape="RECT" coords="2169,453,2241,405" href="Creator.html" alt="Creator">
|
96
|
+
<area shape="RECT" coords="2299,453,2379,405" href="Recoverer.html" alt="Recoverer">
|
97
|
+
<area shape="RECT" coords="2439,453,2511,405" href="Updater.html" alt="Updater">
|
98
|
+
<area shape="RECT" coords="2571,453,2643,405" href="Querier.html" alt="Querier">
|
99
|
+
<area shape="RECT" coords="1868,53,1940,5" href="../Hash.html" alt="::Hash">
|
100
|
+
<area shape="RECT" coords="1865,216,1943,168" href="ConfigFile.html" alt="ConfigFile">
|
101
|
+
<area shape="RECT" coords="1996,53,2089,5" href="../DRbUndumped.html" alt="DRbUndumped">
|
102
|
+
<area shape="RECT" coords="2001,216,2084,168" href="JobRunner.html" alt="JobRunner">
|
103
|
+
<area shape="RECT" coords="1463,335,1535,287" href="Main.html" alt="Main">
|
104
|
+
<area shape="RECT" coords="1213,335,1285,287" href="QDB.html" alt="QDB">
|
105
|
+
<area shape="RECT" coords="1323,335,1403,287" href="JobQueue.html" alt="JobQueue">
|
106
|
+
<area shape="RECT" coords="904,335,1027,287" href="JobRunnerDaemon.html" alt="JobRunnerDaemon">
|
107
|
+
<area shape="RECT" coords="2173,53,2245,5" href="../Array.html" alt="Array">
|
108
|
+
<area shape="RECT" coords="2159,216,2241,168" href="SleepCycle.html" alt="SleepCycle">
|
109
|
+
<area shape="RECT" coords="2273,216,2345,168" href="Job.html" alt="Job">
|
110
|
+
<area shape="RECT" coords="2272,53,2347,5" href="../ArrayFields.html" alt="ArrayFields">
|
111
|
+
<area shape="RECT" coords="2407,53,2505,5" href="../OrderedHash.html" alt="::OrderedHash">
|
112
|
+
<area shape="RECT" coords="2399,216,2513,168" href="OrderedAutoHash.html" alt="OrderedAutoHash">
|
113
|
+
<area shape="RECT" coords="925,53,1005,5" href="../LogMethods.html" alt="LogMethods">
|
114
|
+
<area shape="RECT" coords="2575,216,2652,168" href="Refresher.html" alt="Refresher">
|
115
|
+
<area shape="RECT" coords="1687,216,1804,168" href="ResourceManager.html" alt="ResourceManager">
|
116
|
+
<area shape="RECT" coords="1549,216,1624,168" href="Resource.html" alt="Resource">
|
117
|
+
<area shape="RECT" coords="2549,227,2677,135" href="../RQ.html" alt="lib/rq-3.0.0/refresher.rb">
|
118
|
+
<area shape="RECT" coords="173,464,313,372" href="../RQ.html" alt="lib/rq-3.0.0/snapshotter.rb">
|
119
|
+
<area shape="RECT" coords="597,464,715,372" href="../RQ.html" alt="lib/rq-3.0.0/deleter.rb">
|
120
|
+
<area shape="RECT" coords="472,464,587,372" href="../RQ.html" alt="lib/rq-3.0.0/feeder.rb">
|
121
|
+
<area shape="RECT" coords="1763,464,1903,372" href="../RQ.html" alt="lib/rq-3.0.0/configurator.rb">
|
122
|
+
<area shape="RECT" coords="1645,464,1752,372" href="../RQ.html" alt="lib/rq-3.0.0/cron.rb">
|
123
|
+
<area shape="RECT" coords="1312,345,1441,253" href="../RQ.html" alt="lib/rq-3.0.0/jobqueue.rb">
|
124
|
+
<area shape="RECT" coords="2032,464,2148,372" href="../RQ.html" alt="lib/rq-3.0.0/rotater.rb">
|
125
|
+
<area shape="RECT" coords="1517,464,1635,372" href="../RQ.html" alt="lib/rq-3.0.0/backer.rb">
|
126
|
+
<area shape="RECT" coords="725,464,845,372" href="../RQ.html" alt="lib/rq-3.0.0/toucher.rb">
|
127
|
+
<area shape="RECT" coords="1197,345,1301,253" href="../RQ.html" alt="lib/rq-3.0.0/qdb.rb">
|
128
|
+
<area shape="RECT" coords="1840,227,1967,135" href="../RQ.html" alt="lib/rq-3.0.0/configfile.rb">
|
129
|
+
<area shape="RECT" coords="1049,345,1187,253" href="../RQ.html" alt="lib/rq-3.0.0/mainhelper.rb">
|
130
|
+
<area shape="RECT" coords="1913,464,2021,372" href="../RQ.html" alt="lib/rq-3.0.0/lister.rb">
|
131
|
+
<area shape="RECT" coords="1452,345,1545,253" href="../RQ.html" alt="bin/rq.rb">
|
132
|
+
<area shape="RECT" coords="27,464,163,372" href="../RQ.html" alt="lib/rq-3.0.0/statuslister.rb">
|
133
|
+
<area shape="RECT" coords="2428,464,2549,372" href="../RQ.html" alt="lib/rq-3.0.0/updater.rb">
|
134
|
+
<area shape="RECT" coords="1977,227,2107,135" href="../RQ.html" alt="lib/rq-3.0.0/jobrunner.rb">
|
135
|
+
<area shape="RECT" coords="2263,227,2363,135" href="../RQ.html" alt="lib/rq-3.0.0/job.rb">
|
136
|
+
<area shape="RECT" coords="2159,464,2277,372" href="../RQ.html" alt="lib/rq-3.0.0/creator.rb">
|
137
|
+
<area shape="RECT" coords="2117,227,2252,135" href="../RQ.html" alt="lib/rq-3.0.0/sleepcycle.rb">
|
138
|
+
<area shape="RECT" coords="984,464,1109,372" href="../RQ.html" alt="lib/rq-3.0.0/executor.rb">
|
139
|
+
<area shape="RECT" coords="324,464,461,372" href="../RQ.html" alt="lib/rq-3.0.0/resubmitter.rb">
|
140
|
+
<area shape="RECT" coords="2373,227,2539,135" href="../RQ.html" alt="lib/rq-3.0.0/orderedautohash.rb">
|
141
|
+
<area shape="RECT" coords="1661,227,1829,135" href="../RQ.html" alt="lib/rq-3.0.0/resourcemanager.rb">
|
142
|
+
<area shape="RECT" coords="1524,227,1651,135" href="../RQ.html" alt="lib/rq-3.0.0/resource.rb">
|
143
|
+
<area shape="RECT" coords="869,345,1037,253" href="../RQ.html" alt="lib/rq-3.0.0/jobrunnerdaemon.rb">
|
144
|
+
<area shape="RECT" coords="2288,464,2417,372" href="../RQ.html" alt="lib/rq-3.0.0/recoverer.rb">
|
145
|
+
<area shape="RECT" coords="2560,464,2677,372" href="../RQ.html" alt="lib/rq-3.0.0/querier.rb">
|
146
|
+
<area shape="RECT" coords="1383,464,1507,372" href="../RQ.html" alt="lib/rq-3.0.0/ioviewer.rb">
|
147
|
+
<area shape="RECT" coords="1259,464,1372,372" href="../RQ.html" alt="lib/rq-3.0.0/locker.rb">
|
148
|
+
<area shape="RECT" coords="1120,464,1248,372" href="../RQ.html" alt="lib/rq-3.0.0/submitter.rb">
|
149
|
+
<area shape="RECT" coords="856,464,973,372" href="../RQ.html" alt="lib/rq-3.0.0/relayer.rb">
|
150
|
+
<area shape="RECT" coords="1420,204,1513,157" href="Usage.html" alt="Usage">
|
151
|
+
<area shape="RECT" coords="1316,204,1409,157" href="Util.html" alt="Util">
|
152
|
+
<area shape="RECT" coords="1188,204,1295,157" href="Logging/LogClassMethods.html" alt="LogClassMethods">
|
153
|
+
<area shape="RECT" coords="1084,204,1177,157" href="Logging/LoggerExt.html" alt="LoggerExt">
|
154
|
+
<area shape="RECT" coords="980,204,1073,157" href="Logging/LogMethods.html" alt="LogMethods">
|
155
|
+
<area shape="RECT" coords="953,215,1305,124" href="Logging.html" alt="Logging">
|
156
|
+
<area shape="RECT" coords="16,475,2688,91" href="../RQ.html" alt="RQ">
|
157
|
+
</map>
|
158
|
+
<img src="../../dot/m_44_0.jpg" usemap="#map" border=0 alt="Module: RQ">
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div id="description">
|
162
|
+
<p>
|
163
|
+
the <a href="JobQueue.html">JobQueue</a> class is responsible for high
|
164
|
+
level access to the job queue
|
165
|
+
</p>
|
166
|
+
|
167
|
+
</div>
|
168
|
+
|
169
|
+
|
170
|
+
<div id="method-list">
|
171
|
+
<h2 class="section-bar">Methods</h2>
|
172
|
+
|
173
|
+
<div class="name-list">
|
174
|
+
<a href="#M000294">[]=</a>
|
175
|
+
<a href="#M000290">abort_transaction</a>
|
176
|
+
<a href="#M000295">attributes</a>
|
177
|
+
<a href="#M000262">create</a>
|
178
|
+
<a href="#M000276">delete</a>
|
179
|
+
<a href="#M000286">execute</a>
|
180
|
+
<a href="#M000282">getdeadjobs</a>
|
181
|
+
<a href="#M000279">getjob</a>
|
182
|
+
<a href="#M000287">integrity_check</a>
|
183
|
+
<a href="#M000283">jobisdead</a>
|
184
|
+
<a href="#M000281">jobisdone</a>
|
185
|
+
<a href="#M000280">jobisrunning</a>
|
186
|
+
<a href="#M000273">list</a>
|
187
|
+
<a href="#M000289">lock</a>
|
188
|
+
<a href="#M000293">mtime</a>
|
189
|
+
<a href="#M000263">new</a>
|
190
|
+
<a href="#M000275">query</a>
|
191
|
+
<a href="#M000288">recover!</a>
|
192
|
+
<a href="#M000271">resubmit</a>
|
193
|
+
<a href="#M000285">ro_transaction</a>
|
194
|
+
<a href="#M000291">rollback_transaction</a>
|
195
|
+
<a href="#M000292">snapshot</a>
|
196
|
+
<a href="#M000269">standard_err_4</a>
|
197
|
+
<a href="#M000265">standard_in_4</a>
|
198
|
+
<a href="#M000267">standard_out_4</a>
|
199
|
+
<a href="#M000274">status</a>
|
200
|
+
<a href="#M000268">stderr4</a>
|
201
|
+
<a href="#M000264">stdin4</a>
|
202
|
+
<a href="#M000266">stdout4</a>
|
203
|
+
<a href="#M000270">submit</a>
|
204
|
+
<a href="#M000272">tmp_stdin</a>
|
205
|
+
<a href="#M000284">transaction</a>
|
206
|
+
<a href="#M000278">update</a>
|
207
|
+
<a href="#M000277">vacuum</a>
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div id="constants-list">
|
212
|
+
<h2 class="section-bar">Constants</h2>
|
213
|
+
|
214
|
+
<div class="name-list">
|
215
|
+
<table summary="Constants">
|
216
|
+
<tr class="top-aligned-row context-row">
|
217
|
+
<td class="context-item-name">MAX_JID</td>
|
218
|
+
<td>=</td>
|
219
|
+
<td class="context-item-value">2 ** 20</td>
|
220
|
+
</tr>
|
221
|
+
</table>
|
222
|
+
</div>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<div id="aliases-list">
|
226
|
+
<h2 class="section-bar">External Aliases</h2>
|
227
|
+
|
228
|
+
<div class="name-list">
|
229
|
+
qdb -> db <br />
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
|
234
|
+
<div id="attribute-list">
|
235
|
+
<h2 class="section-bar">Attributes</h2>
|
236
|
+
|
237
|
+
<div class="name-list">
|
238
|
+
<table>
|
239
|
+
<tr class="top-aligned-row context-row">
|
240
|
+
<td class="context-item-name">bin</td>
|
241
|
+
<td class="context-item-value"> [R] </td>
|
242
|
+
<td class="context-item-desc"></td>
|
243
|
+
</tr>
|
244
|
+
<tr class="top-aligned-row context-row">
|
245
|
+
<td class="context-item-name">opts</td>
|
246
|
+
<td class="context-item-value"> [R] </td>
|
247
|
+
<td class="context-item-desc"></td>
|
248
|
+
</tr>
|
249
|
+
<tr class="top-aligned-row context-row">
|
250
|
+
<td class="context-item-name">path</td>
|
251
|
+
<td class="context-item-value"> [R] </td>
|
252
|
+
<td class="context-item-desc"></td>
|
253
|
+
</tr>
|
254
|
+
<tr class="top-aligned-row context-row">
|
255
|
+
<td class="context-item-name">qdb</td>
|
256
|
+
<td class="context-item-value"> [R] </td>
|
257
|
+
<td class="context-item-desc"></td>
|
258
|
+
</tr>
|
259
|
+
<tr class="top-aligned-row context-row">
|
260
|
+
<td class="context-item-name">stderr</td>
|
261
|
+
<td class="context-item-value"> [R] </td>
|
262
|
+
<td class="context-item-desc"></td>
|
263
|
+
</tr>
|
264
|
+
<tr class="top-aligned-row context-row">
|
265
|
+
<td class="context-item-name">stdin</td>
|
266
|
+
<td class="context-item-value"> [R] </td>
|
267
|
+
<td class="context-item-desc"></td>
|
268
|
+
</tr>
|
269
|
+
<tr class="top-aligned-row context-row">
|
270
|
+
<td class="context-item-name">stdout</td>
|
271
|
+
<td class="context-item-value"> [R] </td>
|
272
|
+
<td class="context-item-desc"></td>
|
273
|
+
</tr>
|
274
|
+
</table>
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<div id="class-list">
|
279
|
+
<h2 class="section-bar">Classes and Modules</h2>
|
280
|
+
|
281
|
+
Class <a href="JobQueue/Error.html" class="link">RQ::JobQueue::Error</a><br />
|
282
|
+
|
283
|
+
</div>
|
284
|
+
|
285
|
+
</div>
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
<!-- if includes -->
|
290
|
+
<div id="includes">
|
291
|
+
<h2 class="section-bar">Included Modules</h2>
|
292
|
+
|
293
|
+
<div id="includes-list">
|
294
|
+
<span class="include-name">Logging</span>
|
295
|
+
<span class="include-name">Util</span>
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
|
300
|
+
<!-- if method_list -->
|
301
|
+
<div id="methods">
|
302
|
+
<h2 class="section-bar">Public Class methods</h2>
|
303
|
+
|
304
|
+
<div id="method-M000262" class="method-detail">
|
305
|
+
<a name="M000262"></a>
|
306
|
+
|
307
|
+
<div class="method-heading">
|
308
|
+
<a href="#M000262" class="method-signature">
|
309
|
+
<span class="method-name">create</span><span class="method-args">path, opts = {}</span>
|
310
|
+
</a>
|
311
|
+
</div>
|
312
|
+
|
313
|
+
<div class="method-description">
|
314
|
+
<p><a class="source-toggle" href="#"
|
315
|
+
onclick="toggleCode('M000262-source');return false;">[Source]</a></p>
|
316
|
+
<div class="method-source-code" id="M000262-source">
|
317
|
+
<pre>
|
318
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 28</span>
|
319
|
+
28: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span> <span class="ruby-identifier">path</span>, <span class="ruby-identifier">opts</span> = {}
|
320
|
+
29: <span class="ruby-comment cmt">#--{{{</span>
|
321
|
+
30: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">path</span>
|
322
|
+
31: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">mkdir_p</span> <span class="ruby-identifier">path</span>
|
323
|
+
32: <span class="ruby-identifier">db</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span> <span class="ruby-identifier">path</span>, <span class="ruby-value str">'db'</span>
|
324
|
+
33: <span class="ruby-identifier">qdb</span> = <span class="ruby-constant">QDB</span>.<span class="ruby-identifier">create</span> <span class="ruby-identifier">db</span>, <span class="ruby-identifier">opts</span>
|
325
|
+
34: <span class="ruby-identifier">opts</span>[<span class="ruby-value str">'qdb'</span>] = <span class="ruby-identifier">qdb</span>
|
326
|
+
35: <span class="ruby-identifier">q</span> = <span class="ruby-identifier">new</span> <span class="ruby-identifier">path</span>, <span class="ruby-identifier">opts</span>
|
327
|
+
36: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">mkdir_p</span> <span class="ruby-identifier">q</span>.<span class="ruby-identifier">bin</span>
|
328
|
+
37: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">mkdir_p</span> <span class="ruby-identifier">q</span>.<span class="ruby-identifier">stdin</span>
|
329
|
+
38: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">mkdir_p</span> <span class="ruby-identifier">q</span>.<span class="ruby-identifier">stdout</span>
|
330
|
+
39: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">mkdir_p</span> <span class="ruby-identifier">q</span>.<span class="ruby-identifier">stderr</span>
|
331
|
+
40: <span class="ruby-identifier">q</span>
|
332
|
+
41: <span class="ruby-comment cmt">#--}}}</span>
|
333
|
+
42: <span class="ruby-keyword kw">end</span>
|
334
|
+
</pre>
|
335
|
+
</div>
|
336
|
+
</div>
|
337
|
+
</div>
|
338
|
+
|
339
|
+
<div id="method-M000263" class="method-detail">
|
340
|
+
<a name="M000263"></a>
|
341
|
+
|
342
|
+
<div class="method-heading">
|
343
|
+
<a href="#M000263" class="method-signature">
|
344
|
+
<span class="method-name">new</span><span class="method-args">path, opts = {}</span>
|
345
|
+
</a>
|
346
|
+
</div>
|
347
|
+
|
348
|
+
<div class="method-description">
|
349
|
+
<p><a class="source-toggle" href="#"
|
350
|
+
onclick="toggleCode('M000263-source');return false;">[Source]</a></p>
|
351
|
+
<div class="method-source-code" id="M000263-source">
|
352
|
+
<pre>
|
353
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 55</span>
|
354
|
+
55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">path</span>, <span class="ruby-identifier">opts</span> = {}
|
355
|
+
56: <span class="ruby-comment cmt">#--{{{</span>
|
356
|
+
57: <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">path</span> <span class="ruby-comment cmt"># do NOT expand this or it'll be fubar from misc nfs mounts!!</span>
|
357
|
+
58: <span class="ruby-ivar">@bin</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span> <span class="ruby-ivar">@path</span>, <span class="ruby-value str">'bin'</span>
|
358
|
+
59: <span class="ruby-ivar">@stdin</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span> <span class="ruby-ivar">@path</span>, <span class="ruby-value str">'stdin'</span>
|
359
|
+
60: <span class="ruby-ivar">@stdout</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span> <span class="ruby-ivar">@path</span>, <span class="ruby-value str">'stdout'</span>
|
360
|
+
61: <span class="ruby-ivar">@stderr</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span> <span class="ruby-ivar">@path</span>, <span class="ruby-value str">'stderr'</span>
|
361
|
+
62: <span class="ruby-ivar">@opts</span> = <span class="ruby-identifier">opts</span>
|
362
|
+
63: <span class="ruby-identifier">raise</span> <span class="ruby-node">"q <#{ @path }> does not exist"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">test</span> <span class="ruby-operator">?</span><span class="ruby-identifier">e</span>, <span class="ruby-ivar">@path</span>
|
363
|
+
64: <span class="ruby-identifier">raise</span> <span class="ruby-node">"q <#{ @path }> is not a directory"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">test</span> <span class="ruby-operator">?</span><span class="ruby-identifier">d</span>, <span class="ruby-ivar">@path</span>
|
364
|
+
65: <span class="ruby-ivar">@basename</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">basename</span>(<span class="ruby-ivar">@path</span>)
|
365
|
+
66: <span class="ruby-ivar">@dirname</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">dirname</span>(<span class="ruby-ivar">@path</span>)
|
366
|
+
67: <span class="ruby-ivar">@logger</span> = <span class="ruby-identifier">getopt</span>(<span class="ruby-value str">'logger'</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-constant">STDERR</span>)
|
367
|
+
68: <span class="ruby-ivar">@qdb</span> = <span class="ruby-identifier">getopt</span>(<span class="ruby-value str">'qdb'</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">QDB</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span>(<span class="ruby-ivar">@path</span>, <span class="ruby-value str">'db'</span>), <span class="ruby-value str">'logger'</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@logger</span>)
|
368
|
+
69: <span class="ruby-ivar">@in_transaction</span> = <span class="ruby-keyword kw">false</span>
|
369
|
+
70: <span class="ruby-ivar">@in_ro_transaction</span> = <span class="ruby-keyword kw">false</span>
|
370
|
+
71: <span class="ruby-comment cmt">#--}}}</span>
|
371
|
+
72: <span class="ruby-keyword kw">end</span>
|
372
|
+
</pre>
|
373
|
+
</div>
|
374
|
+
</div>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
<h2 class="section-bar">Public Instance methods</h2>
|
378
|
+
|
379
|
+
<div id="method-M000294" class="method-detail">
|
380
|
+
<a name="M000294"></a>
|
381
|
+
|
382
|
+
<div class="method-heading">
|
383
|
+
<a href="#M000294" class="method-signature">
|
384
|
+
<span class="method-name">[]=</span><span class="method-args">key, value</span>
|
385
|
+
</a>
|
386
|
+
</div>
|
387
|
+
|
388
|
+
<div class="method-description">
|
389
|
+
<p><a class="source-toggle" href="#"
|
390
|
+
onclick="toggleCode('M000294-source');return false;">[Source]</a></p>
|
391
|
+
<div class="method-source-code" id="M000294-source">
|
392
|
+
<pre>
|
393
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 882</span>
|
394
|
+
882: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>
|
395
|
+
883: <span class="ruby-comment cmt">#--{{{</span>
|
396
|
+
884: <span class="ruby-identifier">sql</span> = <span class="ruby-node">"select count(*) from attributes where key='#{ key }';"</span>
|
397
|
+
885: <span class="ruby-identifier">tuples</span> = <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
398
|
+
886: <span class="ruby-identifier">tuple</span> = <span class="ruby-identifier">tuples</span>.<span class="ruby-identifier">first</span>
|
399
|
+
887: <span class="ruby-identifier">count</span> = <span class="ruby-constant">Integer</span> <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'count(*)'</span>]
|
400
|
+
888: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">count</span>
|
401
|
+
889: <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span>
|
402
|
+
890: <span class="ruby-identifier">sql</span> = <span class="ruby-node">"insert into attributes values('#{ key }','#{ value }');"</span>
|
403
|
+
891: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
404
|
+
892: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span>
|
405
|
+
893: <span class="ruby-identifier">sql</span> = <span class="ruby-node">"update attributes set key='#{ key }', value='#{ value }' where key='#{ key }';"</span>
|
406
|
+
894: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
407
|
+
895: <span class="ruby-keyword kw">else</span>
|
408
|
+
896: <span class="ruby-identifier">raise</span> <span class="ruby-node">"key <#{ key }> has become corrupt!"</span>
|
409
|
+
897: <span class="ruby-keyword kw">end</span>
|
410
|
+
898: <span class="ruby-comment cmt">#--}}}</span>
|
411
|
+
899: <span class="ruby-keyword kw">end</span>
|
412
|
+
</pre>
|
413
|
+
</div>
|
414
|
+
</div>
|
415
|
+
</div>
|
416
|
+
|
417
|
+
<div id="method-M000290" class="method-detail">
|
418
|
+
<a name="M000290"></a>
|
419
|
+
|
420
|
+
<div class="method-heading">
|
421
|
+
<a href="#M000290" class="method-signature">
|
422
|
+
<span class="method-name">abort_transaction</span><span class="method-args">(*a,&b)</span>
|
423
|
+
</a>
|
424
|
+
</div>
|
425
|
+
|
426
|
+
<div class="method-description">
|
427
|
+
<p><a class="source-toggle" href="#"
|
428
|
+
onclick="toggleCode('M000290-source');return false;">[Source]</a></p>
|
429
|
+
<div class="method-source-code" id="M000290-source">
|
430
|
+
<pre>
|
431
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 810</span>
|
432
|
+
810: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">abort_transaction</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
433
|
+
811: <span class="ruby-comment cmt">#--{{{</span>
|
434
|
+
812: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">abort_transaction</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
435
|
+
813: <span class="ruby-comment cmt">#--}}}</span>
|
436
|
+
814: <span class="ruby-keyword kw">end</span>
|
437
|
+
</pre>
|
438
|
+
</div>
|
439
|
+
</div>
|
440
|
+
</div>
|
441
|
+
|
442
|
+
<div id="method-M000295" class="method-detail">
|
443
|
+
<a name="M000295"></a>
|
444
|
+
|
445
|
+
<div class="method-heading">
|
446
|
+
<a href="#M000295" class="method-signature">
|
447
|
+
<span class="method-name">attributes</span><span class="method-args">()</span>
|
448
|
+
</a>
|
449
|
+
</div>
|
450
|
+
|
451
|
+
<div class="method-description">
|
452
|
+
<p><a class="source-toggle" href="#"
|
453
|
+
onclick="toggleCode('M000295-source');return false;">[Source]</a></p>
|
454
|
+
<div class="method-source-code" id="M000295-source">
|
455
|
+
<pre>
|
456
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 900</span>
|
457
|
+
900: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attributes</span>
|
458
|
+
901: <span class="ruby-comment cmt">#--{{{</span>
|
459
|
+
902: <span class="ruby-identifier">h</span> = {}
|
460
|
+
903: <span class="ruby-identifier">tuples</span> = <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">execute</span> <span class="ruby-value str">"select * from attributes;"</span>
|
461
|
+
904: <span class="ruby-identifier">tuples</span>.<span class="ruby-identifier">map!</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">t</span>[<span class="ruby-value str">'key'</span>]] = <span class="ruby-identifier">t</span>[<span class="ruby-value str">'value'</span>]}
|
462
|
+
905: <span class="ruby-identifier">h</span>
|
463
|
+
906: <span class="ruby-comment cmt">#--}}}</span>
|
464
|
+
907: <span class="ruby-keyword kw">end</span>
|
465
|
+
</pre>
|
466
|
+
</div>
|
467
|
+
</div>
|
468
|
+
</div>
|
469
|
+
|
470
|
+
<div id="method-M000276" class="method-detail">
|
471
|
+
<a name="M000276"></a>
|
472
|
+
|
473
|
+
<div class="method-heading">
|
474
|
+
<a href="#M000276" class="method-signature">
|
475
|
+
<span class="method-name">delete</span><span class="method-args">(*args, &block)</span>
|
476
|
+
</a>
|
477
|
+
</div>
|
478
|
+
|
479
|
+
<div class="method-description">
|
480
|
+
<p><a class="source-toggle" href="#"
|
481
|
+
onclick="toggleCode('M000276-source');return false;">[Source]</a></p>
|
482
|
+
<div class="method-source-code" id="M000276-source">
|
483
|
+
<pre>
|
484
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 505</span>
|
485
|
+
505: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
486
|
+
506: <span class="ruby-comment cmt">#--{{{</span>
|
487
|
+
507: <span class="ruby-identifier">whats</span>, <span class="ruby-identifier">optargs</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">partition</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">arg</span>}
|
488
|
+
508:
|
489
|
+
509: <span class="ruby-identifier">opts</span> = {}
|
490
|
+
510: <span class="ruby-identifier">optargs</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">oa</span><span class="ruby-operator">|</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">update</span> <span class="ruby-identifier">oa</span>}
|
491
|
+
511:
|
492
|
+
512: <span class="ruby-identifier">force</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-identifier">getopt</span> <span class="ruby-value str">'force'</span>, <span class="ruby-identifier">opts</span>
|
493
|
+
513:
|
494
|
+
514: <span class="ruby-identifier">delete_sql</span>, <span class="ruby-identifier">select_sql</span> = <span class="ruby-value str">''</span>, <span class="ruby-value str">''</span>
|
495
|
+
515:
|
496
|
+
516: <span class="ruby-identifier">whats</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'all'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">whats</span>.<span class="ruby-identifier">empty?</span>
|
497
|
+
517:
|
498
|
+
518: <span class="ruby-identifier">whats</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">what</span><span class="ruby-operator">|</span>
|
499
|
+
519: <span class="ruby-keyword kw">case</span> <span class="ruby-node">"#{ what }"</span>
|
500
|
+
520: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*\d+\s*$/i</span><span class="ruby-identifier">o</span> <span class="ruby-comment cmt"># number</span>
|
501
|
+
521: <span class="ruby-identifier">delete_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"delete from jobs where jid=#{ what } and state!='running';\n"</span>
|
502
|
+
522: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"select * from jobs where jid=#{ what } and state!='running';\n"</span>
|
503
|
+
523: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*p/i</span><span class="ruby-identifier">o</span> <span class="ruby-comment cmt"># pending</span>
|
504
|
+
524: <span class="ruby-identifier">delete_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"delete from jobs where state='pending';\n"</span>
|
505
|
+
525: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"select * from jobs where state='pending';\n"</span>
|
506
|
+
526: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*h/i</span><span class="ruby-identifier">o</span> <span class="ruby-comment cmt"># holding</span>
|
507
|
+
527: <span class="ruby-identifier">delete_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"delete from jobs where state='holding';\n"</span>
|
508
|
+
528: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"select * from jobs where state='holding';\n"</span>
|
509
|
+
529: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*r/i</span><span class="ruby-identifier">o</span> <span class="ruby-comment cmt"># running</span>
|
510
|
+
530: <span class="ruby-identifier">delete_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"delete from jobs where state='running';\n"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">force</span>
|
511
|
+
531: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"select * from jobs where state='running';\n"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">force</span>
|
512
|
+
532: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*f/i</span><span class="ruby-identifier">o</span> <span class="ruby-comment cmt"># finished</span>
|
513
|
+
533: <span class="ruby-identifier">delete_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"delete from jobs where state='finished';\n"</span>
|
514
|
+
534: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"select * from jobs where state='finished';\n"</span>
|
515
|
+
535: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*d/i</span><span class="ruby-identifier">o</span> <span class="ruby-comment cmt"># dead</span>
|
516
|
+
536: <span class="ruby-identifier">delete_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"delete from jobs where state='dead';\n"</span>
|
517
|
+
537: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"select * from jobs where state='dead';\n"</span>
|
518
|
+
538: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*a/i</span><span class="ruby-identifier">o</span> <span class="ruby-comment cmt"># all</span>
|
519
|
+
539: <span class="ruby-identifier">delete_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"delete from jobs where state!='running';\n"</span>
|
520
|
+
540: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"select * from jobs where state!='running';\n"</span>
|
521
|
+
541: <span class="ruby-keyword kw">else</span>
|
522
|
+
542: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"cannot delete <#{ what.inspect }>"</span>
|
523
|
+
543: <span class="ruby-keyword kw">end</span>
|
524
|
+
544: <span class="ruby-keyword kw">end</span>
|
525
|
+
545:
|
526
|
+
546: <span class="ruby-identifier">scrub</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">jid</span><span class="ruby-operator">|</span>
|
527
|
+
547: [<span class="ruby-identifier">standard_in_4</span>(<span class="ruby-identifier">jid</span>), <span class="ruby-identifier">standard_out_4</span>(<span class="ruby-identifier">jid</span>), <span class="ruby-identifier">standard_err_4</span>(<span class="ruby-identifier">jid</span>)].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
|
528
|
+
548: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_f</span> <span class="ruby-identifier">path</span>
|
529
|
+
549: <span class="ruby-keyword kw">end</span>
|
530
|
+
550: <span class="ruby-keyword kw">end</span>
|
531
|
+
551:
|
532
|
+
552: <span class="ruby-identifier">tuples</span> = []
|
533
|
+
553:
|
534
|
+
554: <span class="ruby-identifier">metablock</span> =
|
535
|
+
555: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
|
536
|
+
556: <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tuple</span><span class="ruby-operator">|</span>
|
537
|
+
557: <span class="ruby-identifier">jid</span> = <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'jid'</span>]
|
538
|
+
558: <span class="ruby-identifier">block</span>[<span class="ruby-identifier">tuple</span>]
|
539
|
+
559: <span class="ruby-identifier">scrub</span>[<span class="ruby-identifier">jid</span>]
|
540
|
+
560: <span class="ruby-keyword kw">end</span>
|
541
|
+
561: <span class="ruby-keyword kw">else</span>
|
542
|
+
562: <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tuple</span><span class="ruby-operator">|</span>
|
543
|
+
563: <span class="ruby-identifier">jid</span> = <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'jid'</span>]
|
544
|
+
564: <span class="ruby-identifier">scrub</span>[<span class="ruby-identifier">jid</span>]
|
545
|
+
565: <span class="ruby-identifier">tuples</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tuple</span>
|
546
|
+
566: <span class="ruby-keyword kw">end</span>
|
547
|
+
567: <span class="ruby-keyword kw">end</span>
|
548
|
+
568:
|
549
|
+
569: <span class="ruby-comment cmt"># TODO - make file deletion transactional too</span>
|
550
|
+
570:
|
551
|
+
571: <span class="ruby-identifier">transaction</span> <span class="ruby-keyword kw">do</span>
|
552
|
+
572: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">select_sql</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">metablock</span>)
|
553
|
+
573: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">delete_sql</span>){}
|
554
|
+
574: <span class="ruby-keyword kw">end</span>
|
555
|
+
575:
|
556
|
+
576: <span class="ruby-identifier">delete_sql</span> = <span class="ruby-keyword kw">nil</span>
|
557
|
+
577: <span class="ruby-identifier">select_sql</span> = <span class="ruby-keyword kw">nil</span>
|
558
|
+
578:
|
559
|
+
579: <span class="ruby-identifier">block</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">tuples</span>
|
560
|
+
580: <span class="ruby-comment cmt">#--}}}</span>
|
561
|
+
581: <span class="ruby-keyword kw">end</span>
|
562
|
+
</pre>
|
563
|
+
</div>
|
564
|
+
</div>
|
565
|
+
</div>
|
566
|
+
|
567
|
+
<div id="method-M000286" class="method-detail">
|
568
|
+
<a name="M000286"></a>
|
569
|
+
|
570
|
+
<div class="method-heading">
|
571
|
+
<a href="#M000286" class="method-signature">
|
572
|
+
<span class="method-name">execute</span><span class="method-args">(*args, &block)</span>
|
573
|
+
</a>
|
574
|
+
</div>
|
575
|
+
|
576
|
+
<div class="method-description">
|
577
|
+
<p><a class="source-toggle" href="#"
|
578
|
+
onclick="toggleCode('M000286-source');return false;">[Source]</a></p>
|
579
|
+
<div class="method-source-code" id="M000286-source">
|
580
|
+
<pre>
|
581
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 790</span>
|
582
|
+
790: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">execute</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
583
|
+
791: <span class="ruby-comment cmt">#--{{{</span>
|
584
|
+
792: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
585
|
+
793: <span class="ruby-comment cmt">#--}}}</span>
|
586
|
+
794: <span class="ruby-keyword kw">end</span>
|
587
|
+
</pre>
|
588
|
+
</div>
|
589
|
+
</div>
|
590
|
+
</div>
|
591
|
+
|
592
|
+
<div id="method-M000282" class="method-detail">
|
593
|
+
<a name="M000282"></a>
|
594
|
+
|
595
|
+
<div class="method-heading">
|
596
|
+
<a href="#M000282" class="method-signature">
|
597
|
+
<span class="method-name">getdeadjobs</span><span class="method-args">(started, &block)</span>
|
598
|
+
</a>
|
599
|
+
</div>
|
600
|
+
|
601
|
+
<div class="method-description">
|
602
|
+
<p><a class="source-toggle" href="#"
|
603
|
+
onclick="toggleCode('M000282-source');return false;">[Source]</a></p>
|
604
|
+
<div class="method-source-code" id="M000282-source">
|
605
|
+
<pre>
|
606
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 727</span>
|
607
|
+
727: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getdeadjobs</span>(<span class="ruby-identifier">started</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
608
|
+
728: <span class="ruby-comment cmt">#--{{{</span>
|
609
|
+
729: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
610
|
+
730: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select * from jobs\nwhere\nstate = 'running' and\nrunner='\#{ Util::hostname }' and\nstarted<='\#{ started }'\n"</span>
|
611
|
+
731: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
|
612
|
+
732: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
613
|
+
733: <span class="ruby-keyword kw">else</span>
|
614
|
+
734: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>)
|
615
|
+
735: <span class="ruby-keyword kw">end</span>
|
616
|
+
736: <span class="ruby-identifier">ret</span>
|
617
|
+
737: <span class="ruby-comment cmt">#--}}}</span>
|
618
|
+
738: <span class="ruby-keyword kw">end</span>
|
619
|
+
</pre>
|
620
|
+
</div>
|
621
|
+
</div>
|
622
|
+
</div>
|
623
|
+
|
624
|
+
<div id="method-M000279" class="method-detail">
|
625
|
+
<a name="M000279"></a>
|
626
|
+
|
627
|
+
<div class="method-heading">
|
628
|
+
<a href="#M000279" class="method-signature">
|
629
|
+
<span class="method-name">getjob</span><span class="method-args">()</span>
|
630
|
+
</a>
|
631
|
+
</div>
|
632
|
+
|
633
|
+
<div class="method-description">
|
634
|
+
<p><a class="source-toggle" href="#"
|
635
|
+
onclick="toggleCode('M000279-source');return false;">[Source]</a></p>
|
636
|
+
<div class="method-source-code" id="M000279-source">
|
637
|
+
<pre>
|
638
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 679</span>
|
639
|
+
679: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getjob</span>
|
640
|
+
680: <span class="ruby-comment cmt">#--{{{</span>
|
641
|
+
681: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select * from jobs\nwhere\n(state='pending' or (state='dead' and (not restartable isnull))) and\n(runner like '%\#{ Util::host }%' or runner isnull)\norder by priority desc, submitted asc, jid asc\nlimit 1;\n"</span>
|
642
|
+
682: <span class="ruby-identifier">tuples</span> = <span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
643
|
+
683: <span class="ruby-identifier">job</span> = <span class="ruby-identifier">tuples</span>.<span class="ruby-identifier">first</span>
|
644
|
+
684: <span class="ruby-identifier">job</span>
|
645
|
+
685: <span class="ruby-comment cmt">#--}}}</span>
|
646
|
+
686: <span class="ruby-keyword kw">end</span>
|
647
|
+
</pre>
|
648
|
+
</div>
|
649
|
+
</div>
|
650
|
+
</div>
|
651
|
+
|
652
|
+
<div id="method-M000287" class="method-detail">
|
653
|
+
<a name="M000287"></a>
|
654
|
+
|
655
|
+
<div class="method-heading">
|
656
|
+
<a href="#M000287" class="method-signature">
|
657
|
+
<span class="method-name">integrity_check</span><span class="method-args">(*args, &block)</span>
|
658
|
+
</a>
|
659
|
+
</div>
|
660
|
+
|
661
|
+
<div class="method-description">
|
662
|
+
<p><a class="source-toggle" href="#"
|
663
|
+
onclick="toggleCode('M000287-source');return false;">[Source]</a></p>
|
664
|
+
<div class="method-source-code" id="M000287-source">
|
665
|
+
<pre>
|
666
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 795</span>
|
667
|
+
795: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">integrity_check</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
668
|
+
796: <span class="ruby-comment cmt">#--{{{</span>
|
669
|
+
797: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">integrity_check</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
670
|
+
798: <span class="ruby-comment cmt">#--}}}</span>
|
671
|
+
799: <span class="ruby-keyword kw">end</span>
|
672
|
+
</pre>
|
673
|
+
</div>
|
674
|
+
</div>
|
675
|
+
</div>
|
676
|
+
|
677
|
+
<div id="method-M000283" class="method-detail">
|
678
|
+
<a name="M000283"></a>
|
679
|
+
|
680
|
+
<div class="method-heading">
|
681
|
+
<a href="#M000283" class="method-signature">
|
682
|
+
<span class="method-name">jobisdead</span><span class="method-args">job</span>
|
683
|
+
</a>
|
684
|
+
</div>
|
685
|
+
|
686
|
+
<div class="method-description">
|
687
|
+
<p><a class="source-toggle" href="#"
|
688
|
+
onclick="toggleCode('M000283-source');return false;">[Source]</a></p>
|
689
|
+
<div class="method-source-code" id="M000283-source">
|
690
|
+
<pre>
|
691
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 746</span>
|
692
|
+
746: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">jobisdead</span> <span class="ruby-identifier">job</span>
|
693
|
+
747: <span class="ruby-comment cmt">#--{{{</span>
|
694
|
+
748: <span class="ruby-identifier">jid</span> = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'jid'</span>]
|
695
|
+
749: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jid</span>
|
696
|
+
750: <span class="ruby-identifier">sql</span> = <span class="ruby-node">"update jobs set state='dead' where jid='#{ jid }'"</span>
|
697
|
+
751: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>){}
|
698
|
+
752: <span class="ruby-keyword kw">end</span>
|
699
|
+
753: <span class="ruby-identifier">job</span>
|
700
|
+
754: <span class="ruby-comment cmt">#--}}}</span>
|
701
|
+
755: <span class="ruby-keyword kw">end</span>
|
702
|
+
</pre>
|
703
|
+
</div>
|
704
|
+
</div>
|
705
|
+
</div>
|
706
|
+
|
707
|
+
<div id="method-M000281" class="method-detail">
|
708
|
+
<a name="M000281"></a>
|
709
|
+
|
710
|
+
<div class="method-heading">
|
711
|
+
<a href="#M000281" class="method-signature">
|
712
|
+
<span class="method-name">jobisdone</span><span class="method-args">job</span>
|
713
|
+
</a>
|
714
|
+
</div>
|
715
|
+
|
716
|
+
<div class="method-description">
|
717
|
+
<p><a class="source-toggle" href="#"
|
718
|
+
onclick="toggleCode('M000281-source');return false;">[Source]</a></p>
|
719
|
+
<div class="method-source-code" id="M000281-source">
|
720
|
+
<pre>
|
721
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 712</span>
|
722
|
+
712: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">jobisdone</span> <span class="ruby-identifier">job</span>
|
723
|
+
713: <span class="ruby-comment cmt">#--{{{</span>
|
724
|
+
714: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"update jobs\nset\nstate = '\#{ job['state'] }',\nexit_status = '\#{ job['exit_status'] }',\nfinished = '\#{ job['finished'] }',\nelapsed = '\#{ job['elapsed'] }'\nwhere jid = \#{ job['jid'] };\n"</span>
|
725
|
+
715: <span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
726
|
+
716: <span class="ruby-comment cmt">#--}}}</span>
|
727
|
+
717: <span class="ruby-keyword kw">end</span>
|
728
|
+
</pre>
|
729
|
+
</div>
|
730
|
+
</div>
|
731
|
+
</div>
|
732
|
+
|
733
|
+
<div id="method-M000280" class="method-detail">
|
734
|
+
<a name="M000280"></a>
|
735
|
+
|
736
|
+
<div class="method-heading">
|
737
|
+
<a href="#M000280" class="method-signature">
|
738
|
+
<span class="method-name">jobisrunning</span><span class="method-args">job</span>
|
739
|
+
</a>
|
740
|
+
</div>
|
741
|
+
|
742
|
+
<div class="method-description">
|
743
|
+
<p><a class="source-toggle" href="#"
|
744
|
+
onclick="toggleCode('M000280-source');return false;">[Source]</a></p>
|
745
|
+
<div class="method-source-code" id="M000280-source">
|
746
|
+
<pre>
|
747
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 695</span>
|
748
|
+
695: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">jobisrunning</span> <span class="ruby-identifier">job</span>
|
749
|
+
696: <span class="ruby-comment cmt">#--{{{</span>
|
750
|
+
697: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"update jobs\nset\npid='\#{ job['pid'] }',\nstate='\#{ job['state'] }',\nstarted='\#{ job['started'] }',\nrunner='\#{ job['runner'] }',\nstdout='\#{ job['stdout'] }',\nstderr='\#{ job['stderr'] }'\nwhere jid=\#{ job['jid'] };\n"</span>
|
751
|
+
698: <span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
752
|
+
699: <span class="ruby-comment cmt">#--}}}</span>
|
753
|
+
700: <span class="ruby-keyword kw">end</span>
|
754
|
+
</pre>
|
755
|
+
</div>
|
756
|
+
</div>
|
757
|
+
</div>
|
758
|
+
|
759
|
+
<div id="method-M000273" class="method-detail">
|
760
|
+
<a name="M000273"></a>
|
761
|
+
|
762
|
+
<div class="method-heading">
|
763
|
+
<a href="#M000273" class="method-signature">
|
764
|
+
<span class="method-name">list</span><span class="method-args">(*whats, &block)</span>
|
765
|
+
</a>
|
766
|
+
</div>
|
767
|
+
|
768
|
+
<div class="method-description">
|
769
|
+
<p><a class="source-toggle" href="#"
|
770
|
+
onclick="toggleCode('M000273-source');return false;">[Source]</a></p>
|
771
|
+
<div class="method-source-code" id="M000273-source">
|
772
|
+
<pre>
|
773
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 245</span>
|
774
|
+
245: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">whats</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
775
|
+
246: <span class="ruby-comment cmt">#--{{{</span>
|
776
|
+
247: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
777
|
+
248:
|
778
|
+
249: <span class="ruby-identifier">whats</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-node">%( pending running finished dead )</span>) <span class="ruby-keyword kw">if</span>
|
779
|
+
250: <span class="ruby-identifier">whats</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">whats</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">'all'</span>)
|
780
|
+
251:
|
781
|
+
252: <span class="ruby-identifier">whats</span>.<span class="ruby-identifier">map!</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">what</span><span class="ruby-operator">|</span>
|
782
|
+
253: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">what</span>
|
783
|
+
254: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*p/i</span><span class="ruby-identifier">o</span>
|
784
|
+
255: <span class="ruby-value str">'pending'</span>
|
785
|
+
256: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*h/i</span><span class="ruby-identifier">o</span>
|
786
|
+
257: <span class="ruby-value str">'holding'</span>
|
787
|
+
258: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*r/i</span><span class="ruby-identifier">o</span>
|
788
|
+
259: <span class="ruby-value str">'running'</span>
|
789
|
+
260: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*f/i</span><span class="ruby-identifier">o</span>
|
790
|
+
261: <span class="ruby-value str">'finished'</span>
|
791
|
+
262: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^\s*d/i</span><span class="ruby-identifier">o</span>
|
792
|
+
263: <span class="ruby-value str">'dead'</span>
|
793
|
+
264: <span class="ruby-keyword kw">else</span>
|
794
|
+
265: <span class="ruby-identifier">what</span>
|
795
|
+
266: <span class="ruby-keyword kw">end</span>
|
796
|
+
267: <span class="ruby-keyword kw">end</span>
|
797
|
+
268:
|
798
|
+
269: <span class="ruby-identifier">where_clauses</span> = []
|
799
|
+
270:
|
800
|
+
271: <span class="ruby-identifier">whats</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">what</span><span class="ruby-operator">|</span>
|
801
|
+
272: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">what</span>
|
802
|
+
273: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Numeric</span>
|
803
|
+
274: <span class="ruby-identifier">where_clauses</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"jid=#{ what }\n"</span>
|
804
|
+
275: <span class="ruby-keyword kw">else</span>
|
805
|
+
276: <span class="ruby-identifier">what</span> = <span class="ruby-node">"#{ what }"</span>
|
806
|
+
277: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">what</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%/^\s*\d+\s*$/o</span>
|
807
|
+
278: <span class="ruby-identifier">where_clauses</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"jid=#{ QDB::q what }\n"</span>
|
808
|
+
279: <span class="ruby-keyword kw">else</span>
|
809
|
+
280: <span class="ruby-identifier">where_clauses</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"state=#{ QDB::q what }\n"</span>
|
810
|
+
281: <span class="ruby-keyword kw">end</span>
|
811
|
+
282: <span class="ruby-keyword kw">end</span>
|
812
|
+
283: <span class="ruby-keyword kw">end</span>
|
813
|
+
284:
|
814
|
+
285: <span class="ruby-identifier">where_clause</span> = <span class="ruby-identifier">where_clauses</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">" or \n"</span>)
|
815
|
+
286:
|
816
|
+
287: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select * from jobs\nwhere \#{ where_clause }\n"</span>
|
817
|
+
288:
|
818
|
+
289: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
|
819
|
+
290: <span class="ruby-identifier">ro_transaction</span>{ <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) }
|
820
|
+
291: <span class="ruby-keyword kw">else</span>
|
821
|
+
292: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">ro_transaction</span>{ <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>) }
|
822
|
+
293: <span class="ruby-keyword kw">end</span>
|
823
|
+
294:
|
824
|
+
295: <span class="ruby-identifier">ret</span>
|
825
|
+
296: <span class="ruby-comment cmt">#--}}}</span>
|
826
|
+
297: <span class="ruby-keyword kw">end</span>
|
827
|
+
</pre>
|
828
|
+
</div>
|
829
|
+
</div>
|
830
|
+
</div>
|
831
|
+
|
832
|
+
<div id="method-M000289" class="method-detail">
|
833
|
+
<a name="M000289"></a>
|
834
|
+
|
835
|
+
<div class="method-heading">
|
836
|
+
<a href="#M000289" class="method-signature">
|
837
|
+
<span class="method-name">lock</span><span class="method-args">(*args, &block)</span>
|
838
|
+
</a>
|
839
|
+
</div>
|
840
|
+
|
841
|
+
<div class="method-description">
|
842
|
+
<p><a class="source-toggle" href="#"
|
843
|
+
onclick="toggleCode('M000289-source');return false;">[Source]</a></p>
|
844
|
+
<div class="method-source-code" id="M000289-source">
|
845
|
+
<pre>
|
846
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 805</span>
|
847
|
+
805: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lock</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
848
|
+
806: <span class="ruby-comment cmt">#--{{{</span>
|
849
|
+
807: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">lock</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
850
|
+
808: <span class="ruby-comment cmt">#--}}}</span>
|
851
|
+
809: <span class="ruby-keyword kw">end</span>
|
852
|
+
</pre>
|
853
|
+
</div>
|
854
|
+
</div>
|
855
|
+
</div>
|
856
|
+
|
857
|
+
<div id="method-M000293" class="method-detail">
|
858
|
+
<a name="M000293"></a>
|
859
|
+
|
860
|
+
<div class="method-heading">
|
861
|
+
<a href="#M000293" class="method-signature">
|
862
|
+
<span class="method-name">mtime</span><span class="method-args">()</span>
|
863
|
+
</a>
|
864
|
+
</div>
|
865
|
+
|
866
|
+
<div class="method-description">
|
867
|
+
<p>
|
868
|
+
TODO - use mtime to optimize checks by feeder??
|
869
|
+
</p>
|
870
|
+
<p><a class="source-toggle" href="#"
|
871
|
+
onclick="toggleCode('M000293-source');return false;">[Source]</a></p>
|
872
|
+
<div class="method-source-code" id="M000293-source">
|
873
|
+
<pre>
|
874
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 877</span>
|
875
|
+
877: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mtime</span>
|
876
|
+
878: <span class="ruby-comment cmt">#--{{{</span>
|
877
|
+
879: <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">stat</span>(<span class="ruby-ivar">@path</span>).<span class="ruby-identifier">mtime</span>
|
878
|
+
880: <span class="ruby-comment cmt">#--}}}</span>
|
879
|
+
881: <span class="ruby-keyword kw">end</span>
|
880
|
+
</pre>
|
881
|
+
</div>
|
882
|
+
</div>
|
883
|
+
</div>
|
884
|
+
|
885
|
+
<div id="method-M000275" class="method-detail">
|
886
|
+
<a name="M000275"></a>
|
887
|
+
|
888
|
+
<div class="method-heading">
|
889
|
+
<a href="#M000275" class="method-signature">
|
890
|
+
<span class="method-name">query</span><span class="method-args">(where_clause = nil, &block)</span>
|
891
|
+
</a>
|
892
|
+
</div>
|
893
|
+
|
894
|
+
<div class="method-description">
|
895
|
+
<p><a class="source-toggle" href="#"
|
896
|
+
onclick="toggleCode('M000275-source');return false;">[Source]</a></p>
|
897
|
+
<div class="method-source-code" id="M000275-source">
|
898
|
+
<pre>
|
899
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 475</span>
|
900
|
+
475: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">where_clause</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
901
|
+
476: <span class="ruby-comment cmt">#--{{{</span>
|
902
|
+
477: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
903
|
+
478:
|
904
|
+
479: <span class="ruby-identifier">sql</span> =
|
905
|
+
480: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">where_clause</span>
|
906
|
+
481:
|
907
|
+
482: <span class="ruby-comment cmt">#</span>
|
908
|
+
483: <span class="ruby-comment cmt"># turn =~ into like clauses </span>
|
909
|
+
484: <span class="ruby-comment cmt">#</span>
|
910
|
+
485: <span class="ruby-comment cmt">#where_clause.gsub!(/(=~\s*([^\s')(=]+))/om){q = $2.gsub(%r/'+|\s+/o,''); "like '%#{ q }%'"}</span>
|
911
|
+
486: <span class="ruby-comment cmt">#</span>
|
912
|
+
487: <span class="ruby-comment cmt"># quote everything on the rhs of an '=' sign - helps with shell problems...</span>
|
913
|
+
488: <span class="ruby-comment cmt">#</span>
|
914
|
+
489: <span class="ruby-comment cmt">#where_clause.gsub!(/(==?\s*([^\s')(=]+))/om){q = $2.gsub(%r/'+|\s+/o,''); "='#{ q }'"}</span>
|
915
|
+
490:
|
916
|
+
491: <span class="ruby-node">"select * from jobs where #{ where_clause };"</span>
|
917
|
+
492: <span class="ruby-keyword kw">else</span>
|
918
|
+
493: <span class="ruby-value str">"select * from jobs;"</span>
|
919
|
+
494: <span class="ruby-keyword kw">end</span>
|
920
|
+
495:
|
921
|
+
496: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
|
922
|
+
497: <span class="ruby-identifier">ro_transaction</span>{ <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) }
|
923
|
+
498: <span class="ruby-keyword kw">else</span>
|
924
|
+
499: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">ro_transaction</span>{ <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>) }
|
925
|
+
500: <span class="ruby-keyword kw">end</span>
|
926
|
+
501:
|
927
|
+
502: <span class="ruby-identifier">ret</span>
|
928
|
+
503: <span class="ruby-comment cmt">#--}}}</span>
|
929
|
+
504: <span class="ruby-keyword kw">end</span>
|
930
|
+
</pre>
|
931
|
+
</div>
|
932
|
+
</div>
|
933
|
+
</div>
|
934
|
+
|
935
|
+
<div id="method-M000288" class="method-detail">
|
936
|
+
<a name="M000288"></a>
|
937
|
+
|
938
|
+
<div class="method-heading">
|
939
|
+
<a href="#M000288" class="method-signature">
|
940
|
+
<span class="method-name">recover!</span><span class="method-args">(*args, &block)</span>
|
941
|
+
</a>
|
942
|
+
</div>
|
943
|
+
|
944
|
+
<div class="method-description">
|
945
|
+
<p><a class="source-toggle" href="#"
|
946
|
+
onclick="toggleCode('M000288-source');return false;">[Source]</a></p>
|
947
|
+
<div class="method-source-code" id="M000288-source">
|
948
|
+
<pre>
|
949
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 800</span>
|
950
|
+
800: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">recover!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
951
|
+
801: <span class="ruby-comment cmt">#--{{{</span>
|
952
|
+
802: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">recover!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
953
|
+
803: <span class="ruby-comment cmt">#--}}}</span>
|
954
|
+
804: <span class="ruby-keyword kw">end</span>
|
955
|
+
</pre>
|
956
|
+
</div>
|
957
|
+
</div>
|
958
|
+
</div>
|
959
|
+
|
960
|
+
<div id="method-M000271" class="method-detail">
|
961
|
+
<a name="M000271"></a>
|
962
|
+
|
963
|
+
<div class="method-heading">
|
964
|
+
<a href="#M000271" class="method-signature">
|
965
|
+
<span class="method-name">resubmit</span><span class="method-args">(*jobs, &block)</span>
|
966
|
+
</a>
|
967
|
+
</div>
|
968
|
+
|
969
|
+
<div class="method-description">
|
970
|
+
<p><a class="source-toggle" href="#"
|
971
|
+
onclick="toggleCode('M000271-source');return false;">[Source]</a></p>
|
972
|
+
<div class="method-source-code" id="M000271-source">
|
973
|
+
<pre>
|
974
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 157</span>
|
975
|
+
157: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">resubmit</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">jobs</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
976
|
+
158: <span class="ruby-comment cmt">#--{{{</span>
|
977
|
+
159: <span class="ruby-identifier">now</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-identifier">timestamp</span> <span class="ruby-constant">Time</span><span class="ruby-operator">::</span><span class="ruby-identifier">now</span>
|
978
|
+
160:
|
979
|
+
161: <span class="ruby-identifier">transaction</span> <span class="ruby-keyword kw">do</span>
|
980
|
+
162: <span class="ruby-identifier">jobs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">job</span><span class="ruby-operator">|</span>
|
981
|
+
163: <span class="ruby-identifier">jid</span> = <span class="ruby-constant">Integer</span> <span class="ruby-identifier">job</span>[<span class="ruby-value str">'jid'</span>]
|
982
|
+
164: <span class="ruby-identifier">command</span> = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'command'</span>]
|
983
|
+
165: <span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'stdin'</span>]
|
984
|
+
166:
|
985
|
+
167: <span class="ruby-identifier">raise</span> <span class="ruby-node">"no jid for job <#{ job.inspect }>"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">jid</span>
|
986
|
+
168: <span class="ruby-identifier">raise</span> <span class="ruby-node">"no command for job <#{ job.inspect }>"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">command</span>
|
987
|
+
169:
|
988
|
+
170: <span class="ruby-identifier">tmp_stdin</span>(<span class="ruby-identifier">stdin</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ts</span><span class="ruby-operator">|</span>
|
989
|
+
171: <span class="ruby-identifier">tuple</span> = <span class="ruby-constant">QDB</span><span class="ruby-operator">::</span><span class="ruby-identifier">tuple</span>
|
990
|
+
172:
|
991
|
+
173: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'jid'</span>] = <span class="ruby-identifier">jid</span>
|
992
|
+
174: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'command'</span>] = <span class="ruby-identifier">command</span>
|
993
|
+
175: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'priority'</span>] = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'priority'</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
994
|
+
176: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'tag'</span>] = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'tag'</span>]
|
995
|
+
177: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'runner'</span>] = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'runner'</span>]
|
996
|
+
178: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'restartable'</span>] = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'restartable'</span>]
|
997
|
+
179: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'state'</span>] = <span class="ruby-value str">'pending'</span>
|
998
|
+
180: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'submitted'</span>] = <span class="ruby-identifier">now</span>
|
999
|
+
181: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'submitter'</span>] = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-identifier">hostname</span>
|
1000
|
+
182: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'stdin'</span>] = <span class="ruby-identifier">stdin4</span> <span class="ruby-identifier">jid</span>
|
1001
|
+
183: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'stdout'</span>] = <span class="ruby-keyword kw">nil</span>
|
1002
|
+
184: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'stderr'</span>] = <span class="ruby-keyword kw">nil</span>
|
1003
|
+
185:
|
1004
|
+
186: <span class="ruby-identifier">kvs</span> = <span class="ruby-identifier">tuple</span>.<span class="ruby-identifier">fields</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{ f }=#{ QDB::q(tuple[ f ]) }"</span>}
|
1005
|
+
187: <span class="ruby-identifier">sql</span> = <span class="ruby-node">"update jobs set #{ kvs.join ',' } where jid=#{ jid };\n"</span>
|
1006
|
+
188:
|
1007
|
+
189: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>){}
|
1008
|
+
190:
|
1009
|
+
191: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">standard_in_4</span>(<span class="ruby-identifier">jid</span>)
|
1010
|
+
192: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">standard_out_4</span>(<span class="ruby-identifier">jid</span>)
|
1011
|
+
193: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">standard_err_4</span>(<span class="ruby-identifier">jid</span>)
|
1012
|
+
194: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">cp</span> <span class="ruby-identifier">ts</span>.<span class="ruby-identifier">path</span>, <span class="ruby-identifier">standard_in_4</span>(<span class="ruby-identifier">jid</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ts</span>
|
1013
|
+
195:
|
1014
|
+
196: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
|
1015
|
+
197: <span class="ruby-identifier">sql</span> = <span class="ruby-node">"select * from jobs where jid = '#{ jid }'"</span>
|
1016
|
+
198: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1017
|
+
199: <span class="ruby-keyword kw">end</span>
|
1018
|
+
200: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># tmp_stdin</span>
|
1019
|
+
201: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># jobs.each</span>
|
1020
|
+
202: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># transaction</span>
|
1021
|
+
203:
|
1022
|
+
204: <span class="ruby-keyword kw">self</span>
|
1023
|
+
205: <span class="ruby-comment cmt">#--}}}</span>
|
1024
|
+
206: <span class="ruby-keyword kw">end</span>
|
1025
|
+
</pre>
|
1026
|
+
</div>
|
1027
|
+
</div>
|
1028
|
+
</div>
|
1029
|
+
|
1030
|
+
<div id="method-M000285" class="method-detail">
|
1031
|
+
<a name="M000285"></a>
|
1032
|
+
|
1033
|
+
<div class="method-heading">
|
1034
|
+
<a href="#M000285" class="method-signature">
|
1035
|
+
<span class="method-name">ro_transaction</span><span class="method-args">(*args) {|| ...}</span>
|
1036
|
+
</a>
|
1037
|
+
</div>
|
1038
|
+
|
1039
|
+
<div class="method-description">
|
1040
|
+
<p><a class="source-toggle" href="#"
|
1041
|
+
onclick="toggleCode('M000285-source');return false;">[Source]</a></p>
|
1042
|
+
<div class="method-source-code" id="M000285-source">
|
1043
|
+
<pre>
|
1044
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 774</span>
|
1045
|
+
774: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ro_transaction</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
1046
|
+
775: <span class="ruby-comment cmt">#--{{{</span>
|
1047
|
+
776: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
1048
|
+
777: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@in_ro_transaction</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@in_transaction</span>
|
1049
|
+
778: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">yield</span>
|
1050
|
+
779: <span class="ruby-keyword kw">else</span>
|
1051
|
+
780: <span class="ruby-keyword kw">begin</span>
|
1052
|
+
781: <span class="ruby-ivar">@in_ro_transaction</span> = <span class="ruby-keyword kw">true</span>
|
1053
|
+
782: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">ro_transaction</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>){ <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">yield</span> }
|
1054
|
+
783: <span class="ruby-keyword kw">ensure</span>
|
1055
|
+
784: <span class="ruby-ivar">@in_ro_transaction</span> = <span class="ruby-keyword kw">false</span>
|
1056
|
+
785: <span class="ruby-keyword kw">end</span>
|
1057
|
+
786: <span class="ruby-keyword kw">end</span>
|
1058
|
+
787: <span class="ruby-identifier">ret</span>
|
1059
|
+
788: <span class="ruby-comment cmt">#--}}}</span>
|
1060
|
+
789: <span class="ruby-keyword kw">end</span>
|
1061
|
+
</pre>
|
1062
|
+
</div>
|
1063
|
+
</div>
|
1064
|
+
</div>
|
1065
|
+
|
1066
|
+
<div id="method-M000291" class="method-detail">
|
1067
|
+
<a name="M000291"></a>
|
1068
|
+
|
1069
|
+
<div class="method-heading">
|
1070
|
+
<a href="#M000291" class="method-signature">
|
1071
|
+
<span class="method-name">rollback_transaction</span><span class="method-args">(*a,&b)</span>
|
1072
|
+
</a>
|
1073
|
+
</div>
|
1074
|
+
|
1075
|
+
<div class="method-description">
|
1076
|
+
<p><a class="source-toggle" href="#"
|
1077
|
+
onclick="toggleCode('M000291-source');return false;">[Source]</a></p>
|
1078
|
+
<div class="method-source-code" id="M000291-source">
|
1079
|
+
<pre>
|
1080
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 815</span>
|
1081
|
+
815: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rollback_transaction</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
1082
|
+
816: <span class="ruby-comment cmt">#--{{{</span>
|
1083
|
+
817: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">rollback_transaction</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
1084
|
+
818: <span class="ruby-comment cmt">#--}}}</span>
|
1085
|
+
819: <span class="ruby-keyword kw">end</span>
|
1086
|
+
</pre>
|
1087
|
+
</div>
|
1088
|
+
</div>
|
1089
|
+
</div>
|
1090
|
+
|
1091
|
+
<div id="method-M000292" class="method-detail">
|
1092
|
+
<a name="M000292"></a>
|
1093
|
+
|
1094
|
+
<div class="method-heading">
|
1095
|
+
<a href="#M000292" class="method-signature">
|
1096
|
+
<span class="method-name">snapshot</span><span class="method-args">qtmp = "#{ @basename }.snapshot", retries = nil</span>
|
1097
|
+
</a>
|
1098
|
+
</div>
|
1099
|
+
|
1100
|
+
<div class="method-description">
|
1101
|
+
<p><a class="source-toggle" href="#"
|
1102
|
+
onclick="toggleCode('M000292-source');return false;">[Source]</a></p>
|
1103
|
+
<div class="method-source-code" id="M000292-source">
|
1104
|
+
<pre>
|
1105
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 821</span>
|
1106
|
+
821: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snapshot</span> <span class="ruby-identifier">qtmp</span> = <span class="ruby-node">"#{ @basename }.snapshot"</span>, <span class="ruby-identifier">retries</span> = <span class="ruby-keyword kw">nil</span>
|
1107
|
+
822: <span class="ruby-comment cmt">#--{{{</span>
|
1108
|
+
823: <span class="ruby-identifier">qtmp</span> <span class="ruby-operator">||=</span> <span class="ruby-node">"#{ @basename }.snapshot"</span>
|
1109
|
+
824: <span class="ruby-identifier">debug</span>{ <span class="ruby-node">"snapshot <#{ @path }> -> <#{ qtmp }>"</span> }
|
1110
|
+
825: <span class="ruby-identifier">retries</span> = <span class="ruby-constant">Integer</span>(<span class="ruby-identifier">retries</span> <span class="ruby-operator">||</span> <span class="ruby-value">16</span>)
|
1111
|
+
826: <span class="ruby-identifier">debug</span>{ <span class="ruby-node">"retries <#{ retries }>"</span> }
|
1112
|
+
827:
|
1113
|
+
828: <span class="ruby-identifier">qss</span> = <span class="ruby-keyword kw">nil</span>
|
1114
|
+
829: <span class="ruby-identifier">loopno</span> = <span class="ruby-value">0</span>
|
1115
|
+
830:
|
1116
|
+
831: <span class="ruby-identifier">take_snapshot</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span>
|
1117
|
+
832: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">qtmp</span>
|
1118
|
+
833: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">mkdir_p</span> <span class="ruby-identifier">qtmp</span>
|
1119
|
+
834: <span class="ruby-node">%(db db.schema lock)</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">base</span><span class="ruby-operator">|</span>
|
1120
|
+
835: <span class="ruby-identifier">src</span>, <span class="ruby-identifier">dest</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span>(<span class="ruby-ivar">@path</span>, <span class="ruby-identifier">base</span>), <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span>(<span class="ruby-identifier">qtmp</span>, <span class="ruby-identifier">base</span>)
|
1121
|
+
836: <span class="ruby-identifier">debug</span>{ <span class="ruby-node">"cp <#{ src }> -> <#{ dest }>"</span> }
|
1122
|
+
837: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">cp</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">dest</span>)
|
1123
|
+
838: <span class="ruby-keyword kw">end</span>
|
1124
|
+
839: <span class="ruby-identifier">ss</span> = <span class="ruby-identifier">klass</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span> <span class="ruby-identifier">qtmp</span>, <span class="ruby-ivar">@opts</span>
|
1125
|
+
840: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ss</span>.<span class="ruby-identifier">integrity_check</span>
|
1126
|
+
841: <span class="ruby-identifier">ss</span>
|
1127
|
+
842: <span class="ruby-keyword kw">else</span>
|
1128
|
+
843: <span class="ruby-keyword kw">begin</span>; <span class="ruby-identifier">recover!</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">integrity_check</span>; <span class="ruby-keyword kw">rescue</span>; <span class="ruby-keyword kw">nil</span>; <span class="ruby-keyword kw">end</span>
|
1129
|
+
844: <span class="ruby-identifier">ss</span>.<span class="ruby-identifier">recover!</span>
|
1130
|
+
845: <span class="ruby-keyword kw">end</span>
|
1131
|
+
846: <span class="ruby-keyword kw">end</span>
|
1132
|
+
847:
|
1133
|
+
848: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
1134
|
+
849: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">loopno</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">retries</span>
|
1135
|
+
850: <span class="ruby-keyword kw">if</span>((<span class="ruby-identifier">ss</span> = <span class="ruby-identifier">take_snapshot</span>.<span class="ruby-identifier">call</span>))
|
1136
|
+
851: <span class="ruby-identifier">debug</span>{ <span class="ruby-node">"snapshot <#{ qtmp }> created"</span> }
|
1137
|
+
852: <span class="ruby-identifier">qss</span> = <span class="ruby-identifier">ss</span>
|
1138
|
+
853: <span class="ruby-keyword kw">break</span>
|
1139
|
+
854: <span class="ruby-keyword kw">else</span>
|
1140
|
+
855: <span class="ruby-identifier">debug</span>{ <span class="ruby-node">"failure <#{ loopno + 1}> of <#{ retries }> attempts to create snapshot <#{ qtmp }> - retrying..."</span> }
|
1141
|
+
856: <span class="ruby-keyword kw">end</span>
|
1142
|
+
857: <span class="ruby-identifier">loopno</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
1143
|
+
858: <span class="ruby-keyword kw">end</span>
|
1144
|
+
859:
|
1145
|
+
860: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">qss</span>
|
1146
|
+
861: <span class="ruby-identifier">debug</span>{ <span class="ruby-node">"locking <#{ @path }> as last resort"</span> }
|
1147
|
+
862: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">write_lock</span> <span class="ruby-keyword kw">do</span>
|
1148
|
+
863: <span class="ruby-keyword kw">if</span>((<span class="ruby-identifier">ss</span> = <span class="ruby-identifier">take_snapshot</span>.<span class="ruby-identifier">call</span>))
|
1149
|
+
864: <span class="ruby-identifier">debug</span>{ <span class="ruby-node">"snapshot <#{ qtmp }> created"</span> }
|
1150
|
+
865: <span class="ruby-identifier">qss</span> = <span class="ruby-identifier">ss</span>
|
1151
|
+
866: <span class="ruby-keyword kw">else</span>
|
1152
|
+
867: <span class="ruby-identifier">raise</span> <span class="ruby-node">"failed <#{ loopno }> times to create snapshot <#{ qtmp }>"</span>
|
1153
|
+
868: <span class="ruby-keyword kw">end</span>
|
1154
|
+
869: <span class="ruby-keyword kw">end</span>
|
1155
|
+
870: <span class="ruby-keyword kw">end</span>
|
1156
|
+
871:
|
1157
|
+
872: <span class="ruby-identifier">qss</span>
|
1158
|
+
873: <span class="ruby-comment cmt">#--}}}</span>
|
1159
|
+
874: <span class="ruby-keyword kw">end</span>
|
1160
|
+
</pre>
|
1161
|
+
</div>
|
1162
|
+
</div>
|
1163
|
+
</div>
|
1164
|
+
|
1165
|
+
<div id="method-M000269" class="method-detail">
|
1166
|
+
<a name="M000269"></a>
|
1167
|
+
|
1168
|
+
<div class="method-heading">
|
1169
|
+
<a href="#M000269" class="method-signature">
|
1170
|
+
<span class="method-name">standard_err_4</span><span class="method-args">jid</span>
|
1171
|
+
</a>
|
1172
|
+
</div>
|
1173
|
+
|
1174
|
+
<div class="method-description">
|
1175
|
+
<p><a class="source-toggle" href="#"
|
1176
|
+
onclick="toggleCode('M000269-source');return false;">[Source]</a></p>
|
1177
|
+
<div class="method-source-code" id="M000269-source">
|
1178
|
+
<pre>
|
1179
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 98</span>
|
1180
|
+
98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">standard_err_4</span> <span class="ruby-identifier">jid</span>
|
1181
|
+
99: <span class="ruby-comment cmt">#--{{{</span>
|
1182
|
+
100: <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">stderr4</span>(<span class="ruby-identifier">jid</span>)))
|
1183
|
+
101: <span class="ruby-comment cmt">#--}}}</span>
|
1184
|
+
102: <span class="ruby-keyword kw">end</span>
|
1185
|
+
</pre>
|
1186
|
+
</div>
|
1187
|
+
</div>
|
1188
|
+
</div>
|
1189
|
+
|
1190
|
+
<div id="method-M000265" class="method-detail">
|
1191
|
+
<a name="M000265"></a>
|
1192
|
+
|
1193
|
+
<div class="method-heading">
|
1194
|
+
<a href="#M000265" class="method-signature">
|
1195
|
+
<span class="method-name">standard_in_4</span><span class="method-args">jid</span>
|
1196
|
+
</a>
|
1197
|
+
</div>
|
1198
|
+
|
1199
|
+
<div class="method-description">
|
1200
|
+
<p><a class="source-toggle" href="#"
|
1201
|
+
onclick="toggleCode('M000265-source');return false;">[Source]</a></p>
|
1202
|
+
<div class="method-source-code" id="M000265-source">
|
1203
|
+
<pre>
|
1204
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 78</span>
|
1205
|
+
78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">standard_in_4</span> <span class="ruby-identifier">jid</span>
|
1206
|
+
79: <span class="ruby-comment cmt">#--{{{</span>
|
1207
|
+
80: <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">stdin4</span>(<span class="ruby-identifier">jid</span>)))
|
1208
|
+
81: <span class="ruby-comment cmt">#--}}}</span>
|
1209
|
+
82: <span class="ruby-keyword kw">end</span>
|
1210
|
+
</pre>
|
1211
|
+
</div>
|
1212
|
+
</div>
|
1213
|
+
</div>
|
1214
|
+
|
1215
|
+
<div id="method-M000267" class="method-detail">
|
1216
|
+
<a name="M000267"></a>
|
1217
|
+
|
1218
|
+
<div class="method-heading">
|
1219
|
+
<a href="#M000267" class="method-signature">
|
1220
|
+
<span class="method-name">standard_out_4</span><span class="method-args">jid</span>
|
1221
|
+
</a>
|
1222
|
+
</div>
|
1223
|
+
|
1224
|
+
<div class="method-description">
|
1225
|
+
<p><a class="source-toggle" href="#"
|
1226
|
+
onclick="toggleCode('M000267-source');return false;">[Source]</a></p>
|
1227
|
+
<div class="method-source-code" id="M000267-source">
|
1228
|
+
<pre>
|
1229
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 88</span>
|
1230
|
+
88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">standard_out_4</span> <span class="ruby-identifier">jid</span>
|
1231
|
+
89: <span class="ruby-comment cmt">#--{{{</span>
|
1232
|
+
90: <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">stdout4</span>(<span class="ruby-identifier">jid</span>)))
|
1233
|
+
91: <span class="ruby-comment cmt">#--}}}</span>
|
1234
|
+
92: <span class="ruby-keyword kw">end</span>
|
1235
|
+
</pre>
|
1236
|
+
</div>
|
1237
|
+
</div>
|
1238
|
+
</div>
|
1239
|
+
|
1240
|
+
<div id="method-M000274" class="method-detail">
|
1241
|
+
<a name="M000274"></a>
|
1242
|
+
|
1243
|
+
<div class="method-heading">
|
1244
|
+
<a href="#M000274" class="method-signature">
|
1245
|
+
<span class="method-name">status</span><span class="method-args">options = {}</span>
|
1246
|
+
</a>
|
1247
|
+
</div>
|
1248
|
+
|
1249
|
+
<div class="method-description">
|
1250
|
+
<p><a class="source-toggle" href="#"
|
1251
|
+
onclick="toggleCode('M000274-source');return false;">[Source]</a></p>
|
1252
|
+
<div class="method-source-code" id="M000274-source">
|
1253
|
+
<pre>
|
1254
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 302</span>
|
1255
|
+
302: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span> <span class="ruby-identifier">options</span> = {}
|
1256
|
+
303: <span class="ruby-comment cmt">#--{{{</span>
|
1257
|
+
304: <span class="ruby-identifier">stats</span> = <span class="ruby-constant">OrderedAutoHash</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>
|
1258
|
+
305:
|
1259
|
+
306: <span class="ruby-identifier">now</span> = <span class="ruby-constant">Time</span><span class="ruby-operator">::</span><span class="ruby-identifier">now</span>
|
1260
|
+
307:
|
1261
|
+
308: <span class="ruby-identifier">hms</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
|
1262
|
+
309: <span class="ruby-identifier">elapsed</span> =
|
1263
|
+
310: <span class="ruby-keyword kw">begin</span>
|
1264
|
+
311: <span class="ruby-constant">Float</span> <span class="ruby-identifier">t</span>
|
1265
|
+
312: <span class="ruby-keyword kw">rescue</span>
|
1266
|
+
313: <span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-identifier">stamptime</span>(<span class="ruby-identifier">t</span>, <span class="ruby-value str">'local'</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>)
|
1267
|
+
314: <span class="ruby-keyword kw">end</span>
|
1268
|
+
315: <span class="ruby-identifier">sh</span>, <span class="ruby-identifier">sm</span>, <span class="ruby-identifier">ss</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-identifier">hms</span> <span class="ruby-identifier">elapsed</span>.<span class="ruby-identifier">to_f</span>
|
1269
|
+
316: <span class="ruby-identifier">s</span> = <span class="ruby-node">"#{ '%2.2d' % sh }h#{ '%2.2d' % sm }m#{ '%05.2f' % ss }s"</span>
|
1270
|
+
317: <span class="ruby-keyword kw">end</span>
|
1271
|
+
318:
|
1272
|
+
319: <span class="ruby-identifier">exit_code_map</span> =
|
1273
|
+
320: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:exit_code_map</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'exit_code_map'</span>] <span class="ruby-operator">||</span> {}
|
1274
|
+
321:
|
1275
|
+
322: <span class="ruby-identifier">ro_transaction</span> <span class="ruby-keyword kw">do</span>
|
1276
|
+
323: <span class="ruby-comment cmt">#</span>
|
1277
|
+
324: <span class="ruby-comment cmt"># jobs stats</span>
|
1278
|
+
325: <span class="ruby-comment cmt">#</span>
|
1279
|
+
326: <span class="ruby-identifier">total</span> = <span class="ruby-value">0</span>
|
1280
|
+
327: <span class="ruby-node">%( pending holding running finished dead )</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">state</span><span class="ruby-operator">|</span>
|
1281
|
+
328: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select count(*) from jobs\nwhere\nstate='\#{ state }'\n"</span>
|
1282
|
+
329: <span class="ruby-identifier">tuples</span> = <span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
1283
|
+
330: <span class="ruby-identifier">tuple</span> = <span class="ruby-identifier">tuples</span>.<span class="ruby-identifier">first</span>
|
1284
|
+
331: <span class="ruby-identifier">count</span> = (<span class="ruby-identifier">tuple</span> <span class="ruby-value">? </span><span class="ruby-constant">Integer</span>(<span class="ruby-identifier">tuple</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)
|
1285
|
+
332: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'jobs'</span>][<span class="ruby-identifier">state</span>] = <span class="ruby-identifier">count</span>
|
1286
|
+
333: <span class="ruby-identifier">total</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">count</span>
|
1287
|
+
334: <span class="ruby-keyword kw">end</span>
|
1288
|
+
335: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'jobs'</span>][<span class="ruby-value str">'total'</span>] = <span class="ruby-identifier">total</span>
|
1289
|
+
336: <span class="ruby-comment cmt">#</span>
|
1290
|
+
337: <span class="ruby-comment cmt"># temporal stats </span>
|
1291
|
+
338: <span class="ruby-comment cmt">#</span>
|
1292
|
+
339: <span class="ruby-identifier">metrics</span> = <span class="ruby-constant">OrderedAutoHash</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>
|
1293
|
+
340: <span class="ruby-identifier">metrics</span>[<span class="ruby-value str">'pending'</span>] = <span class="ruby-value str">'submitted'</span>
|
1294
|
+
341: <span class="ruby-identifier">metrics</span>[<span class="ruby-value str">'holding'</span>] = <span class="ruby-value str">'submitted'</span>
|
1295
|
+
342: <span class="ruby-identifier">metrics</span>[<span class="ruby-value str">'running'</span>] = <span class="ruby-value str">'started'</span>
|
1296
|
+
343: <span class="ruby-identifier">metrics</span>[<span class="ruby-value str">'finished'</span>] = <span class="ruby-value str">'elapsed'</span>
|
1297
|
+
344: <span class="ruby-identifier">metrics</span>[<span class="ruby-value str">'dead'</span>] = <span class="ruby-value str">'elapsed'</span>
|
1298
|
+
345:
|
1299
|
+
346: <span class="ruby-identifier">metrics</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">state</span>, <span class="ruby-identifier">metric</span><span class="ruby-operator">|</span>
|
1300
|
+
347: <span class="ruby-identifier">sql</span> =
|
1301
|
+
348: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">metric</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'elapsed'</span>
|
1302
|
+
349: <span class="ruby-value str">"select min(\#{ metric }) as max, max(\#{ metric }) as min\nfrom jobs where state='\#{ state }'\n"</span>
|
1303
|
+
350: <span class="ruby-keyword kw">else</span>
|
1304
|
+
351: <span class="ruby-value str">"select min(\#{ metric }) as min, max(\#{ metric }) as max\nfrom jobs where state='\#{ state }'\n"</span>
|
1305
|
+
352: <span class="ruby-keyword kw">end</span>
|
1306
|
+
353: <span class="ruby-identifier">tuple</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>).<span class="ruby-identifier">first</span>
|
1307
|
+
354: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">tuple</span>
|
1308
|
+
355:
|
1309
|
+
356: <span class="ruby-node">%( min max )</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">time</span><span class="ruby-operator">|</span>
|
1310
|
+
357: <span class="ruby-identifier">oh</span> = <span class="ruby-keyword kw">nil</span>
|
1311
|
+
358: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">tuple</span>[<span class="ruby-identifier">time</span>]
|
1312
|
+
359: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span>
|
1313
|
+
360: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select jid from jobs where \#{ metric }='\#{ t }' and state='\#{ state }'\n"</span>
|
1314
|
+
361: <span class="ruby-identifier">which</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>).<span class="ruby-identifier">first</span>
|
1315
|
+
362: <span class="ruby-identifier">jid</span> = (<span class="ruby-identifier">which</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">which</span>[<span class="ruby-value str">'jid'</span>]).<span class="ruby-identifier">to_i</span>
|
1316
|
+
363: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jid</span>
|
1317
|
+
364: <span class="ruby-identifier">oh</span> = <span class="ruby-constant">OrderedAutoHash</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>
|
1318
|
+
365: <span class="ruby-identifier">oh</span>[<span class="ruby-identifier">jid</span>] = <span class="ruby-identifier">hms</span>[<span class="ruby-identifier">t</span>]
|
1319
|
+
366: <span class="ruby-identifier">oh</span>.<span class="ruby-identifier">yaml_inline</span> = <span class="ruby-keyword kw">true</span>
|
1320
|
+
367: <span class="ruby-keyword kw">end</span>
|
1321
|
+
368: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'temporal'</span>][<span class="ruby-identifier">state</span>][<span class="ruby-identifier">time</span>] = <span class="ruby-identifier">oh</span>
|
1322
|
+
369: <span class="ruby-keyword kw">end</span>
|
1323
|
+
370: <span class="ruby-keyword kw">end</span>
|
1324
|
+
371: <span class="ruby-comment cmt">#stats['temporal'][state] ||= nil</span>
|
1325
|
+
372: <span class="ruby-keyword kw">end</span>
|
1326
|
+
373: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'temporal'</span>] <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">nil</span>
|
1327
|
+
374: <span class="ruby-comment cmt">#</span>
|
1328
|
+
375: <span class="ruby-comment cmt"># generate performance stats</span>
|
1329
|
+
376: <span class="ruby-comment cmt">#</span>
|
1330
|
+
377: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select avg(elapsed) from jobs\nwhere\nstate='finished'\n"</span>
|
1331
|
+
378: <span class="ruby-identifier">tuples</span> = <span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
1332
|
+
379: <span class="ruby-identifier">tuple</span> = <span class="ruby-identifier">tuples</span>.<span class="ruby-identifier">first</span>
|
1333
|
+
380: <span class="ruby-identifier">avg</span> = (<span class="ruby-identifier">tuple</span> <span class="ruby-value">? </span><span class="ruby-constant">Float</span>(<span class="ruby-identifier">tuple</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)
|
1334
|
+
381: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'performance'</span>][<span class="ruby-value str">'avg_time_per_job'</span>] = <span class="ruby-identifier">hms</span>[<span class="ruby-identifier">avg</span>]
|
1335
|
+
382:
|
1336
|
+
383: <span class="ruby-identifier">list</span> = []
|
1337
|
+
384: <span class="ruby-value">0</span>.<span class="ruby-identifier">step</span>(<span class="ruby-value">5</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">list</span> <span class="ruby-operator"><<</span> (<span class="ruby-value">2</span> <span class="ruby-operator">**</span> <span class="ruby-identifier">i</span>)}
|
1338
|
+
385: <span class="ruby-identifier">list</span> <span class="ruby-operator"><<</span> <span class="ruby-value">24</span>
|
1339
|
+
386: <span class="ruby-identifier">list</span>.<span class="ruby-identifier">sort!</span>
|
1340
|
+
387:
|
1341
|
+
388: <span class="ruby-identifier">list</span> = <span class="ruby-value">1</span>, <span class="ruby-value">12</span>, <span class="ruby-value">24</span>
|
1342
|
+
389:
|
1343
|
+
390: <span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
|
1344
|
+
391: <span class="ruby-identifier">ago</span> = <span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">n</span> <span class="ruby-operator">*</span> <span class="ruby-value">3600</span>)
|
1345
|
+
392: <span class="ruby-identifier">ago</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-identifier">timestamp</span> <span class="ruby-identifier">ago</span>
|
1346
|
+
393: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select count(*) from jobs\nwhere\nstate = 'finished' and\nfinished > '\#{ ago }'\n"</span>
|
1347
|
+
394: <span class="ruby-identifier">tuples</span> = <span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
1348
|
+
395: <span class="ruby-identifier">tuple</span> = <span class="ruby-identifier">tuples</span>.<span class="ruby-identifier">first</span>
|
1349
|
+
396: <span class="ruby-identifier">count</span> = (<span class="ruby-identifier">tuple</span> <span class="ruby-value">? </span><span class="ruby-constant">Integer</span>(<span class="ruby-identifier">tuple</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)
|
1350
|
+
397: <span class="ruby-comment cmt">#stats['performance']["n_jobs_in_last_#{ n }_hrs"] = count</span>
|
1351
|
+
398: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'performance'</span>][<span class="ruby-value str">"n_jobs_in_last_hrs"</span>][<span class="ruby-identifier">n</span>] = <span class="ruby-identifier">count</span>
|
1352
|
+
399: <span class="ruby-keyword kw">end</span>
|
1353
|
+
400:
|
1354
|
+
401: <span class="ruby-comment cmt">#</span>
|
1355
|
+
402: <span class="ruby-comment cmt"># generate exit_status stats</span>
|
1356
|
+
403: <span class="ruby-comment cmt">#</span>
|
1357
|
+
404: <span class="ruby-comment cmt">#stats['exit_status'] = {}</span>
|
1358
|
+
405: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select count(*) from jobs\nwhere\nstate='finished' and\nexit_status=0\n"</span>
|
1359
|
+
406: <span class="ruby-identifier">tuples</span> = <span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
1360
|
+
407: <span class="ruby-identifier">tuple</span> = <span class="ruby-identifier">tuples</span>.<span class="ruby-identifier">first</span>
|
1361
|
+
408: <span class="ruby-identifier">successes</span> = (<span class="ruby-identifier">tuple</span> <span class="ruby-value">? </span><span class="ruby-constant">Integer</span>(<span class="ruby-identifier">tuple</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)
|
1362
|
+
409: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'exit_status'</span>][<span class="ruby-value str">'successes'</span>] = <span class="ruby-identifier">successes</span>
|
1363
|
+
410:
|
1364
|
+
411: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select count(*) from jobs\nwhere\n(state='finished' and\nexit_status!=0) or\nstate='dead'\n"</span>
|
1365
|
+
412: <span class="ruby-identifier">tuples</span> = <span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
1366
|
+
413: <span class="ruby-identifier">tuple</span> = <span class="ruby-identifier">tuples</span>.<span class="ruby-identifier">first</span>
|
1367
|
+
414: <span class="ruby-identifier">failures</span> = (<span class="ruby-identifier">tuple</span> <span class="ruby-value">? </span><span class="ruby-constant">Integer</span>(<span class="ruby-identifier">tuple</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)
|
1368
|
+
415: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'exit_status'</span>][<span class="ruby-value str">'failures'</span>] = <span class="ruby-identifier">failures</span>
|
1369
|
+
416:
|
1370
|
+
417: <span class="ruby-identifier">exit_code_map</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">which</span>, <span class="ruby-identifier">codes</span><span class="ruby-operator">|</span>
|
1371
|
+
418: <span class="ruby-identifier">exit_status_clause</span> = <span class="ruby-identifier">codes</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">code</span><span class="ruby-operator">|</span> <span class="ruby-node">"exit_status=#{ code }"</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' or '</span>)
|
1372
|
+
419: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select count(*) from jobs\nwhere\n(state='finished' and (\#{ exit_status_clause }))\n"</span>
|
1373
|
+
420: <span class="ruby-identifier">tuples</span> = <span class="ruby-identifier">execute</span> <span class="ruby-identifier">sql</span>
|
1374
|
+
421: <span class="ruby-identifier">tuple</span> = <span class="ruby-identifier">tuples</span>.<span class="ruby-identifier">first</span>
|
1375
|
+
422: <span class="ruby-identifier">n</span> = (<span class="ruby-identifier">tuple</span> <span class="ruby-value">? </span><span class="ruby-constant">Integer</span>(<span class="ruby-identifier">tuple</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)
|
1376
|
+
423: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'exit_status'</span>][<span class="ruby-identifier">which</span>] = <span class="ruby-identifier">n</span>
|
1377
|
+
424: <span class="ruby-keyword kw">end</span>
|
1378
|
+
425: <span class="ruby-keyword kw">end</span>
|
1379
|
+
426:
|
1380
|
+
427: <span class="ruby-identifier">stats</span>
|
1381
|
+
428: <span class="ruby-comment cmt">#--}}}</span>
|
1382
|
+
429: <span class="ruby-keyword kw">end</span>
|
1383
|
+
</pre>
|
1384
|
+
</div>
|
1385
|
+
</div>
|
1386
|
+
</div>
|
1387
|
+
|
1388
|
+
<div id="method-M000268" class="method-detail">
|
1389
|
+
<a name="M000268"></a>
|
1390
|
+
|
1391
|
+
<div class="method-heading">
|
1392
|
+
<a href="#M000268" class="method-signature">
|
1393
|
+
<span class="method-name">stderr4</span><span class="method-args">jid</span>
|
1394
|
+
</a>
|
1395
|
+
</div>
|
1396
|
+
|
1397
|
+
<div class="method-description">
|
1398
|
+
<p><a class="source-toggle" href="#"
|
1399
|
+
onclick="toggleCode('M000268-source');return false;">[Source]</a></p>
|
1400
|
+
<div class="method-source-code" id="M000268-source">
|
1401
|
+
<pre>
|
1402
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 93</span>
|
1403
|
+
93: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stderr4</span> <span class="ruby-identifier">jid</span>
|
1404
|
+
94: <span class="ruby-comment cmt">#--{{{</span>
|
1405
|
+
95: <span class="ruby-node">"stderr/#{ jid }"</span>
|
1406
|
+
96: <span class="ruby-comment cmt">#--}}}</span>
|
1407
|
+
97: <span class="ruby-keyword kw">end</span>
|
1408
|
+
</pre>
|
1409
|
+
</div>
|
1410
|
+
</div>
|
1411
|
+
</div>
|
1412
|
+
|
1413
|
+
<div id="method-M000264" class="method-detail">
|
1414
|
+
<a name="M000264"></a>
|
1415
|
+
|
1416
|
+
<div class="method-heading">
|
1417
|
+
<a href="#M000264" class="method-signature">
|
1418
|
+
<span class="method-name">stdin4</span><span class="method-args">jid</span>
|
1419
|
+
</a>
|
1420
|
+
</div>
|
1421
|
+
|
1422
|
+
<div class="method-description">
|
1423
|
+
<p><a class="source-toggle" href="#"
|
1424
|
+
onclick="toggleCode('M000264-source');return false;">[Source]</a></p>
|
1425
|
+
<div class="method-source-code" id="M000264-source">
|
1426
|
+
<pre>
|
1427
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 73</span>
|
1428
|
+
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdin4</span> <span class="ruby-identifier">jid</span>
|
1429
|
+
74: <span class="ruby-comment cmt">#--{{{</span>
|
1430
|
+
75: <span class="ruby-node">"stdin/#{ jid }"</span>
|
1431
|
+
76: <span class="ruby-comment cmt">#--}}}</span>
|
1432
|
+
77: <span class="ruby-keyword kw">end</span>
|
1433
|
+
</pre>
|
1434
|
+
</div>
|
1435
|
+
</div>
|
1436
|
+
</div>
|
1437
|
+
|
1438
|
+
<div id="method-M000266" class="method-detail">
|
1439
|
+
<a name="M000266"></a>
|
1440
|
+
|
1441
|
+
<div class="method-heading">
|
1442
|
+
<a href="#M000266" class="method-signature">
|
1443
|
+
<span class="method-name">stdout4</span><span class="method-args">jid</span>
|
1444
|
+
</a>
|
1445
|
+
</div>
|
1446
|
+
|
1447
|
+
<div class="method-description">
|
1448
|
+
<p><a class="source-toggle" href="#"
|
1449
|
+
onclick="toggleCode('M000266-source');return false;">[Source]</a></p>
|
1450
|
+
<div class="method-source-code" id="M000266-source">
|
1451
|
+
<pre>
|
1452
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 83</span>
|
1453
|
+
83: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdout4</span> <span class="ruby-identifier">jid</span>
|
1454
|
+
84: <span class="ruby-comment cmt">#--{{{</span>
|
1455
|
+
85: <span class="ruby-node">"stdout/#{ jid }"</span>
|
1456
|
+
86: <span class="ruby-comment cmt">#--}}}</span>
|
1457
|
+
87: <span class="ruby-keyword kw">end</span>
|
1458
|
+
</pre>
|
1459
|
+
</div>
|
1460
|
+
</div>
|
1461
|
+
</div>
|
1462
|
+
|
1463
|
+
<div id="method-M000270" class="method-detail">
|
1464
|
+
<a name="M000270"></a>
|
1465
|
+
|
1466
|
+
<div class="method-heading">
|
1467
|
+
<a href="#M000270" class="method-signature">
|
1468
|
+
<span class="method-name">submit</span><span class="method-args">(*jobs, &block)</span>
|
1469
|
+
</a>
|
1470
|
+
</div>
|
1471
|
+
|
1472
|
+
<div class="method-description">
|
1473
|
+
<p><a class="source-toggle" href="#"
|
1474
|
+
onclick="toggleCode('M000270-source');return false;">[Source]</a></p>
|
1475
|
+
<div class="method-source-code" id="M000270-source">
|
1476
|
+
<pre>
|
1477
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 103</span>
|
1478
|
+
103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">jobs</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1479
|
+
104: <span class="ruby-comment cmt">#--{{{</span>
|
1480
|
+
105: <span class="ruby-identifier">now</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-identifier">timestamp</span> <span class="ruby-constant">Time</span><span class="ruby-operator">::</span><span class="ruby-identifier">now</span>
|
1481
|
+
106:
|
1482
|
+
107: <span class="ruby-identifier">transaction</span> <span class="ruby-keyword kw">do</span>
|
1483
|
+
108: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"select max(jid) from jobs"</span>
|
1484
|
+
109: <span class="ruby-identifier">tuple</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>).<span class="ruby-identifier">first</span>
|
1485
|
+
110: <span class="ruby-identifier">jid</span> = <span class="ruby-identifier">tuple</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
1486
|
+
111: <span class="ruby-identifier">jid</span> = <span class="ruby-constant">Integer</span>(<span class="ruby-identifier">jid</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
1487
|
+
112:
|
1488
|
+
113: <span class="ruby-identifier">jobs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">job</span><span class="ruby-operator">|</span>
|
1489
|
+
114: <span class="ruby-identifier">command</span> = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'command'</span>]
|
1490
|
+
115: <span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'stdin'</span>]
|
1491
|
+
116:
|
1492
|
+
117: <span class="ruby-identifier">raise</span> <span class="ruby-node">"no command for job <#{ job.inspect }>"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">command</span>
|
1493
|
+
118:
|
1494
|
+
119: <span class="ruby-identifier">tmp_stdin</span>(<span class="ruby-identifier">stdin</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ts</span><span class="ruby-operator">|</span>
|
1495
|
+
120: <span class="ruby-identifier">tuple</span> = <span class="ruby-constant">QDB</span><span class="ruby-operator">::</span><span class="ruby-identifier">tuple</span>
|
1496
|
+
121:
|
1497
|
+
122: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'command'</span>] = <span class="ruby-identifier">command</span>
|
1498
|
+
123: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'priority'</span>] = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'priority'</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
1499
|
+
124: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'tag'</span>] = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'tag'</span>]
|
1500
|
+
125: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'runner'</span>] = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'runner'</span>]
|
1501
|
+
126: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'restartable'</span>] = <span class="ruby-identifier">job</span>[<span class="ruby-value str">'restartable'</span>]
|
1502
|
+
127: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'state'</span>] = <span class="ruby-value str">'pending'</span>
|
1503
|
+
128: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'submitted'</span>] = <span class="ruby-identifier">now</span>
|
1504
|
+
129: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'submitter'</span>] = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-identifier">hostname</span>
|
1505
|
+
130: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'stdin'</span>] = <span class="ruby-identifier">stdin4</span> <span class="ruby-identifier">jid</span>
|
1506
|
+
131: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'stdout'</span>] = <span class="ruby-keyword kw">nil</span>
|
1507
|
+
132: <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'stderr'</span>] = <span class="ruby-keyword kw">nil</span>
|
1508
|
+
133:
|
1509
|
+
134: <span class="ruby-identifier">values</span> = <span class="ruby-constant">QDB</span><span class="ruby-operator">::</span><span class="ruby-identifier">q</span> <span class="ruby-identifier">tuple</span>
|
1510
|
+
135:
|
1511
|
+
136: <span class="ruby-identifier">sql</span> = <span class="ruby-node">"insert into jobs values (#{ values.join ',' });\n"</span>
|
1512
|
+
137: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>){}
|
1513
|
+
138:
|
1514
|
+
139: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">standard_in_4</span>(<span class="ruby-identifier">jid</span>)
|
1515
|
+
140: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">standard_out_4</span>(<span class="ruby-identifier">jid</span>)
|
1516
|
+
141: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">standard_err_4</span>(<span class="ruby-identifier">jid</span>)
|
1517
|
+
142: <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">cp</span> <span class="ruby-identifier">ts</span>.<span class="ruby-identifier">path</span>, <span class="ruby-identifier">standard_in_4</span>(<span class="ruby-identifier">jid</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ts</span>
|
1518
|
+
143:
|
1519
|
+
144: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
|
1520
|
+
145: <span class="ruby-identifier">sql</span> = <span class="ruby-node">"select * from jobs where jid = '#{ jid }'"</span>
|
1521
|
+
146: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1522
|
+
147: <span class="ruby-keyword kw">end</span>
|
1523
|
+
148: <span class="ruby-keyword kw">end</span>
|
1524
|
+
149:
|
1525
|
+
150: <span class="ruby-identifier">jid</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
1526
|
+
151: <span class="ruby-keyword kw">end</span>
|
1527
|
+
152: <span class="ruby-keyword kw">end</span>
|
1528
|
+
153:
|
1529
|
+
154: <span class="ruby-keyword kw">self</span>
|
1530
|
+
155: <span class="ruby-comment cmt">#--}}}</span>
|
1531
|
+
156: <span class="ruby-keyword kw">end</span>
|
1532
|
+
</pre>
|
1533
|
+
</div>
|
1534
|
+
</div>
|
1535
|
+
</div>
|
1536
|
+
|
1537
|
+
<div id="method-M000272" class="method-detail">
|
1538
|
+
<a name="M000272"></a>
|
1539
|
+
|
1540
|
+
<div class="method-heading">
|
1541
|
+
<a href="#M000272" class="method-signature">
|
1542
|
+
<span class="method-name">tmp_stdin</span><span class="method-args">stdin = nil</span>
|
1543
|
+
</a>
|
1544
|
+
</div>
|
1545
|
+
|
1546
|
+
<div class="method-description">
|
1547
|
+
<p><a class="source-toggle" href="#"
|
1548
|
+
onclick="toggleCode('M000272-source');return false;">[Source]</a></p>
|
1549
|
+
<div class="method-source-code" id="M000272-source">
|
1550
|
+
<pre>
|
1551
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 207</span>
|
1552
|
+
207: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tmp_stdin</span> <span class="ruby-identifier">stdin</span> = <span class="ruby-keyword kw">nil</span>
|
1553
|
+
208: <span class="ruby-comment cmt">#--{{{</span>
|
1554
|
+
209: <span class="ruby-identifier">stdin</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stdin</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">empty?</span>
|
1555
|
+
210: <span class="ruby-identifier">stdin</span> = <span class="ruby-constant">STDIN</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stdin</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'-'</span>
|
1556
|
+
211:
|
1557
|
+
212: <span class="ruby-identifier">was_opened</span> = <span class="ruby-keyword kw">false</span>
|
1558
|
+
213:
|
1559
|
+
214: <span class="ruby-keyword kw">begin</span>
|
1560
|
+
215: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">stdin</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">'read'</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">stdin</span>.<span class="ruby-identifier">nil?</span>
|
1561
|
+
216: <span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">stdin</span>.<span class="ruby-identifier">to_s</span>
|
1562
|
+
217: <span class="ruby-comment cmt"># relative to queue</span>
|
1563
|
+
218: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stdin</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%|^@?stdin/\d+$|</span>
|
1564
|
+
219: <span class="ruby-identifier">stdin</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">%|^@|</span>, <span class="ruby-value str">''</span>
|
1565
|
+
220: <span class="ruby-identifier">stdin</span> = <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">join</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">stdin</span>)
|
1566
|
+
221: <span class="ruby-keyword kw">end</span>
|
1567
|
+
222: <span class="ruby-identifier">stdin</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-identifier">stdin</span>
|
1568
|
+
223: <span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">open</span> <span class="ruby-identifier">stdin</span>
|
1569
|
+
224: <span class="ruby-identifier">was_opened</span> = <span class="ruby-keyword kw">true</span>
|
1570
|
+
225: <span class="ruby-keyword kw">end</span>
|
1571
|
+
226:
|
1572
|
+
227: <span class="ruby-identifier">tmp</span> = <span class="ruby-constant">Tempfile</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span> <span class="ruby-node">"#{ Process::pid }_#{ rand }"</span>
|
1573
|
+
228: <span class="ruby-keyword kw">while</span>((<span class="ruby-identifier">buf</span> = <span class="ruby-identifier">stdin</span>.<span class="ruby-identifier">read</span>(<span class="ruby-value">8192</span>))); <span class="ruby-identifier">tmp</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">buf</span>; <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stdin</span>
|
1574
|
+
229: <span class="ruby-identifier">tmp</span>.<span class="ruby-identifier">close</span>
|
1575
|
+
230:
|
1576
|
+
231: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
1577
|
+
232: <span class="ruby-keyword kw">begin</span>
|
1578
|
+
233: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">tmp</span>
|
1579
|
+
234: <span class="ruby-keyword kw">ensure</span>
|
1580
|
+
235: <span class="ruby-identifier">tmp</span>.<span class="ruby-identifier">close!</span>
|
1581
|
+
236: <span class="ruby-keyword kw">end</span>
|
1582
|
+
237: <span class="ruby-keyword kw">else</span>
|
1583
|
+
238: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tmp</span>
|
1584
|
+
239: <span class="ruby-keyword kw">end</span>
|
1585
|
+
240: <span class="ruby-keyword kw">ensure</span>
|
1586
|
+
241: <span class="ruby-identifier">stdin</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">was_opened</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
1587
|
+
242: <span class="ruby-keyword kw">end</span>
|
1588
|
+
243: <span class="ruby-comment cmt">#--}}}</span>
|
1589
|
+
244: <span class="ruby-keyword kw">end</span>
|
1590
|
+
</pre>
|
1591
|
+
</div>
|
1592
|
+
</div>
|
1593
|
+
</div>
|
1594
|
+
|
1595
|
+
<div id="method-M000284" class="method-detail">
|
1596
|
+
<a name="M000284"></a>
|
1597
|
+
|
1598
|
+
<div class="method-heading">
|
1599
|
+
<a href="#M000284" class="method-signature">
|
1600
|
+
<span class="method-name">transaction</span><span class="method-args">(*args) {|| ...}</span>
|
1601
|
+
</a>
|
1602
|
+
</div>
|
1603
|
+
|
1604
|
+
<div class="method-description">
|
1605
|
+
<p><a class="source-toggle" href="#"
|
1606
|
+
onclick="toggleCode('M000284-source');return false;">[Source]</a></p>
|
1607
|
+
<div class="method-source-code" id="M000284-source">
|
1608
|
+
<pre>
|
1609
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 757</span>
|
1610
|
+
757: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">transaction</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
1611
|
+
758: <span class="ruby-comment cmt">#--{{{</span>
|
1612
|
+
759: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"cannot upgrade ro_transaction"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@in_ro_transaction</span>
|
1613
|
+
760: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
1614
|
+
761: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@in_transaction</span>
|
1615
|
+
762: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">yield</span>
|
1616
|
+
763: <span class="ruby-keyword kw">else</span>
|
1617
|
+
764: <span class="ruby-keyword kw">begin</span>
|
1618
|
+
765: <span class="ruby-ivar">@in_transaction</span> = <span class="ruby-keyword kw">true</span>
|
1619
|
+
766: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">transaction</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>){ <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">yield</span> }
|
1620
|
+
767: <span class="ruby-keyword kw">ensure</span>
|
1621
|
+
768: <span class="ruby-ivar">@in_transaction</span> = <span class="ruby-keyword kw">false</span>
|
1622
|
+
769: <span class="ruby-keyword kw">end</span>
|
1623
|
+
770: <span class="ruby-keyword kw">end</span>
|
1624
|
+
771: <span class="ruby-identifier">ret</span>
|
1625
|
+
772: <span class="ruby-comment cmt">#--}}}</span>
|
1626
|
+
773: <span class="ruby-keyword kw">end</span>
|
1627
|
+
</pre>
|
1628
|
+
</div>
|
1629
|
+
</div>
|
1630
|
+
</div>
|
1631
|
+
|
1632
|
+
<div id="method-M000278" class="method-detail">
|
1633
|
+
<a name="M000278"></a>
|
1634
|
+
|
1635
|
+
<div class="method-heading">
|
1636
|
+
<a href="#M000278" class="method-signature">
|
1637
|
+
<span class="method-name">update</span><span class="method-args">(kvs, *jids, &block)</span>
|
1638
|
+
</a>
|
1639
|
+
</div>
|
1640
|
+
|
1641
|
+
<div class="method-description">
|
1642
|
+
<p><a class="source-toggle" href="#"
|
1643
|
+
onclick="toggleCode('M000278-source');return false;">[Source]</a></p>
|
1644
|
+
<div class="method-source-code" id="M000278-source">
|
1645
|
+
<pre>
|
1646
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 587</span>
|
1647
|
+
587: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">kvs</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">jids</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1648
|
+
588: <span class="ruby-comment cmt">#--{{{</span>
|
1649
|
+
589: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
1650
|
+
590: <span class="ruby-comment cmt">#</span>
|
1651
|
+
591: <span class="ruby-comment cmt"># yank out stdin - which we allow as a key</span>
|
1652
|
+
592: <span class="ruby-comment cmt">#</span>
|
1653
|
+
593: <span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">kvs</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">'stdin'</span>
|
1654
|
+
594: <span class="ruby-comment cmt">#</span>
|
1655
|
+
595: <span class="ruby-comment cmt"># validate/munge state value iff present</span>
|
1656
|
+
596: <span class="ruby-comment cmt">#</span>
|
1657
|
+
597: <span class="ruby-keyword kw">if</span>((<span class="ruby-identifier">state</span> = <span class="ruby-identifier">kvs</span>[<span class="ruby-value str">'state'</span>]))
|
1658
|
+
598: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">state</span>
|
1659
|
+
599: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^p/i</span><span class="ruby-identifier">o</span>
|
1660
|
+
600: <span class="ruby-identifier">kvs</span>[<span class="ruby-value str">'state'</span>] = <span class="ruby-value str">'pending'</span>
|
1661
|
+
601: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">%/^h/i</span><span class="ruby-identifier">o</span>
|
1662
|
+
602: <span class="ruby-identifier">kvs</span>[<span class="ruby-value str">'state'</span>] = <span class="ruby-value str">'holding'</span>
|
1663
|
+
603: <span class="ruby-keyword kw">else</span>
|
1664
|
+
604: <span class="ruby-identifier">raise</span> <span class="ruby-node">"update of <state> = <#{ state }> not allowed (try pending or holding)"</span>
|
1665
|
+
605: <span class="ruby-keyword kw">end</span>
|
1666
|
+
606: <span class="ruby-keyword kw">end</span>
|
1667
|
+
607: <span class="ruby-comment cmt">#</span>
|
1668
|
+
608: <span class="ruby-comment cmt"># validate kvs pairs</span>
|
1669
|
+
609: <span class="ruby-comment cmt">#</span>
|
1670
|
+
610: <span class="ruby-identifier">allowed</span> = <span class="ruby-node">%( priority command tag runner restartable )</span>
|
1671
|
+
611: <span class="ruby-identifier">kvs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
1672
|
+
612: <span class="ruby-identifier">raise</span> <span class="ruby-node">"update of <#{ key }> = <#{ val }> not allowed"</span> <span class="ruby-keyword kw">unless</span>
|
1673
|
+
613: (<span class="ruby-identifier">allowed</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">key</span>)) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'state'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-node">%( pending holding )</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">val</span>))
|
1674
|
+
614: <span class="ruby-keyword kw">end</span>
|
1675
|
+
615: <span class="ruby-comment cmt">#</span>
|
1676
|
+
616: <span class="ruby-comment cmt"># ensure there are acutally some jobs to update</span>
|
1677
|
+
617: <span class="ruby-comment cmt">#</span>
|
1678
|
+
618: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"no jobs to update"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jids</span>.<span class="ruby-identifier">empty?</span>
|
1679
|
+
619: <span class="ruby-comment cmt">#</span>
|
1680
|
+
620: <span class="ruby-comment cmt"># generates sql to update jids with kvs and sql to show updated tuples</span>
|
1681
|
+
621: <span class="ruby-comment cmt">#</span>
|
1682
|
+
622: <span class="ruby-identifier">build_sql</span> =
|
1683
|
+
623: <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kvs</span>, <span class="ruby-identifier">jids</span><span class="ruby-operator">|</span>
|
1684
|
+
624: <span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">jids</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'pending'</span>))
|
1685
|
+
625: <span class="ruby-identifier">execute</span>(<span class="ruby-value str">"select jid from jobs where state='pending'"</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tuple</span><span class="ruby-operator">|</span>
|
1686
|
+
626: <span class="ruby-identifier">jids</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'jid'</span>]
|
1687
|
+
627: <span class="ruby-keyword kw">end</span>
|
1688
|
+
628: <span class="ruby-keyword kw">end</span>
|
1689
|
+
629:
|
1690
|
+
630: <span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">jids</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'holding'</span>))
|
1691
|
+
631: <span class="ruby-identifier">execute</span>(<span class="ruby-value str">"select jid from jobs where state='holding'"</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tuple</span><span class="ruby-operator">|</span>
|
1692
|
+
632: <span class="ruby-identifier">jids</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tuple</span>[<span class="ruby-value str">'jid'</span>]
|
1693
|
+
633: <span class="ruby-keyword kw">end</span>
|
1694
|
+
634: <span class="ruby-keyword kw">end</span>
|
1695
|
+
635:
|
1696
|
+
636: <span class="ruby-identifier">rollback_transaction</span> <span class="ruby-value str">"no jobs to update"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">jids</span>.<span class="ruby-identifier">empty?</span>
|
1697
|
+
637:
|
1698
|
+
638: <span class="ruby-identifier">update_clause</span> = <span class="ruby-identifier">kvs</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span> <span class="ruby-value">? </span><span class="ruby-node">"#{ k }='#{ v }'"</span> <span class="ruby-operator">:</span> <span class="ruby-node">"#{ k }=NULL"</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">",\n"</span>)
|
1699
|
+
639: <span class="ruby-identifier">where_clause</span> = <span class="ruby-identifier">jids</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">jid</span><span class="ruby-operator">|</span> <span class="ruby-node">"jid=#{ jid }"</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-value str">" or\n"</span>)
|
1700
|
+
640: <span class="ruby-identifier">update_sql</span> =
|
1701
|
+
641: <span class="ruby-value str">"update jobs\n"</span> <span class="ruby-operator"><<</span>
|
1702
|
+
642: <span class="ruby-node">"set\n#{ update_clause }\n"</span> <span class="ruby-operator"><<</span>
|
1703
|
+
643: <span class="ruby-node">"where\n(state='pending' or state='holding') and\n(#{ where_clause })"</span>
|
1704
|
+
644: <span class="ruby-identifier">select_sql</span> = <span class="ruby-node">"select * from jobs where (state='pending' or state='holding') and\n(#{ where_clause })"</span>
|
1705
|
+
645:
|
1706
|
+
646: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">kvs</span>.<span class="ruby-identifier">empty?</span>
|
1707
|
+
647: [ <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">select_sql</span> ]
|
1708
|
+
648: <span class="ruby-keyword kw">else</span>
|
1709
|
+
649: [ <span class="ruby-identifier">update_sql</span>, <span class="ruby-identifier">select_sql</span> ]
|
1710
|
+
650: <span class="ruby-keyword kw">end</span>
|
1711
|
+
651: <span class="ruby-keyword kw">end</span>
|
1712
|
+
652: <span class="ruby-comment cmt">#</span>
|
1713
|
+
653: <span class="ruby-comment cmt"># setup stdin</span>
|
1714
|
+
654: <span class="ruby-comment cmt">#</span>
|
1715
|
+
655: <span class="ruby-identifier">tmp_stdin</span>(<span class="ruby-identifier">stdin</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ts</span><span class="ruby-operator">|</span>
|
1716
|
+
656: <span class="ruby-identifier">clobber_stdin</span> = <span class="ruby-identifier">lambda</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">job</span><span class="ruby-operator">|</span> <span class="ruby-constant">FileUtils</span><span class="ruby-operator">::</span><span class="ruby-identifier">cp</span> <span class="ruby-identifier">ts</span>.<span class="ruby-identifier">path</span>, <span class="ruby-identifier">standard_in_4</span>(<span class="ruby-identifier">job</span>[<span class="ruby-value str">'jid'</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ts</span>}
|
1717
|
+
657:
|
1718
|
+
658: <span class="ruby-identifier">tuples</span> = []
|
1719
|
+
659:
|
1720
|
+
660: <span class="ruby-identifier">metablock</span> =
|
1721
|
+
661: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
|
1722
|
+
662: <span class="ruby-identifier">lambda</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">job</span><span class="ruby-operator">|</span> <span class="ruby-identifier">clobber_stdin</span>[<span class="ruby-identifier">job</span>]; <span class="ruby-identifier">block</span>[<span class="ruby-identifier">job</span>]}
|
1723
|
+
663: <span class="ruby-keyword kw">else</span>
|
1724
|
+
664: <span class="ruby-identifier">lambda</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">job</span><span class="ruby-operator">|</span> <span class="ruby-identifier">clobber_stdin</span>[<span class="ruby-identifier">job</span>]; <span class="ruby-identifier">tuples</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">job</span>}
|
1725
|
+
665: <span class="ruby-keyword kw">end</span>
|
1726
|
+
666:
|
1727
|
+
667: <span class="ruby-identifier">transaction</span> <span class="ruby-keyword kw">do</span>
|
1728
|
+
668: <span class="ruby-identifier">update_sql</span>, <span class="ruby-identifier">select_sql</span> = <span class="ruby-identifier">build_sql</span>[<span class="ruby-identifier">kvs</span>, <span class="ruby-identifier">jids</span>]
|
1729
|
+
669: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">select_sql</span>
|
1730
|
+
670: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">update_sql</span>){} <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">update_sql</span>
|
1731
|
+
671: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">select_sql</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">metablock</span>)
|
1732
|
+
672: <span class="ruby-keyword kw">end</span>
|
1733
|
+
673:
|
1734
|
+
674: <span class="ruby-identifier">block</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">tuples</span>
|
1735
|
+
675: <span class="ruby-keyword kw">end</span>
|
1736
|
+
676: <span class="ruby-comment cmt">#--}}}</span>
|
1737
|
+
677: <span class="ruby-keyword kw">end</span>
|
1738
|
+
</pre>
|
1739
|
+
</div>
|
1740
|
+
</div>
|
1741
|
+
</div>
|
1742
|
+
|
1743
|
+
<div id="method-M000277" class="method-detail">
|
1744
|
+
<a name="M000277"></a>
|
1745
|
+
|
1746
|
+
<div class="method-heading">
|
1747
|
+
<a href="#M000277" class="method-signature">
|
1748
|
+
<span class="method-name">vacuum</span><span class="method-args">()</span>
|
1749
|
+
</a>
|
1750
|
+
</div>
|
1751
|
+
|
1752
|
+
<div class="method-description">
|
1753
|
+
<p><a class="source-toggle" href="#"
|
1754
|
+
onclick="toggleCode('M000277-source');return false;">[Source]</a></p>
|
1755
|
+
<div class="method-source-code" id="M000277-source">
|
1756
|
+
<pre>
|
1757
|
+
<span class="ruby-comment cmt"># File lib/rq-3.0.0/jobqueue.rb, line 582</span>
|
1758
|
+
582: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">vacuum</span>
|
1759
|
+
583: <span class="ruby-comment cmt">#--{{{</span>
|
1760
|
+
584: <span class="ruby-ivar">@qdb</span>.<span class="ruby-identifier">vacuum</span>
|
1761
|
+
585: <span class="ruby-comment cmt">#--}}}</span>
|
1762
|
+
586: <span class="ruby-keyword kw">end</span>
|
1763
|
+
</pre>
|
1764
|
+
</div>
|
1765
|
+
</div>
|
1766
|
+
</div>
|
1767
|
+
|
1768
|
+
|
1769
|
+
</div>
|
1770
|
+
|
1771
|
+
|
1772
|
+
</div>
|
1773
|
+
|
1774
|
+
|
1775
|
+
<div id="validator-badges">
|
1776
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1777
|
+
</div>
|
1778
|
+
|
1779
|
+
</body>
|
1780
|
+
</html>
|