rq 0.1.7 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (723) hide show
  1. data/INSTALL +21 -0
  2. data/README +752 -190
  3. data/TODO +18 -11
  4. data/TUTORIAL +230 -0
  5. data/all/install.rb +127 -0
  6. data/all/install.sh +165 -0
  7. data/all/packages/INSTALL +5 -0
  8. data/all/packages/arrayfields-3.6.0.tgz +0 -0
  9. data/all/packages/lockfile-1.4.1.tgz +0 -0
  10. data/all/packages/posixlock-0.0.1.tgz +0 -0
  11. data/all/packages/ruby-1.8.6.tgz +0 -0
  12. data/all/packages/rubygems-0.9.2.tgz +0 -0
  13. data/all/packages/sqlite-2.8.15.tar.gz +0 -0
  14. data/all/packages/sqlite-ruby-1.3.1.tar.gz +0 -0
  15. data/bin/rq +830 -361
  16. data/bin/rq-3.0.0 +860 -0
  17. data/doc/classes/ARGV.html +134 -0
  18. data/doc/classes/ARGV.src/M000036.html +36 -0
  19. data/doc/classes/ARGV.src/M000037.html +25 -0
  20. data/doc/classes/OrderedHash.html +1043 -0
  21. data/doc/classes/OrderedHash.src/M000003.html +26 -0
  22. data/doc/classes/OrderedHash.src/M000004.html +31 -0
  23. data/doc/classes/OrderedHash.src/M000005.html +23 -0
  24. data/doc/classes/OrderedHash.src/M000006.html +23 -0
  25. data/doc/classes/OrderedHash.src/M000007.html +24 -0
  26. data/doc/classes/OrderedHash.src/M000009.html +24 -0
  27. data/doc/classes/OrderedHash.src/M000010.html +24 -0
  28. data/doc/classes/OrderedHash.src/M000011.html +24 -0
  29. data/doc/classes/OrderedHash.src/M000012.html +24 -0
  30. data/doc/classes/OrderedHash.src/M000013.html +24 -0
  31. data/doc/classes/OrderedHash.src/M000014.html +24 -0
  32. data/doc/classes/OrderedHash.src/M000016.html +26 -0
  33. data/doc/classes/OrderedHash.src/M000017.html +25 -0
  34. data/doc/classes/OrderedHash.src/M000018.html +23 -0
  35. data/doc/classes/OrderedHash.src/M000019.html +25 -0
  36. data/doc/classes/OrderedHash.src/M000020.html +23 -0
  37. data/doc/classes/OrderedHash.src/M000021.html +24 -0
  38. data/doc/classes/OrderedHash.src/M000022.html +24 -0
  39. data/doc/classes/OrderedHash.src/M000023.html +24 -0
  40. data/doc/classes/OrderedHash.src/M000024.html +29 -0
  41. data/doc/classes/OrderedHash.src/M000025.html +29 -0
  42. data/doc/classes/OrderedHash.src/M000026.html +24 -0
  43. data/doc/classes/OrderedHash.src/M000027.html +25 -0
  44. data/doc/classes/OrderedHash.src/M000028.html +23 -0
  45. data/doc/classes/OrderedHash.src/M000029.html +25 -0
  46. data/doc/classes/OrderedHash.src/M000030.html +24 -0
  47. data/doc/classes/OrderedHash.src/M000032.html +23 -0
  48. data/doc/classes/OrderedHash.src/M000033.html +25 -0
  49. data/doc/classes/OrderedHash.src/M000034.html +36 -0
  50. data/doc/classes/OrderedHash.src/M000035.html +23 -0
  51. data/doc/classes/RQ.html +647 -0
  52. data/doc/classes/RQ/Backer.html +240 -0
  53. data/doc/classes/RQ/Backer.src/M000121.html +31 -0
  54. data/doc/classes/RQ/ConfigFile.html +416 -0
  55. data/doc/classes/RQ/ConfigFile.src/M000100.html +34 -0
  56. data/doc/classes/RQ/ConfigFile.src/M000101.html +26 -0
  57. data/doc/classes/RQ/ConfigFile.src/M000102.html +33 -0
  58. data/doc/classes/RQ/ConfigFile.src/M000103.html +25 -0
  59. data/doc/classes/RQ/ConfigFile.src/M000104.html +34 -0
  60. data/doc/classes/RQ/ConfigFile.src/M000105.html +25 -0
  61. data/doc/classes/RQ/Configurator.html +249 -0
  62. data/doc/classes/RQ/Configurator.src/M000122.html +40 -0
  63. data/doc/classes/RQ/Creator.html +264 -0
  64. data/doc/classes/RQ/Creator.src/M000157.html +32 -0
  65. data/doc/classes/RQ/Cron.html +461 -0
  66. data/doc/classes/RQ/Deleter.html +259 -0
  67. data/doc/classes/RQ/Deleter.src/M000078.html +52 -0
  68. data/doc/classes/RQ/Executor.html +249 -0
  69. data/doc/classes/RQ/Executor.src/M000099.html +45 -0
  70. data/doc/classes/RQ/Feeder.html +1131 -0
  71. data/doc/classes/RQ/Feeder.src/M000079.html +67 -0
  72. data/doc/classes/RQ/Feeder.src/M000080.html +47 -0
  73. data/doc/classes/RQ/Feeder.src/M000081.html +98 -0
  74. data/doc/classes/RQ/Feeder.src/M000082.html +25 -0
  75. data/doc/classes/RQ/Feeder.src/M000083.html +30 -0
  76. data/doc/classes/RQ/Feeder.src/M000084.html +58 -0
  77. data/doc/classes/RQ/Feeder.src/M000085.html +37 -0
  78. data/doc/classes/RQ/Feeder.src/M000086.html +40 -0
  79. data/doc/classes/RQ/Feeder.src/M000087.html +37 -0
  80. data/doc/classes/RQ/Feeder.src/M000088.html +35 -0
  81. data/doc/classes/RQ/Feeder.src/M000089.html +47 -0
  82. data/doc/classes/RQ/Feeder.src/M000090.html +25 -0
  83. data/doc/classes/RQ/Feeder.src/M000091.html +78 -0
  84. data/doc/classes/RQ/Feeder.src/M000092.html +34 -0
  85. data/doc/classes/RQ/Feeder.src/M000093.html +36 -0
  86. data/doc/classes/RQ/Feeder.src/M000094.html +25 -0
  87. data/doc/classes/RQ/Feeder.src/M000095.html +27 -0
  88. data/doc/classes/RQ/IOViewer.html +256 -0
  89. data/doc/classes/RQ/Job.html +304 -0
  90. data/doc/classes/RQ/Job.src/M000168.html +26 -0
  91. data/doc/classes/RQ/Job.src/M000169.html +37 -0
  92. data/doc/classes/RQ/Job.src/M000170.html +23 -0
  93. data/doc/classes/RQ/Job/Methods.html +210 -0
  94. data/doc/classes/RQ/JobQueue.html +1780 -0
  95. data/doc/classes/RQ/JobQueue.src/M000176.html +31 -0
  96. data/doc/classes/RQ/JobQueue.src/M000177.html +34 -0
  97. data/doc/classes/RQ/JobQueue.src/M000178.html +60 -0
  98. data/doc/classes/RQ/JobQueue.src/M000179.html +63 -0
  99. data/doc/classes/RQ/JobQueue.src/M000180.html +73 -0
  100. data/doc/classes/RQ/JobQueue.src/M000181.html +217 -0
  101. data/doc/classes/RQ/JobQueue.src/M000182.html +50 -0
  102. data/doc/classes/RQ/JobQueue.src/M000183.html +83 -0
  103. data/doc/classes/RQ/JobQueue.src/M000184.html +25 -0
  104. data/doc/classes/RQ/JobQueue.src/M000185.html +83 -0
  105. data/doc/classes/RQ/JobQueue.src/M000186.html +28 -0
  106. data/doc/classes/RQ/JobQueue.src/M000187.html +26 -0
  107. data/doc/classes/RQ/JobQueue.src/M000188.html +26 -0
  108. data/doc/classes/RQ/JobQueue.src/M000189.html +32 -0
  109. data/doc/classes/RQ/JobQueue.src/M000190.html +30 -0
  110. data/doc/classes/RQ/JobQueue.src/M000191.html +37 -0
  111. data/doc/classes/RQ/JobQueue.src/M000192.html +36 -0
  112. data/doc/classes/RQ/JobQueue.src/M000193.html +25 -0
  113. data/doc/classes/RQ/JobQueue.src/M000194.html +25 -0
  114. data/doc/classes/RQ/JobQueue.src/M000195.html +25 -0
  115. data/doc/classes/RQ/JobQueue.src/M000196.html +25 -0
  116. data/doc/classes/RQ/JobQueue.src/M000197.html +25 -0
  117. data/doc/classes/RQ/JobQueue.src/M000198.html +73 -0
  118. data/doc/classes/RQ/JobQueue.src/M000199.html +25 -0
  119. data/doc/classes/RQ/JobQueue.src/M000200.html +38 -0
  120. data/doc/classes/RQ/JobQueue.src/M000201.html +28 -0
  121. data/doc/classes/RQ/JobQueue/Error.html +187 -0
  122. data/doc/classes/RQ/JobRunner.html +386 -0
  123. data/doc/classes/RQ/JobRunner.src/M000117.html +53 -0
  124. data/doc/classes/RQ/JobRunner.src/M000118.html +26 -0
  125. data/doc/classes/RQ/JobRunnerDaemon.html +590 -0
  126. data/doc/classes/RQ/JobRunnerDaemon.src/M000159.html +94 -0
  127. data/doc/classes/RQ/JobRunnerDaemon.src/M000160.html +27 -0
  128. data/doc/classes/RQ/JobRunnerDaemon.src/M000161.html +39 -0
  129. data/doc/classes/RQ/JobRunnerDaemon.src/M000162.html +27 -0
  130. data/doc/classes/RQ/JobRunnerDaemon.src/M000163.html +27 -0
  131. data/doc/classes/RQ/JobRunnerDaemon.src/M000164.html +28 -0
  132. data/doc/classes/RQ/JobRunnerDaemon.src/M000165.html +28 -0
  133. data/doc/classes/RQ/JobRunnerDaemon.src/M000166.html +37 -0
  134. data/doc/classes/RQ/JobRunnerDaemon.src/M000167.html +25 -0
  135. data/doc/classes/RQ/Lister.html +256 -0
  136. data/doc/classes/RQ/Lister.src/M000156.html +52 -0
  137. data/doc/classes/RQ/Locker.html +250 -0
  138. data/doc/classes/RQ/Locker.src/M000120.html +40 -0
  139. data/doc/classes/RQ/Logging.html +296 -0
  140. data/doc/classes/RQ/Logging.src/M000067.html +28 -0
  141. data/doc/classes/RQ/Logging/LogClassMethods.html +254 -0
  142. data/doc/classes/RQ/Logging/LogClassMethods.src/M000068.html +32 -0
  143. data/doc/classes/RQ/Logging/LogClassMethods.src/M000069.html +28 -0
  144. data/doc/classes/RQ/Logging/LogMethods.html +404 -0
  145. data/doc/classes/RQ/Logging/LogMethods.src/M000070.html +35 -0
  146. data/doc/classes/RQ/Logging/LogMethods.src/M000071.html +28 -0
  147. data/doc/classes/RQ/Logging/LogMethods.src/M000072.html +21 -0
  148. data/doc/classes/RQ/Logging/LogMethods.src/M000073.html +21 -0
  149. data/doc/classes/RQ/Logging/LogMethods.src/M000074.html +21 -0
  150. data/doc/classes/RQ/Logging/LogMethods.src/M000075.html +21 -0
  151. data/doc/classes/RQ/Logging/LogMethods.src/M000076.html +21 -0
  152. data/doc/classes/RQ/Logging/LogMethods.src/M000077.html +29 -0
  153. data/doc/classes/RQ/Logging/LoggerExt.html +194 -0
  154. data/doc/classes/RQ/Main.html +2110 -0
  155. data/doc/classes/RQ/MainHelper.html +607 -0
  156. data/doc/classes/RQ/MainHelper.src/M000171.html +33 -0
  157. data/doc/classes/RQ/MainHelper.src/M000172.html +32 -0
  158. data/doc/classes/RQ/MainHelper.src/M000173.html +44 -0
  159. data/doc/classes/RQ/OrderedAutoHash.html +258 -0
  160. data/doc/classes/RQ/OrderedAutoHash.src/M000205.html +25 -0
  161. data/doc/classes/RQ/OrderedAutoHash.src/M000206.html +25 -0
  162. data/doc/classes/RQ/QDB.html +1653 -0
  163. data/doc/classes/RQ/QDB.src/M000126.html +25 -0
  164. data/doc/classes/RQ/QDB.src/M000127.html +37 -0
  165. data/doc/classes/RQ/QDB.src/M000128.html +27 -0
  166. data/doc/classes/RQ/QDB.src/M000129.html +27 -0
  167. data/doc/classes/RQ/QDB.src/M000130.html +27 -0
  168. data/doc/classes/RQ/QDB.src/M000131.html +31 -0
  169. data/doc/classes/RQ/QDB.src/M000132.html +32 -0
  170. data/doc/classes/RQ/QDB.src/M000133.html +30 -0
  171. data/doc/classes/RQ/QDB.src/M000134.html +91 -0
  172. data/doc/classes/RQ/QDB.src/M000135.html +26 -0
  173. data/doc/classes/RQ/QDB.src/M000136.html +46 -0
  174. data/doc/classes/RQ/QDB.src/M000137.html +26 -0
  175. data/doc/classes/RQ/QDB.src/M000138.html +51 -0
  176. data/doc/classes/RQ/QDB.src/M000139.html +61 -0
  177. data/doc/classes/RQ/QDB.src/M000140.html +57 -0
  178. data/doc/classes/RQ/QDB.src/M000141.html +25 -0
  179. data/doc/classes/RQ/QDB.src/M000142.html +25 -0
  180. data/doc/classes/RQ/QDB.src/M000143.html +37 -0
  181. data/doc/classes/RQ/QDB.src/M000144.html +107 -0
  182. data/doc/classes/RQ/QDB.src/M000145.html +40 -0
  183. data/doc/classes/RQ/QDB.src/M000146.html +34 -0
  184. data/doc/classes/RQ/QDB.src/M000147.html +33 -0
  185. data/doc/classes/RQ/QDB.src/M000148.html +32 -0
  186. data/doc/classes/RQ/QDB.src/M000149.html +98 -0
  187. data/doc/classes/RQ/QDB.src/M000150.html +26 -0
  188. data/doc/classes/RQ/QDB.src/M000151.html +31 -0
  189. data/doc/classes/RQ/QDB.src/M000154.html +26 -0
  190. data/doc/classes/RQ/QDB/AbortedTransactionError.html +187 -0
  191. data/doc/classes/RQ/QDB/RollbackTransactionError.html +187 -0
  192. data/doc/classes/RQ/Querier.html +328 -0
  193. data/doc/classes/RQ/Querier.src/M000203.html +45 -0
  194. data/doc/classes/RQ/Querier.src/M000204.html +78 -0
  195. data/doc/classes/RQ/ReSubmitter.html +307 -0
  196. data/doc/classes/RQ/ReSubmitter.src/M000098.html +111 -0
  197. data/doc/classes/RQ/Recoverer.html +247 -0
  198. data/doc/classes/RQ/Refresher.html +346 -0
  199. data/doc/classes/RQ/Refresher.src/M000174.html +51 -0
  200. data/doc/classes/RQ/Refresher.src/M000175.html +44 -0
  201. data/doc/classes/RQ/Relayer.html +723 -0
  202. data/doc/classes/RQ/Relayer.src/M000106.html +91 -0
  203. data/doc/classes/RQ/Relayer.src/M000107.html +47 -0
  204. data/doc/classes/RQ/Relayer.src/M000108.html +46 -0
  205. data/doc/classes/RQ/Relayer.src/M000109.html +26 -0
  206. data/doc/classes/RQ/Relayer.src/M000110.html +46 -0
  207. data/doc/classes/RQ/Relayer.src/M000111.html +40 -0
  208. data/doc/classes/RQ/Relayer.src/M000112.html +37 -0
  209. data/doc/classes/RQ/Relayer.src/M000113.html +40 -0
  210. data/doc/classes/RQ/Relayer.src/M000114.html +27 -0
  211. data/doc/classes/RQ/Relayer.src/M000115.html +25 -0
  212. data/doc/classes/RQ/Relayer.src/M000116.html +38 -0
  213. data/doc/classes/RQ/Resource.html +187 -0
  214. data/doc/classes/RQ/ResourceManager.html +276 -0
  215. data/doc/classes/RQ/Rotater.html +324 -0
  216. data/doc/classes/RQ/Rotater.src/M000158.html +71 -0
  217. data/doc/classes/RQ/SleepCycle.html +322 -0
  218. data/doc/classes/RQ/SleepCycle.src/M000123.html +32 -0
  219. data/doc/classes/RQ/SleepCycle.src/M000124.html +27 -0
  220. data/doc/classes/RQ/SleepCycle.src/M000125.html +25 -0
  221. data/doc/classes/RQ/Snapshotter.html +250 -0
  222. data/doc/classes/RQ/Snapshotter.src/M000097.html +35 -0
  223. data/doc/classes/RQ/StatusLister.html +289 -0
  224. data/doc/classes/RQ/StatusLister.src/M000096.html +26 -0
  225. data/doc/classes/RQ/Submitter.html +319 -0
  226. data/doc/classes/RQ/Submitter.src/M000119.html +92 -0
  227. data/doc/classes/RQ/Toucher.html +384 -0
  228. data/doc/classes/RQ/Updater.html +304 -0
  229. data/doc/classes/RQ/Updater.src/M000202.html +97 -0
  230. data/doc/classes/RQ/Usage.html +346 -0
  231. data/doc/classes/RQ/Usage.src/M000038.html +29 -0
  232. data/doc/classes/RQ/Usage.src/M000039.html +72 -0
  233. data/doc/classes/RQ/Util.html +1043 -0
  234. data/doc/classes/RQ/Util.src/M000040.html +27 -0
  235. data/doc/classes/RQ/Util.src/M000041.html +26 -0
  236. data/doc/classes/RQ/Util.src/M000042.html +25 -0
  237. data/doc/classes/RQ/Util.src/M000043.html +25 -0
  238. data/doc/classes/RQ/Util.src/M000044.html +30 -0
  239. data/doc/classes/RQ/Util.src/M000045.html +25 -0
  240. data/doc/classes/RQ/Util.src/M000046.html +34 -0
  241. data/doc/classes/RQ/Util.src/M000047.html +31 -0
  242. data/doc/classes/RQ/Util.src/M000048.html +41 -0
  243. data/doc/classes/RQ/Util.src/M000049.html +27 -0
  244. data/doc/classes/RQ/Util.src/M000050.html +34 -0
  245. data/doc/classes/RQ/Util.src/M000051.html +28 -0
  246. data/doc/classes/RQ/Util.src/M000052.html +27 -0
  247. data/doc/classes/RQ/Util.src/M000053.html +31 -0
  248. data/doc/classes/RQ/Util.src/M000054.html +31 -0
  249. data/doc/classes/RQ/Util.src/M000055.html +31 -0
  250. data/doc/classes/RQ/Util.src/M000056.html +25 -0
  251. data/doc/classes/RQ/Util.src/M000057.html +25 -0
  252. data/doc/classes/RQ/Util.src/M000058.html +25 -0
  253. data/doc/classes/RQ/Util.src/M000059.html +25 -0
  254. data/doc/classes/RQ/Util.src/M000060.html +25 -0
  255. data/doc/classes/RQ/Util.src/M000061.html +27 -0
  256. data/doc/classes/RQ/Util.src/M000062.html +28 -0
  257. data/doc/classes/RQ/Util.src/M000063.html +39 -0
  258. data/doc/classes/RQ/Util.src/M000064.html +39 -0
  259. data/doc/classes/RQ/Util.src/M000065.html +31 -0
  260. data/doc/classes/RQ/Util.src/M000066.html +29 -0
  261. data/doc/classes/SQLite.html +120 -0
  262. data/doc/classes/SQLite/Database.html +546 -0
  263. data/doc/classes/SQLite/TypeTranslator.html +221 -0
  264. data/doc/created.rid +1 -0
  265. data/doc/dot/f_0.dot +14 -0
  266. data/doc/dot/f_0.jpg +0 -0
  267. data/doc/dot/f_1.dot +14 -0
  268. data/doc/dot/f_1.jpg +0 -0
  269. data/doc/dot/f_10.dot +802 -0
  270. data/doc/dot/f_10.jpg +0 -0
  271. data/doc/dot/f_11.dot +14 -0
  272. data/doc/dot/f_11.jpg +0 -0
  273. data/doc/dot/f_12.dot +802 -0
  274. data/doc/dot/f_12.jpg +0 -0
  275. data/doc/dot/f_13.dot +802 -0
  276. data/doc/dot/f_13.jpg +0 -0
  277. data/doc/dot/f_14.dot +802 -0
  278. data/doc/dot/f_14.jpg +0 -0
  279. data/doc/dot/f_15.dot +802 -0
  280. data/doc/dot/f_15.jpg +0 -0
  281. data/doc/dot/f_16.dot +802 -0
  282. data/doc/dot/f_16.jpg +0 -0
  283. data/doc/dot/f_17.dot +802 -0
  284. data/doc/dot/f_17.jpg +0 -0
  285. data/doc/dot/f_18.dot +14 -0
  286. data/doc/dot/f_18.jpg +0 -0
  287. data/doc/dot/f_19.dot +802 -0
  288. data/doc/dot/f_19.jpg +0 -0
  289. data/doc/dot/f_2.dot +14 -0
  290. data/doc/dot/f_2.jpg +0 -0
  291. data/doc/dot/f_20.dot +802 -0
  292. data/doc/dot/f_20.jpg +0 -0
  293. data/doc/dot/f_21.dot +802 -0
  294. data/doc/dot/f_21.jpg +0 -0
  295. data/doc/dot/f_22.dot +802 -0
  296. data/doc/dot/f_22.jpg +0 -0
  297. data/doc/dot/f_23.dot +802 -0
  298. data/doc/dot/f_23.jpg +0 -0
  299. data/doc/dot/f_24.dot +802 -0
  300. data/doc/dot/f_24.jpg +0 -0
  301. data/doc/dot/f_25.dot +817 -0
  302. data/doc/dot/f_25.jpg +0 -0
  303. data/doc/dot/f_26.dot +29 -0
  304. data/doc/dot/f_26.jpg +0 -0
  305. data/doc/dot/f_27.dot +802 -0
  306. data/doc/dot/f_27.jpg +0 -0
  307. data/doc/dot/f_28.dot +802 -0
  308. data/doc/dot/f_28.jpg +0 -0
  309. data/doc/dot/f_29.dot +802 -0
  310. data/doc/dot/f_29.jpg +0 -0
  311. data/doc/dot/f_3.dot +14 -0
  312. data/doc/dot/f_3.jpg +0 -0
  313. data/doc/dot/f_30.dot +802 -0
  314. data/doc/dot/f_30.jpg +0 -0
  315. data/doc/dot/f_31.dot +802 -0
  316. data/doc/dot/f_31.jpg +0 -0
  317. data/doc/dot/f_32.dot +802 -0
  318. data/doc/dot/f_32.jpg +0 -0
  319. data/doc/dot/f_33.dot +802 -0
  320. data/doc/dot/f_33.jpg +0 -0
  321. data/doc/dot/f_34.dot +802 -0
  322. data/doc/dot/f_34.jpg +0 -0
  323. data/doc/dot/f_35.dot +802 -0
  324. data/doc/dot/f_35.jpg +0 -0
  325. data/doc/dot/f_36.dot +802 -0
  326. data/doc/dot/f_36.jpg +0 -0
  327. data/doc/dot/f_37.dot +802 -0
  328. data/doc/dot/f_37.jpg +0 -0
  329. data/doc/dot/f_38.dot +54 -0
  330. data/doc/dot/f_38.jpg +0 -0
  331. data/doc/dot/f_39.dot +802 -0
  332. data/doc/dot/f_39.jpg +0 -0
  333. data/doc/dot/f_4.dot +802 -0
  334. data/doc/dot/f_4.jpg +0 -0
  335. data/doc/dot/f_40.dot +802 -0
  336. data/doc/dot/f_40.jpg +0 -0
  337. data/doc/dot/f_41.dot +802 -0
  338. data/doc/dot/f_41.jpg +0 -0
  339. data/doc/dot/f_42.dot +802 -0
  340. data/doc/dot/f_42.jpg +0 -0
  341. data/doc/dot/f_43.dot +802 -0
  342. data/doc/dot/f_43.jpg +0 -0
  343. data/doc/dot/f_44.dot +802 -0
  344. data/doc/dot/f_44.jpg +0 -0
  345. data/doc/dot/f_5.dot +802 -0
  346. data/doc/dot/f_5.jpg +0 -0
  347. data/doc/dot/f_6.dot +802 -0
  348. data/doc/dot/f_6.jpg +0 -0
  349. data/doc/dot/f_7.dot +802 -0
  350. data/doc/dot/f_7.jpg +0 -0
  351. data/doc/dot/f_8.dot +802 -0
  352. data/doc/dot/f_8.jpg +0 -0
  353. data/doc/dot/f_9.dot +802 -0
  354. data/doc/dot/f_9.jpg +0 -0
  355. data/doc/dot/m_10_0.dot +802 -0
  356. data/doc/dot/m_10_0.jpg +0 -0
  357. data/doc/dot/m_11_0.dot +734 -0
  358. data/doc/dot/m_11_0.jpg +0 -0
  359. data/doc/dot/m_12_0.dot +802 -0
  360. data/doc/dot/m_12_0.jpg +0 -0
  361. data/doc/dot/m_13_0.dot +802 -0
  362. data/doc/dot/m_13_0.jpg +0 -0
  363. data/doc/dot/m_14_0.dot +802 -0
  364. data/doc/dot/m_14_0.jpg +0 -0
  365. data/doc/dot/m_15_0.dot +802 -0
  366. data/doc/dot/m_15_0.jpg +0 -0
  367. data/doc/dot/m_16_0.dot +802 -0
  368. data/doc/dot/m_16_0.jpg +0 -0
  369. data/doc/dot/m_17_0.dot +802 -0
  370. data/doc/dot/m_17_0.jpg +0 -0
  371. data/doc/dot/m_18_0.dot +734 -0
  372. data/doc/dot/m_18_0.jpg +0 -0
  373. data/doc/dot/m_19_0.dot +802 -0
  374. data/doc/dot/m_19_0.jpg +0 -0
  375. data/doc/dot/m_20_0.dot +802 -0
  376. data/doc/dot/m_20_0.jpg +0 -0
  377. data/doc/dot/m_21_0.dot +802 -0
  378. data/doc/dot/m_21_0.jpg +0 -0
  379. data/doc/dot/m_22_0.dot +802 -0
  380. data/doc/dot/m_22_0.jpg +0 -0
  381. data/doc/dot/m_23_0.dot +802 -0
  382. data/doc/dot/m_23_0.jpg +0 -0
  383. data/doc/dot/m_24_0.dot +802 -0
  384. data/doc/dot/m_24_0.jpg +0 -0
  385. data/doc/dot/m_25_0.dot +802 -0
  386. data/doc/dot/m_25_0.jpg +0 -0
  387. data/doc/dot/m_26_0.dot +734 -0
  388. data/doc/dot/m_26_0.jpg +0 -0
  389. data/doc/dot/m_27_0.dot +802 -0
  390. data/doc/dot/m_27_0.jpg +0 -0
  391. data/doc/dot/m_28_0.dot +802 -0
  392. data/doc/dot/m_28_0.jpg +0 -0
  393. data/doc/dot/m_29_0.dot +802 -0
  394. data/doc/dot/m_29_0.jpg +0 -0
  395. data/doc/dot/m_30_0.dot +802 -0
  396. data/doc/dot/m_30_0.jpg +0 -0
  397. data/doc/dot/m_31_0.dot +802 -0
  398. data/doc/dot/m_31_0.jpg +0 -0
  399. data/doc/dot/m_32_0.dot +802 -0
  400. data/doc/dot/m_32_0.jpg +0 -0
  401. data/doc/dot/m_33_0.dot +802 -0
  402. data/doc/dot/m_33_0.jpg +0 -0
  403. data/doc/dot/m_34_0.dot +802 -0
  404. data/doc/dot/m_34_0.jpg +0 -0
  405. data/doc/dot/m_35_0.dot +802 -0
  406. data/doc/dot/m_35_0.jpg +0 -0
  407. data/doc/dot/m_36_0.dot +802 -0
  408. data/doc/dot/m_36_0.jpg +0 -0
  409. data/doc/dot/m_37_0.dot +802 -0
  410. data/doc/dot/m_37_0.jpg +0 -0
  411. data/doc/dot/m_38_0.dot +54 -0
  412. data/doc/dot/m_38_0.jpg +0 -0
  413. data/doc/dot/m_39_0.dot +802 -0
  414. data/doc/dot/m_39_0.jpg +0 -0
  415. data/doc/dot/m_40_0.dot +802 -0
  416. data/doc/dot/m_40_0.jpg +0 -0
  417. data/doc/dot/m_41_0.dot +802 -0
  418. data/doc/dot/m_41_0.jpg +0 -0
  419. data/doc/dot/m_42_0.dot +802 -0
  420. data/doc/dot/m_42_0.jpg +0 -0
  421. data/doc/dot/m_43_0.dot +802 -0
  422. data/doc/dot/m_43_0.jpg +0 -0
  423. data/doc/dot/m_44_0.dot +802 -0
  424. data/doc/dot/m_44_0.jpg +0 -0
  425. data/doc/dot/m_4_0.dot +802 -0
  426. data/doc/dot/m_4_0.jpg +0 -0
  427. data/doc/dot/m_5_0.dot +802 -0
  428. data/doc/dot/m_5_0.jpg +0 -0
  429. data/doc/dot/m_6_0.dot +802 -0
  430. data/doc/dot/m_6_0.jpg +0 -0
  431. data/doc/dot/m_7_0.dot +802 -0
  432. data/doc/dot/m_7_0.jpg +0 -0
  433. data/doc/dot/m_8_0.dot +802 -0
  434. data/doc/dot/m_8_0.jpg +0 -0
  435. data/doc/dot/m_9_0.dot +802 -0
  436. data/doc/dot/m_9_0.jpg +0 -0
  437. data/doc/files/DEPENDS.html +107 -0
  438. data/doc/files/HISTORY.html +316 -0
  439. data/doc/files/INSTALL.html +126 -0
  440. data/doc/files/README.html +1223 -0
  441. data/doc/files/TODO.html +148 -0
  442. data/doc/files/TUTORIAL.html +392 -0
  443. data/doc/files/VERSION.html +107 -0
  444. data/doc/files/bin/rq_rb.html +231 -0
  445. data/doc/files/install_rb.html +188 -0
  446. data/doc/files/install_rb.src/M000001.html +53 -0
  447. data/doc/files/install_rb.src/M000002.html +43 -0
  448. data/doc/files/lib/rq-1_0_0/backer_rb.html +174 -0
  449. data/doc/files/lib/rq-1_0_0/configfile_rb.html +174 -0
  450. data/doc/files/lib/rq-1_0_0/configurator_rb.html +174 -0
  451. data/doc/files/lib/rq-1_0_0/creator_rb.html +174 -0
  452. data/doc/files/lib/rq-1_0_0/defaultconfig_txt.html +110 -0
  453. data/doc/files/lib/rq-1_0_0/deleter_rb.html +174 -0
  454. data/doc/files/lib/rq-1_0_0/executor_rb.html +174 -0
  455. data/doc/files/lib/rq-1_0_0/feeder_rb.html +178 -0
  456. data/doc/files/lib/rq-1_0_0/job_rb.html +176 -0
  457. data/doc/files/lib/rq-1_0_0/jobqueue_rb.html +177 -0
  458. data/doc/files/lib/rq-1_0_0/jobrunner_rb.html +175 -0
  459. data/doc/files/lib/rq-1_0_0/jobrunnerdaemon_rb.html +179 -0
  460. data/doc/files/lib/rq-1_0_0/lister_rb.html +174 -0
  461. data/doc/files/lib/rq-1_0_0/locker_rb.html +175 -0
  462. data/doc/files/lib/rq-1_0_0/logging_rb.html +178 -0
  463. data/doc/files/lib/rq-1_0_0/mainhelper_rb.html +175 -0
  464. data/doc/files/lib/rq-1_0_0/qdb_rb.html +177 -0
  465. data/doc/files/lib/rq-1_0_0/querier_rb.html +174 -0
  466. data/doc/files/lib/rq-1_0_0/refresher_rb.html +167 -0
  467. data/doc/files/lib/rq-1_0_0/relayer_rb.html +178 -0
  468. data/doc/files/lib/rq-1_0_0/sleepcycle_rb.html +167 -0
  469. data/doc/files/lib/rq-1_0_0/snapshotter_rb.html +174 -0
  470. data/doc/files/lib/rq-1_0_0/statuslister_rb.html +174 -0
  471. data/doc/files/lib/rq-1_0_0/submitter_rb.html +174 -0
  472. data/doc/files/lib/rq-1_0_0/updater_rb.html +174 -0
  473. data/doc/files/lib/rq-1_0_0/usage_rb.html +174 -0
  474. data/doc/files/lib/rq-1_0_0/util_rb.html +176 -0
  475. data/doc/files/lib/rq-2_0_0/backer_rb.html +180 -0
  476. data/doc/files/lib/rq-2_0_0/configfile_rb.html +180 -0
  477. data/doc/files/lib/rq-2_0_0/configurator_rb.html +180 -0
  478. data/doc/files/lib/rq-2_0_0/creator_rb.html +180 -0
  479. data/doc/files/lib/rq-2_0_0/defaultconfig_txt.html +110 -0
  480. data/doc/files/lib/rq-2_0_0/deleter_rb.html +180 -0
  481. data/doc/files/lib/rq-2_0_0/executor_rb.html +180 -0
  482. data/doc/files/lib/rq-2_0_0/feeder_rb.html +184 -0
  483. data/doc/files/lib/rq-2_0_0/job_rb.html +182 -0
  484. data/doc/files/lib/rq-2_0_0/jobqueue_rb.html +185 -0
  485. data/doc/files/lib/rq-2_0_0/jobrunner_rb.html +181 -0
  486. data/doc/files/lib/rq-2_0_0/jobrunnerdaemon_rb.html +185 -0
  487. data/doc/files/lib/rq-2_0_0/lister_rb.html +180 -0
  488. data/doc/files/lib/rq-2_0_0/locker_rb.html +181 -0
  489. data/doc/files/lib/rq-2_0_0/logging_rb.html +184 -0
  490. data/doc/files/lib/rq-2_0_0/mainhelper_rb.html +181 -0
  491. data/doc/files/lib/rq-2_0_0/orderedautohash_rb.html +182 -0
  492. data/doc/files/lib/rq-2_0_0/orderedhash_rb.html +138 -0
  493. data/doc/files/lib/rq-2_0_0/qdb_rb.html +184 -0
  494. data/doc/files/lib/rq-2_0_0/querier_rb.html +180 -0
  495. data/doc/files/lib/rq-2_0_0/refresher_rb.html +173 -0
  496. data/doc/files/lib/rq-2_0_0/relayer_rb.html +184 -0
  497. data/doc/files/lib/rq-2_0_0/rotater_rb.html +180 -0
  498. data/doc/files/lib/rq-2_0_0/sleepcycle_rb.html +173 -0
  499. data/doc/files/lib/rq-2_0_0/snapshotter_rb.html +180 -0
  500. data/doc/files/lib/rq-2_0_0/statuslister_rb.html +180 -0
  501. data/doc/files/lib/rq-2_0_0/submitter_rb.html +181 -0
  502. data/doc/files/lib/rq-2_0_0/updater_rb.html +180 -0
  503. data/doc/files/lib/rq-2_0_0/usage_rb.html +180 -0
  504. data/doc/files/lib/rq-2_0_0/util_rb.html +182 -0
  505. data/doc/files/lib/rq-2_3_1/backer_rb.html +182 -0
  506. data/doc/files/lib/rq-2_3_1/configfile_rb.html +182 -0
  507. data/doc/files/lib/rq-2_3_1/configurator_rb.html +182 -0
  508. data/doc/files/lib/rq-2_3_1/creator_rb.html +182 -0
  509. data/doc/files/lib/rq-2_3_1/defaultconfig_txt.html +110 -0
  510. data/doc/files/lib/rq-2_3_1/deleter_rb.html +182 -0
  511. data/doc/files/lib/rq-2_3_1/executor_rb.html +182 -0
  512. data/doc/files/lib/rq-2_3_1/feeder_rb.html +187 -0
  513. data/doc/files/lib/rq-2_3_1/job_rb.html +185 -0
  514. data/doc/files/lib/rq-2_3_1/jobqueue_rb.html +187 -0
  515. data/doc/files/lib/rq-2_3_1/jobrunner_rb.html +184 -0
  516. data/doc/files/lib/rq-2_3_1/jobrunnerdaemon_rb.html +187 -0
  517. data/doc/files/lib/rq-2_3_1/lister_rb.html +182 -0
  518. data/doc/files/lib/rq-2_3_1/locker_rb.html +183 -0
  519. data/doc/files/lib/rq-2_3_1/logging_rb.html +186 -0
  520. data/doc/files/lib/rq-2_3_1/mainhelper_rb.html +183 -0
  521. data/doc/files/lib/rq-2_3_1/orderedautohash_rb.html +184 -0
  522. data/doc/files/lib/rq-2_3_1/orderedhash_rb.html +138 -0
  523. data/doc/files/lib/rq-2_3_1/qdb_rb.html +188 -0
  524. data/doc/files/lib/rq-2_3_1/querier_rb.html +182 -0
  525. data/doc/files/lib/rq-2_3_1/refresher_rb.html +175 -0
  526. data/doc/files/lib/rq-2_3_1/relayer_rb.html +186 -0
  527. data/doc/files/lib/rq-2_3_1/resubmitter_rb.html +183 -0
  528. data/doc/files/lib/rq-2_3_1/rotater_rb.html +182 -0
  529. data/doc/files/lib/rq-2_3_1/sleepcycle_rb.html +175 -0
  530. data/doc/files/lib/rq-2_3_1/snapshotter_rb.html +182 -0
  531. data/doc/files/lib/rq-2_3_1/statuslister_rb.html +182 -0
  532. data/doc/files/lib/rq-2_3_1/submitter_rb.html +183 -0
  533. data/doc/files/lib/rq-2_3_1/updater_rb.html +182 -0
  534. data/doc/files/lib/rq-2_3_1/usage_rb.html +182 -0
  535. data/doc/files/lib/rq-2_3_1/util_rb.html +184 -0
  536. data/doc/files/lib/rq-2_3_1_rb.html +153 -0
  537. data/doc/files/lib/rq-2_3_2/backer_rb.html +186 -0
  538. data/doc/files/lib/rq-2_3_2/configfile_rb.html +186 -0
  539. data/doc/files/lib/rq-2_3_2/configurator_rb.html +186 -0
  540. data/doc/files/lib/rq-2_3_2/creator_rb.html +186 -0
  541. data/doc/files/lib/rq-2_3_2/defaultconfig_txt.html +110 -0
  542. data/doc/files/lib/rq-2_3_2/deleter_rb.html +186 -0
  543. data/doc/files/lib/rq-2_3_2/executor_rb.html +186 -0
  544. data/doc/files/lib/rq-2_3_2/feeder_rb.html +191 -0
  545. data/doc/files/lib/rq-2_3_2/ioviewer_rb.html +186 -0
  546. data/doc/files/lib/rq-2_3_2/job_rb.html +189 -0
  547. data/doc/files/lib/rq-2_3_2/jobqueue_rb.html +192 -0
  548. data/doc/files/lib/rq-2_3_2/jobrunner_rb.html +188 -0
  549. data/doc/files/lib/rq-2_3_2/jobrunnerdaemon_rb.html +191 -0
  550. data/doc/files/lib/rq-2_3_2/lister_rb.html +186 -0
  551. data/doc/files/lib/rq-2_3_2/locker_rb.html +187 -0
  552. data/doc/files/lib/rq-2_3_2/logging_rb.html +190 -0
  553. data/doc/files/lib/rq-2_3_2/mainhelper_rb.html +188 -0
  554. data/doc/files/lib/rq-2_3_2/orderedautohash_rb.html +188 -0
  555. data/doc/files/lib/rq-2_3_2/orderedhash_rb.html +138 -0
  556. data/doc/files/lib/rq-2_3_2/qdb_rb.html +193 -0
  557. data/doc/files/lib/rq-2_3_2/querier_rb.html +186 -0
  558. data/doc/files/lib/rq-2_3_2/recoverer_rb.html +186 -0
  559. data/doc/files/lib/rq-2_3_2/refresher_rb.html +179 -0
  560. data/doc/files/lib/rq-2_3_2/relayer_rb.html +190 -0
  561. data/doc/files/lib/rq-2_3_2/resubmitter_rb.html +187 -0
  562. data/doc/files/lib/rq-2_3_2/rotater_rb.html +186 -0
  563. data/doc/files/lib/rq-2_3_2/sleepcycle_rb.html +179 -0
  564. data/doc/files/lib/rq-2_3_2/snapshotter_rb.html +186 -0
  565. data/doc/files/lib/rq-2_3_2/statuslister_rb.html +186 -0
  566. data/doc/files/lib/rq-2_3_2/submitter_rb.html +187 -0
  567. data/doc/files/lib/rq-2_3_2/updater_rb.html +186 -0
  568. data/doc/files/lib/rq-2_3_2/usage_rb.html +186 -0
  569. data/doc/files/lib/rq-2_3_2/util_rb.html +188 -0
  570. data/doc/files/lib/rq-2_3_3/backer_rb.html +186 -0
  571. data/doc/files/lib/rq-2_3_3/configfile_rb.html +186 -0
  572. data/doc/files/lib/rq-2_3_3/configurator_rb.html +186 -0
  573. data/doc/files/lib/rq-2_3_3/creator_rb.html +186 -0
  574. data/doc/files/lib/rq-2_3_3/defaultconfig_txt.html +110 -0
  575. data/doc/files/lib/rq-2_3_3/deleter_rb.html +186 -0
  576. data/doc/files/lib/rq-2_3_3/executor_rb.html +186 -0
  577. data/doc/files/lib/rq-2_3_3/feeder_rb.html +191 -0
  578. data/doc/files/lib/rq-2_3_3/ioviewer_rb.html +186 -0
  579. data/doc/files/lib/rq-2_3_3/job_rb.html +189 -0
  580. data/doc/files/lib/rq-2_3_3/jobqueue_rb.html +192 -0
  581. data/doc/files/lib/rq-2_3_3/jobrunner_rb.html +188 -0
  582. data/doc/files/lib/rq-2_3_3/jobrunnerdaemon_rb.html +191 -0
  583. data/doc/files/lib/rq-2_3_3/lister_rb.html +186 -0
  584. data/doc/files/lib/rq-2_3_3/locker_rb.html +187 -0
  585. data/doc/files/lib/rq-2_3_3/logging_rb.html +190 -0
  586. data/doc/files/lib/rq-2_3_3/mainhelper_rb.html +188 -0
  587. data/doc/files/lib/rq-2_3_3/orderedautohash_rb.html +188 -0
  588. data/doc/files/lib/rq-2_3_3/orderedhash_rb.html +138 -0
  589. data/doc/files/lib/rq-2_3_3/qdb_rb.html +193 -0
  590. data/doc/files/lib/rq-2_3_3/querier_rb.html +186 -0
  591. data/doc/files/lib/rq-2_3_3/recoverer_rb.html +186 -0
  592. data/doc/files/lib/rq-2_3_3/refresher_rb.html +179 -0
  593. data/doc/files/lib/rq-2_3_3/relayer_rb.html +190 -0
  594. data/doc/files/lib/rq-2_3_3/resubmitter_rb.html +187 -0
  595. data/doc/files/lib/rq-2_3_3/rotater_rb.html +187 -0
  596. data/doc/files/lib/rq-2_3_3/sleepcycle_rb.html +179 -0
  597. data/doc/files/lib/rq-2_3_3/snapshotter_rb.html +186 -0
  598. data/doc/files/lib/rq-2_3_3/statuslister_rb.html +186 -0
  599. data/doc/files/lib/rq-2_3_3/submitter_rb.html +187 -0
  600. data/doc/files/lib/rq-2_3_3/updater_rb.html +186 -0
  601. data/doc/files/lib/rq-2_3_3/usage_rb.html +186 -0
  602. data/doc/files/lib/rq-2_3_3/util_rb.html +188 -0
  603. data/doc/files/lib/rq-3_0_0/backer_rb.html +194 -0
  604. data/doc/files/lib/rq-3_0_0/configfile_rb.html +194 -0
  605. data/doc/files/lib/rq-3_0_0/configurator_rb.html +194 -0
  606. data/doc/files/lib/rq-3_0_0/creator_rb.html +194 -0
  607. data/doc/files/lib/rq-3_0_0/cron_rb.html +194 -0
  608. data/doc/files/lib/rq-3_0_0/defaultconfig_txt.html +110 -0
  609. data/doc/files/lib/rq-3_0_0/deleter_rb.html +194 -0
  610. data/doc/files/lib/rq-3_0_0/executor_rb.html +194 -0
  611. data/doc/files/lib/rq-3_0_0/feeder_rb.html +199 -0
  612. data/doc/files/lib/rq-3_0_0/ioviewer_rb.html +194 -0
  613. data/doc/files/lib/rq-3_0_0/job_rb.html +197 -0
  614. data/doc/files/lib/rq-3_0_0/jobqueue_rb.html +200 -0
  615. data/doc/files/lib/rq-3_0_0/jobrunner_rb.html +196 -0
  616. data/doc/files/lib/rq-3_0_0/jobrunnerdaemon_rb.html +199 -0
  617. data/doc/files/lib/rq-3_0_0/lister_rb.html +194 -0
  618. data/doc/files/lib/rq-3_0_0/locker_rb.html +195 -0
  619. data/doc/files/lib/rq-3_0_0/logging_rb.html +198 -0
  620. data/doc/files/lib/rq-3_0_0/mainhelper_rb.html +196 -0
  621. data/doc/files/lib/rq-3_0_0/orderedautohash_rb.html +196 -0
  622. data/doc/files/lib/rq-3_0_0/orderedhash_rb.html +138 -0
  623. data/doc/files/lib/rq-3_0_0/qdb_rb.html +201 -0
  624. data/doc/files/lib/rq-3_0_0/querier_rb.html +194 -0
  625. data/doc/files/lib/rq-3_0_0/recoverer_rb.html +194 -0
  626. data/doc/files/lib/rq-3_0_0/refresher_rb.html +187 -0
  627. data/doc/files/lib/rq-3_0_0/relayer_rb.html +198 -0
  628. data/doc/files/lib/rq-3_0_0/resource_rb.html +194 -0
  629. data/doc/files/lib/rq-3_0_0/resourcemanager_rb.html +187 -0
  630. data/doc/files/lib/rq-3_0_0/resubmitter_rb.html +195 -0
  631. data/doc/files/lib/rq-3_0_0/rotater_rb.html +195 -0
  632. data/doc/files/lib/rq-3_0_0/sleepcycle_rb.html +187 -0
  633. data/doc/files/lib/rq-3_0_0/snapshotter_rb.html +194 -0
  634. data/doc/files/lib/rq-3_0_0/sqlite_rb.html +160 -0
  635. data/doc/files/lib/rq-3_0_0/statuslister_rb.html +194 -0
  636. data/doc/files/lib/rq-3_0_0/submitter_rb.html +195 -0
  637. data/doc/files/lib/rq-3_0_0/toucher_rb.html +195 -0
  638. data/doc/files/lib/rq-3_0_0/updater_rb.html +194 -0
  639. data/doc/files/lib/rq-3_0_0/usage_rb.html +194 -0
  640. data/doc/files/lib/rq-3_0_0/util_rb.html +196 -0
  641. data/doc/files/lib/rq_rb.html +244 -0
  642. data/doc/fr_class_index.html +73 -0
  643. data/doc/fr_file_index.html +71 -0
  644. data/doc/fr_method_index.html +323 -0
  645. data/doc/index.html +24 -0
  646. data/doc/rdoc-style.css +172 -0
  647. data/extconf.rb +150 -0
  648. data/gemspec.rb +32 -0
  649. data/install.rb +75 -8
  650. data/lib/{rq-0.1.7.rb → rq-3.0.0.rb} +52 -10
  651. data/lib/{rq-0.1.7 → rq-3.0.0}/backer.rb +11 -7
  652. data/lib/{rq-0.1.7 → rq-3.0.0}/configfile.rb +21 -17
  653. data/lib/{rq-0.1.7 → rq-3.0.0}/configurator.rb +10 -6
  654. data/lib/rq-3.0.0/creator.rb +46 -0
  655. data/lib/rq-3.0.0/cron.rb +125 -0
  656. data/lib/{rq-0.1.7 → rq-3.0.0}/defaultconfig.txt +0 -0
  657. data/lib/rq-3.0.0/deleter.rb +51 -0
  658. data/lib/rq-3.0.0/executor.rb +40 -0
  659. data/lib/{rq-0.1.7 → rq-3.0.0}/feeder.rb +245 -91
  660. data/lib/rq-3.0.0/i686-linux/_sqlite.so +0 -0
  661. data/lib/rq-3.0.0/ioviewer.rb +48 -0
  662. data/lib/rq-3.0.0/job.rb +51 -0
  663. data/lib/rq-3.0.0/jobqueue.rb +899 -0
  664. data/lib/rq-3.0.0/jobrunner.rb +104 -0
  665. data/lib/{rq-0.1.7 → rq-3.0.0}/jobrunnerdaemon.rb +41 -27
  666. data/lib/rq-3.0.0/lister.rb +47 -0
  667. data/lib/rq-3.0.0/local/bin/sqlite +0 -0
  668. data/lib/rq-3.0.0/local/include/sqlite.h +868 -0
  669. data/lib/rq-3.0.0/local/lib/libsqlite.a +0 -0
  670. data/lib/rq-3.0.0/local/lib/libsqlite.la +35 -0
  671. data/lib/rq-3.0.0/local/lib/libsqlite.so +0 -0
  672. data/lib/rq-3.0.0/local/lib/libsqlite.so.0 +0 -0
  673. data/lib/rq-3.0.0/local/lib/libsqlite.so.0.8.6 +0 -0
  674. data/lib/rq-3.0.0/local/lib/pkgconfig/sqlite.pc +12 -0
  675. data/lib/{rq-0.1.7 → rq-3.0.0}/locker.rb +12 -6
  676. data/lib/{rq-0.1.7 → rq-3.0.0}/logging.rb +49 -42
  677. data/lib/rq-3.0.0/mainhelper.rb +184 -0
  678. data/lib/rq-3.0.0/orderedautohash.rb +39 -0
  679. data/lib/rq-3.0.0/orderedhash.rb +240 -0
  680. data/lib/{rq-0.1.7 → rq-3.0.0}/qdb.rb +183 -84
  681. data/lib/rq-3.0.0/querier.rb +98 -0
  682. data/lib/rq-3.0.0/recoverer.rb +28 -0
  683. data/lib/{rq-0.1.7 → rq-3.0.0}/refresher.rb +16 -8
  684. data/lib/rq-3.0.0/relayer.rb +283 -0
  685. data/lib/rq-3.0.0/resource.rb +22 -0
  686. data/lib/rq-3.0.0/resourcemanager.rb +40 -0
  687. data/lib/rq-3.0.0/resubmitter.rb +96 -0
  688. data/lib/rq-3.0.0/rotater.rb +98 -0
  689. data/lib/{rq-0.1.7 → rq-3.0.0}/sleepcycle.rb +14 -14
  690. data/lib/rq-3.0.0/snapshotter.rb +40 -0
  691. data/lib/rq-3.0.0/sqlite.rb +293 -0
  692. data/lib/rq-3.0.0/statuslister.rb +48 -0
  693. data/lib/rq-3.0.0/submitter.rb +109 -0
  694. data/lib/rq-3.0.0/toucher.rb +177 -0
  695. data/lib/rq-3.0.0/updater.rb +95 -0
  696. data/lib/rq-3.0.0/usage.rb +1157 -0
  697. data/lib/{rq-0.1.7 → rq-3.0.0}/util.rb +74 -56
  698. data/lib/rq.rb +52 -12
  699. data/rdoc.sh +17 -0
  700. data/rq +3 -1
  701. data/white_box/joblist +8 -0
  702. metadata +779 -96
  703. data/DEPENDS +0 -5
  704. data/HISTORY +0 -26
  705. data/VERSION +0 -1
  706. data/bin/rq-0.1.7 +0 -410
  707. data/lib/rq-0.1.7/creator.rb +0 -23
  708. data/lib/rq-0.1.7/deleter.rb +0 -39
  709. data/lib/rq-0.1.7/executor.rb +0 -41
  710. data/lib/rq-0.1.7/job.rb +0 -51
  711. data/lib/rq-0.1.7/jobqueue.rb +0 -432
  712. data/lib/rq-0.1.7/jobrunner.rb +0 -63
  713. data/lib/rq-0.1.7/lister.rb +0 -22
  714. data/lib/rq-0.1.7/mainhelper.rb +0 -53
  715. data/lib/rq-0.1.7/querier.rb +0 -33
  716. data/lib/rq-0.1.7/snapshotter.rb +0 -25
  717. data/lib/rq-0.1.7/statuslister.rb +0 -22
  718. data/lib/rq-0.1.7/submitter.rb +0 -90
  719. data/lib/rq-0.1.7/updater.rb +0 -95
  720. data/lib/rq-0.1.7/usage.rb +0 -609
  721. data/rdoc.cmd +0 -2
  722. data/rq.gemspec +0 -36
  723. 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>&nbsp;&nbsp;
175
+ <a href="#M000290">abort_transaction</a>&nbsp;&nbsp;
176
+ <a href="#M000295">attributes</a>&nbsp;&nbsp;
177
+ <a href="#M000262">create</a>&nbsp;&nbsp;
178
+ <a href="#M000276">delete</a>&nbsp;&nbsp;
179
+ <a href="#M000286">execute</a>&nbsp;&nbsp;
180
+ <a href="#M000282">getdeadjobs</a>&nbsp;&nbsp;
181
+ <a href="#M000279">getjob</a>&nbsp;&nbsp;
182
+ <a href="#M000287">integrity_check</a>&nbsp;&nbsp;
183
+ <a href="#M000283">jobisdead</a>&nbsp;&nbsp;
184
+ <a href="#M000281">jobisdone</a>&nbsp;&nbsp;
185
+ <a href="#M000280">jobisrunning</a>&nbsp;&nbsp;
186
+ <a href="#M000273">list</a>&nbsp;&nbsp;
187
+ <a href="#M000289">lock</a>&nbsp;&nbsp;
188
+ <a href="#M000293">mtime</a>&nbsp;&nbsp;
189
+ <a href="#M000263">new</a>&nbsp;&nbsp;
190
+ <a href="#M000275">query</a>&nbsp;&nbsp;
191
+ <a href="#M000288">recover!</a>&nbsp;&nbsp;
192
+ <a href="#M000271">resubmit</a>&nbsp;&nbsp;
193
+ <a href="#M000285">ro_transaction</a>&nbsp;&nbsp;
194
+ <a href="#M000291">rollback_transaction</a>&nbsp;&nbsp;
195
+ <a href="#M000292">snapshot</a>&nbsp;&nbsp;
196
+ <a href="#M000269">standard_err_4</a>&nbsp;&nbsp;
197
+ <a href="#M000265">standard_in_4</a>&nbsp;&nbsp;
198
+ <a href="#M000267">standard_out_4</a>&nbsp;&nbsp;
199
+ <a href="#M000274">status</a>&nbsp;&nbsp;
200
+ <a href="#M000268">stderr4</a>&nbsp;&nbsp;
201
+ <a href="#M000264">stdin4</a>&nbsp;&nbsp;
202
+ <a href="#M000266">stdout4</a>&nbsp;&nbsp;
203
+ <a href="#M000270">submit</a>&nbsp;&nbsp;
204
+ <a href="#M000272">tmp_stdin</a>&nbsp;&nbsp;
205
+ <a href="#M000284">transaction</a>&nbsp;&nbsp;
206
+ <a href="#M000278">update</a>&nbsp;&nbsp;
207
+ <a href="#M000277">vacuum</a>&nbsp;&nbsp;
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">&nbsp;[R]&nbsp;</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">&nbsp;[R]&nbsp;</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">&nbsp;[R]&nbsp;</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">&nbsp;[R]&nbsp;</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">&nbsp;[R]&nbsp;</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">&nbsp;[R]&nbsp;</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">&nbsp;[R]&nbsp;</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">&quot;q &lt;#{ @path }&gt; does not exist&quot;</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">&quot;q &lt;#{ @path }&gt; is not a directory&quot;</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">&gt;</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">&quot;select count(*) from attributes where key='#{ key }';&quot;</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">&quot;insert into attributes values('#{ key }','#{ value }');&quot;</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">&quot;update attributes set key='#{ key }', value='#{ value }' where key='#{ key }';&quot;</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">&quot;key &lt;#{ key }&gt; has become corrupt!&quot;</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,&amp;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">&amp;</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">&amp;</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">&quot;select * from attributes;&quot;</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, &amp;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">&amp;</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">&lt;&lt;</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">&quot;#{ what }&quot;</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">&lt;&lt;</span> <span class="ruby-node">&quot;delete from jobs where jid=#{ what } and state!='running';\n&quot;</span>
502
+ 522: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;select * from jobs where jid=#{ what } and state!='running';\n&quot;</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">&lt;&lt;</span> <span class="ruby-value str">&quot;delete from jobs where state='pending';\n&quot;</span>
505
+ 525: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;select * from jobs where state='pending';\n&quot;</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">&lt;&lt;</span> <span class="ruby-value str">&quot;delete from jobs where state='holding';\n&quot;</span>
508
+ 528: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;select * from jobs where state='holding';\n&quot;</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">&lt;&lt;</span> <span class="ruby-value str">&quot;delete from jobs where state='running';\n&quot;</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">&lt;&lt;</span> <span class="ruby-value str">&quot;select * from jobs where state='running';\n&quot;</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">&lt;&lt;</span> <span class="ruby-value str">&quot;delete from jobs where state='finished';\n&quot;</span>
514
+ 534: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;select * from jobs where state='finished';\n&quot;</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">&lt;&lt;</span> <span class="ruby-value str">&quot;delete from jobs where state='dead';\n&quot;</span>
517
+ 537: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;select * from jobs where state='dead';\n&quot;</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">&lt;&lt;</span> <span class="ruby-value str">&quot;delete from jobs where state!='running';\n&quot;</span>
520
+ 540: <span class="ruby-identifier">select_sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;select * from jobs where state!='running';\n&quot;</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">&quot;cannot delete &lt;#{ what.inspect }&gt;&quot;</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">&lt;&lt;</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">&amp;</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, &amp;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">&amp;</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">&amp;</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, &amp;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">&amp;</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">&quot;select * from jobs\nwhere\nstate = 'running' and\nrunner='\#{ Util::hostname }' and\nstarted&lt;='\#{ started }'\n&quot;</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">&amp;</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">&quot;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&quot;</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, &amp;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">&amp;</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">&amp;</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">&quot;update jobs set state='dead' where jid='#{ jid }'&quot;</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">&quot;update jobs\nset\nstate = '\#{ job['state'] }',\nexit_status = '\#{ job['exit_status'] }',\nfinished = '\#{ job['finished'] }',\nelapsed = '\#{ job['elapsed'] }'\nwhere jid = \#{ job['jid'] };\n&quot;</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">&quot;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&quot;</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, &amp;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">&amp;</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">&lt;&lt;</span> <span class="ruby-node">&quot;jid=#{ what }\n&quot;</span>
804
+ 275: <span class="ruby-keyword kw">else</span>
805
+ 276: <span class="ruby-identifier">what</span> = <span class="ruby-node">&quot;#{ what }&quot;</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">&lt;&lt;</span> <span class="ruby-node">&quot;jid=#{ QDB::q what }\n&quot;</span>
808
+ 279: <span class="ruby-keyword kw">else</span>
809
+ 280: <span class="ruby-identifier">where_clauses</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;state=#{ QDB::q what }\n&quot;</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">&quot; or \n&quot;</span>)
815
+ 286:
816
+ 287: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">&quot;select * from jobs\nwhere \#{ where_clause }\n&quot;</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">&amp;</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, &amp;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">&amp;</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">&amp;</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, &amp;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">&amp;</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,''); &quot;like '%#{ q }%'&quot;}</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,''); &quot;='#{ q }'&quot;}</span>
915
+ 490:
916
+ 491: <span class="ruby-node">&quot;select * from jobs where #{ where_clause };&quot;</span>
917
+ 492: <span class="ruby-keyword kw">else</span>
918
+ 493: <span class="ruby-value str">&quot;select * from jobs;&quot;</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">&amp;</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, &amp;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">&amp;</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">&amp;</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, &amp;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">&amp;</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">&quot;no jid for job &lt;#{ job.inspect }&gt;&quot;</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">&quot;no command for job &lt;#{ job.inspect }&gt;&quot;</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">&quot;#{ f }=#{ QDB::q(tuple[ f ]) }&quot;</span>}
1005
+ 187: <span class="ruby-identifier">sql</span> = <span class="ruby-node">&quot;update jobs set #{ kvs.join ',' } where jid=#{ jid };\n&quot;</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">&quot;select * from jobs where jid = '#{ jid }'&quot;</span>
1016
+ 198: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-operator">&amp;</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,&amp;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">&amp;</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">&amp;</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 = &quot;#{ @basename }.snapshot&quot;, 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">&quot;#{ @basename }.snapshot&quot;</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">&quot;#{ @basename }.snapshot&quot;</span>
1109
+ 824: <span class="ruby-identifier">debug</span>{ <span class="ruby-node">&quot;snapshot &lt;#{ @path }&gt; -&gt; &lt;#{ qtmp }&gt;&quot;</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">&quot;retries &lt;#{ retries }&gt;&quot;</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">&quot;cp &lt;#{ src }&gt; -&gt; &lt;#{ dest }&gt;&quot;</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">&gt;=</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">&quot;snapshot &lt;#{ qtmp }&gt; created&quot;</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">&quot;failure &lt;#{ loopno + 1}&gt; of &lt;#{ retries }&gt; attempts to create snapshot &lt;#{ qtmp }&gt; - retrying...&quot;</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">&quot;locking &lt;#{ @path }&gt; as last resort&quot;</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">&quot;snapshot &lt;#{ qtmp }&gt; created&quot;</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">&quot;failed &lt;#{ loopno }&gt; times to create snapshot &lt;#{ qtmp }&gt;&quot;</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">&gt;</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">&quot;#{ '%2.2d' % sh }h#{ '%2.2d' % sm }m#{ '%05.2f' % ss }s&quot;</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">&quot;select count(*) from jobs\nwhere\nstate='\#{ state }'\n&quot;</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">&quot;select min(\#{ metric }) as max, max(\#{ metric }) as min\nfrom jobs where state='\#{ state }'\n&quot;</span>
1303
+ 350: <span class="ruby-keyword kw">else</span>
1304
+ 351: <span class="ruby-value str">&quot;select min(\#{ metric }) as min, max(\#{ metric }) as max\nfrom jobs where state='\#{ state }'\n&quot;</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">&quot;select jid from jobs where \#{ metric }='\#{ t }' and state='\#{ state }'\n&quot;</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">&quot;select avg(elapsed) from jobs\nwhere\nstate='finished'\n&quot;</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">&lt;&lt;</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">&lt;&lt;</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">&quot;select count(*) from jobs\nwhere\nstate = 'finished' and\nfinished &gt; '\#{ ago }'\n&quot;</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'][&quot;n_jobs_in_last_#{ n }_hrs&quot;] = count</span>
1351
+ 398: <span class="ruby-identifier">stats</span>[<span class="ruby-value str">'performance'</span>][<span class="ruby-value str">&quot;n_jobs_in_last_hrs&quot;</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">&quot;select count(*) from jobs\nwhere\nstate='finished' and\nexit_status=0\n&quot;</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">&quot;select count(*) from jobs\nwhere\n(state='finished' and\nexit_status!=0) or\nstate='dead'\n&quot;</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">&quot;exit_status=#{ code }&quot;</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">&quot;select count(*) from jobs\nwhere\n(state='finished' and (\#{ exit_status_clause }))\n&quot;</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">&quot;stderr/#{ jid }&quot;</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">&quot;stdin/#{ jid }&quot;</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">&quot;stdout/#{ jid }&quot;</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, &amp;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">&amp;</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">&quot;select max(jid) from jobs&quot;</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">&quot;no command for job &lt;#{ job.inspect }&gt;&quot;</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">&quot;insert into jobs values (#{ values.join ',' });\n&quot;</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">&quot;select * from jobs where jid = '#{ jid }'&quot;</span>
1521
+ 146: <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-operator">&amp;</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">&quot;#{ Process::pid }_#{ rand }&quot;</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">&quot;cannot upgrade ro_transaction&quot;</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, &amp;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">&amp;</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">&quot;update of &lt;state&gt; = &lt;#{ state }&gt; not allowed (try pending or holding)&quot;</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">&quot;update of &lt;#{ key }&gt; = &lt;#{ val }&gt; not allowed&quot;</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">&quot;no jobs to update&quot;</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">&quot;select jid from jobs where state='pending'&quot;</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">&lt;&lt;</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">&quot;select jid from jobs where state='holding'&quot;</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">&lt;&lt;</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">&quot;no jobs to update&quot;</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">&quot;#{ k }='#{ v }'&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-node">&quot;#{ k }=NULL&quot;</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;,\n&quot;</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">&quot;jid=#{ jid }&quot;</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot; or\n&quot;</span>)
1700
+ 640: <span class="ruby-identifier">update_sql</span> =
1701
+ 641: <span class="ruby-value str">&quot;update jobs\n&quot;</span> <span class="ruby-operator">&lt;&lt;</span>
1702
+ 642: <span class="ruby-node">&quot;set\n#{ update_clause }\n&quot;</span> <span class="ruby-operator">&lt;&lt;</span>
1703
+ 643: <span class="ruby-node">&quot;where\n(state='pending' or state='holding') and\n(#{ where_clause })&quot;</span>
1704
+ 644: <span class="ruby-identifier">select_sql</span> = <span class="ruby-node">&quot;select * from jobs where (state='pending' or state='holding') and\n(#{ where_clause })&quot;</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">&lt;&lt;</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">&amp;</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>