/testsuite/TestCobaltClients/test_files/qsub_test.py

https://github.com/benmcclelland/cobalt · Python · 5888 lines · 5869 code · 5 blank · 14 comment · 0 complexity · e5f1db594171dc0842e1c36c25b2834b MD5 · raw file

  1. import testutils
  2. # ---------------------------------------------------------------------------------
  3. def test_qsub_all_options_1():
  4. """
  5. qsub test run: all_options_1
  6. """
  7. args = """-v -A myproj --attrs=a=1:b=2 --cwd /tmp -d --debuglog=/tmp/d --dependencies=1:2:3 -e /tmp/e --env v1=1:v2=2 --geometry 198x198x198x198 -h -i /bin/ls -M myemal@gmail.com -n10 -o /tmp/o -O /tmp --proccount 10 -qqueue --run_users user1:user2:user3 --run_project -t 10 --mode script --kernel kernel -K kopts /bin/ls"""
  8. cmdout = \
  9. """1
  10. """
  11. cmderr = \
  12. """
  13. qsub.py -v -A myproj --attrs=a=1:b=2 --cwd /tmp -d --debuglog=/tmp/d --dependencies=1:2:3 -e /tmp/e --env v1=1:v2=2 --geometry 198x198x198x198 -h -i /bin/ls -M myemal@gmail.com -n10 -o /tmp/o -O /tmp --proccount 10 -qqueue --run_users user1:user2:user3 --run_project -t 10 --mode script --kernel kernel -K kopts /bin/ls
  14. component: "queue-manager.get_jobs", defer: True
  15. get_jobs(
  16. [{'jobid': 1}, {'jobid': 3}, {'jobid': 2}],
  17. )
  18. component: "system.validate_job", defer: False
  19. validate_job(
  20. {'kernel': 'kernel', 'verbose': True, 'held': True, 'notify': 'myemal@gmail.com', 'ion_kerneloptions': False, 'project': 'myproj', 'preemptable': False, 'forcenoval': False, 'umask': False, 'version': False, 'env': 'v1=1:v2=2', 'cwd': '/tmp', 'run_project': True, 'outputprefix': '/tmp', 'kerneloptions': 'kopts', 'time': '10', 'jobname': False, 'debug': True, 'dependencies': '1:2:3', 'debuglog': '/tmp/d', 'ion_kernel': 'default', 'proccount': '10', 'disable_preboot': False, 'geometry': '198x198x198x198', 'queue': 'queue', 'mode': 'script', 'error': '/tmp/e', 'nodecount': '10', 'output': '/tmp/o', 'inputfile': '/bin/ls', 'attrs': {'a': '1', 'b': '2'}, 'user_list': 'user1:user2:user3', 'interactive': False},
  21. )
  22. component: "queue-manager.add_jobs", defer: False
  23. add_jobs(
  24. [{'kernel': 'kernel', 'errorpath': '/tmp/e', 'outputpath': '/tmp/o', 'tag': 'job', 'notify': 'myemal@gmail.com', 'outputdir': '/tmp', 'queue': 'queue', 'envs': {'v1': '1', 'v2': '2'}, 'umask': 18, 'nodes': 10, 'cwd': '/tmp', 'run_project': True, 'kerneloptions': 'kopts', 'args': [], 'cobalt_log_file': '/tmp/d', 'user': 'gooduser', 'path': '/tmp', 'ion_kernel': 'default', 'procs': '10', 'walltime': '10', 'geometry': [198, 198, 198, 198, 2], 'user_hold': True, 'jobid': '*', 'project': 'myproj', 'script_preboot': True, 'command': '/bin/ls', 'mode': 'script', 'all_dependencies': '1:2:3', 'attrs': {'a': '1', 'b': '2'}, 'user_list': ['gooduser', 'user1', 'user2', 'user3'], 'inputfile': '/bin/ls'}],
  25. )
  26. Environment Vars: {'v1': '1', 'v2': '2'}
  27. """
  28. stubout = \
  29. """
  30. GET_JOBS
  31. jobid:1
  32. jobid type: <type 'int'>
  33. jobid:3
  34. jobid type: <type 'int'>
  35. jobid:2
  36. jobid type: <type 'int'>
  37. ADD_JOBS
  38. all_dependencies:1:2:3
  39. all_dependencies type: <type 'str'>
  40. args:[]
  41. args type: <type 'list'>
  42. attrs:{'a': '1', 'b': '2'}
  43. attrs type: <type 'dict'>
  44. cobalt_log_file:/tmp/d
  45. cobalt_log_file type: <type 'str'>
  46. command:/bin/ls
  47. command type: <type 'str'>
  48. cwd:/tmp
  49. cwd type: <type 'str'>
  50. envs:{'v1': '1', 'v2': '2'}
  51. envs type: <type 'dict'>
  52. errorpath:/tmp/e
  53. errorpath type: <type 'str'>
  54. geometry:[198, 198, 198, 198, 2]
  55. geometry type: <type 'list'>
  56. inputfile:/bin/ls
  57. inputfile type: <type 'str'>
  58. ion_kernel:default
  59. ion_kernel type: <type 'str'>
  60. jobid:*
  61. jobid type: <type 'str'>
  62. kernel:kernel
  63. kernel type: <type 'str'>
  64. kerneloptions:kopts
  65. kerneloptions type: <type 'str'>
  66. mode:script
  67. mode type: <type 'str'>
  68. nodes:10
  69. nodes type: <type 'int'>
  70. notify:myemal@gmail.com
  71. notify type: <type 'str'>
  72. outputdir:/tmp
  73. outputdir type: <type 'str'>
  74. outputpath:/tmp/o
  75. outputpath type: <type 'str'>
  76. path:/tmp
  77. path type: <type 'str'>
  78. procs:10
  79. procs type: <type 'str'>
  80. project:myproj
  81. project type: <type 'str'>
  82. queue:queue
  83. queue type: <type 'str'>
  84. run_project:True
  85. run_project type: <type 'bool'>
  86. script_preboot:True
  87. script_preboot type: <type 'bool'>
  88. tag:job
  89. tag type: <type 'str'>
  90. umask:18
  91. umask type: <type 'int'>
  92. user:gooduser
  93. user type: <type 'str'>
  94. user_hold:True
  95. user_hold type: <type 'bool'>
  96. user_list:['gooduser', 'user1', 'user2', 'user3']
  97. user_list type: <type 'list'>
  98. walltime:10
  99. walltime type: <type 'str'>
  100. VALIDATE_JOB
  101. attrs:{'a': '1', 'b': '2'}
  102. attrs type: <type 'dict'>
  103. cwd:/tmp
  104. cwd type: <type 'str'>
  105. debug:True
  106. debug type: <type 'bool'>
  107. debuglog:/tmp/d
  108. debuglog type: <type 'str'>
  109. dependencies:1:2:3
  110. dependencies type: <type 'str'>
  111. disable_preboot:False
  112. disable_preboot type: <type 'bool'>
  113. env:v1=1:v2=2
  114. env type: <type 'str'>
  115. error:/tmp/e
  116. error type: <type 'str'>
  117. forcenoval:False
  118. forcenoval type: <type 'bool'>
  119. geometry:198x198x198x198
  120. geometry type: <type 'str'>
  121. held:True
  122. held type: <type 'bool'>
  123. inputfile:/bin/ls
  124. inputfile type: <type 'str'>
  125. interactive:False
  126. interactive type: <type 'bool'>
  127. ion_kernel:default
  128. ion_kernel type: <type 'str'>
  129. ion_kerneloptions:False
  130. ion_kerneloptions type: <type 'bool'>
  131. jobname:False
  132. jobname type: <type 'bool'>
  133. kernel:kernel
  134. kernel type: <type 'str'>
  135. kerneloptions:kopts
  136. kerneloptions type: <type 'str'>
  137. mode:script
  138. mode type: <type 'str'>
  139. nodecount:10
  140. nodecount type: <type 'str'>
  141. notify:myemal@gmail.com
  142. notify type: <type 'str'>
  143. output:/tmp/o
  144. output type: <type 'str'>
  145. outputprefix:/tmp
  146. outputprefix type: <type 'str'>
  147. preemptable:False
  148. preemptable type: <type 'bool'>
  149. proccount:10
  150. proccount type: <type 'str'>
  151. project:myproj
  152. project type: <type 'str'>
  153. queue:queue
  154. queue type: <type 'str'>
  155. run_project:True
  156. run_project type: <type 'bool'>
  157. time:10
  158. time type: <type 'str'>
  159. umask:False
  160. umask type: <type 'bool'>
  161. user_list:user1:user2:user3
  162. user_list type: <type 'str'>
  163. verbose:True
  164. verbose type: <type 'bool'>
  165. version:False
  166. version type: <type 'bool'>
  167. """
  168. stubout_file = "stub.out"
  169. expected_results = (
  170. 0, # Expected return status
  171. cmdout, # Expected command output
  172. stubout, # Expected stub functions output
  173. cmderr, # Expected command error output
  174. )
  175. testutils.save_testhook("")
  176. results = testutils.run_cmd('qsub.py',args,stubout_file)
  177. result = testutils.validate_results(results,expected_results)
  178. testutils.remove_testhook()
  179. correct = 1
  180. assert result == correct, "Result:\n%s" % result
  181. # ---------------------------------------------------------------------------------
  182. def test_qsub_misc_1():
  183. """
  184. qsub test run: misc_1
  185. """
  186. args = """--mode script -n 512 --env BG_COREDUMPDISABLED=1 --proccount 512 -t 30 -q testing /bin/ls"""
  187. cmdout = \
  188. """1
  189. """
  190. cmderr = ''
  191. stubout = \
  192. """
  193. ADD_JOBS
  194. args:[]
  195. args type: <type 'list'>
  196. command:/bin/ls
  197. command type: <type 'str'>
  198. cwd:/tmp
  199. cwd type: <type 'str'>
  200. envs:{'BG_COREDUMPDISABLED': '1'}
  201. envs type: <type 'dict'>
  202. ion_kernel:default
  203. ion_kernel type: <type 'str'>
  204. jobid:*
  205. jobid type: <type 'str'>
  206. kernel:default
  207. kernel type: <type 'str'>
  208. mode:script
  209. mode type: <type 'str'>
  210. nodes:512
  211. nodes type: <type 'int'>
  212. outputdir:/tmp
  213. outputdir type: <type 'str'>
  214. path:/tmp
  215. path type: <type 'str'>
  216. procs:512
  217. procs type: <type 'str'>
  218. queue:testing
  219. queue type: <type 'str'>
  220. run_project:False
  221. run_project type: <type 'bool'>
  222. script_preboot:True
  223. script_preboot type: <type 'bool'>
  224. tag:job
  225. tag type: <type 'str'>
  226. umask:18
  227. umask type: <type 'int'>
  228. user:gooduser
  229. user type: <type 'str'>
  230. user_list:['gooduser']
  231. user_list type: <type 'list'>
  232. walltime:30
  233. walltime type: <type 'str'>
  234. VALIDATE_JOB
  235. attrs:{}
  236. attrs type: <type 'dict'>
  237. cwd:/tmp
  238. cwd type: <type 'str'>
  239. debug:False
  240. debug type: <type 'bool'>
  241. debuglog:False
  242. debuglog type: <type 'bool'>
  243. dependencies:False
  244. dependencies type: <type 'bool'>
  245. disable_preboot:False
  246. disable_preboot type: <type 'bool'>
  247. env:BG_COREDUMPDISABLED=1
  248. env type: <type 'str'>
  249. error:False
  250. error type: <type 'bool'>
  251. forcenoval:False
  252. forcenoval type: <type 'bool'>
  253. geometry:False
  254. geometry type: <type 'bool'>
  255. held:False
  256. held type: <type 'bool'>
  257. inputfile:False
  258. inputfile type: <type 'bool'>
  259. interactive:False
  260. interactive type: <type 'bool'>
  261. ion_kernel:default
  262. ion_kernel type: <type 'str'>
  263. ion_kerneloptions:False
  264. ion_kerneloptions type: <type 'bool'>
  265. jobname:False
  266. jobname type: <type 'bool'>
  267. kernel:default
  268. kernel type: <type 'str'>
  269. kerneloptions:False
  270. kerneloptions type: <type 'bool'>
  271. mode:script
  272. mode type: <type 'str'>
  273. nodecount:512
  274. nodecount type: <type 'str'>
  275. notify:False
  276. notify type: <type 'bool'>
  277. output:False
  278. output type: <type 'bool'>
  279. outputprefix:False
  280. outputprefix type: <type 'bool'>
  281. preemptable:False
  282. preemptable type: <type 'bool'>
  283. proccount:512
  284. proccount type: <type 'str'>
  285. project:False
  286. project type: <type 'bool'>
  287. queue:testing
  288. queue type: <type 'str'>
  289. run_project:False
  290. run_project type: <type 'bool'>
  291. time:30
  292. time type: <type 'str'>
  293. umask:False
  294. umask type: <type 'bool'>
  295. user_list:False
  296. user_list type: <type 'bool'>
  297. verbose:False
  298. verbose type: <type 'bool'>
  299. version:False
  300. version type: <type 'bool'>
  301. """
  302. stubout_file = "stub.out"
  303. expected_results = (
  304. 0, # Expected return status
  305. cmdout, # Expected command output
  306. stubout, # Expected stub functions output
  307. cmderr, # Expected command error output
  308. )
  309. testutils.save_testhook("")
  310. results = testutils.run_cmd('qsub.py',args,stubout_file)
  311. result = testutils.validate_results(results,expected_results)
  312. testutils.remove_testhook()
  313. correct = 1
  314. assert result == correct, "Result:\n%s" % result
  315. # ---------------------------------------------------------------------------------
  316. def test_qsub_no_options_passed():
  317. """
  318. qsub test run: no_options_passed
  319. """
  320. args = """/bin/ls"""
  321. cmdout = \
  322. """Usage: qsub.py --help
  323. Usage: qsub.py [options] <executable> [<excutable options>]
  324. Refer to man pages for JOBID EXPANSION and SCRIPT JOB DIRECTIVES.
  325. """
  326. cmderr = \
  327. """No required options provided
  328. """
  329. stubout = ''
  330. stubout_file = "stub.out"
  331. expected_results = (
  332. 256, # Expected return status
  333. cmdout, # Expected command output
  334. stubout, # Expected stub functions output
  335. cmderr, # Expected command error output
  336. )
  337. testutils.save_testhook("")
  338. results = testutils.run_cmd('qsub.py',args,stubout_file)
  339. result = testutils.validate_results(results,expected_results)
  340. testutils.remove_testhook()
  341. correct = 1
  342. assert result == correct, "Result:\n%s" % result
  343. # ---------------------------------------------------------------------------------
  344. def test_qsub_non_existant_option():
  345. """
  346. qsub test run: non_existant_option
  347. """
  348. args = """-z -t10 -n10 /bin/ls"""
  349. cmdout = ''
  350. cmderr = \
  351. """Usage: qsub.py --help
  352. Usage: qsub.py [options] <executable> [<excutable options>]
  353. Refer to man pages for JOBID EXPANSION and SCRIPT JOB DIRECTIVES.
  354. qsub.py: error: no such option: -z
  355. """
  356. stubout = ''
  357. stubout_file = "stub.out"
  358. expected_results = (
  359. 512, # Expected return status
  360. cmdout, # Expected command output
  361. stubout, # Expected stub functions output
  362. cmderr, # Expected command error output
  363. )
  364. testutils.save_testhook("")
  365. results = testutils.run_cmd('qsub.py',args,stubout_file)
  366. result = testutils.validate_results(results,expected_results)
  367. testutils.remove_testhook()
  368. correct = 1
  369. assert result == correct, "Result:\n%s" % result
  370. # ---------------------------------------------------------------------------------
  371. def test_qsub_debug_flag_only_1():
  372. """
  373. qsub test run: debug_flag_only_1
  374. """
  375. args = """-d"""
  376. cmdout = \
  377. """Usage: qsub.py --help
  378. Usage: qsub.py [options] <executable> [<excutable options>]
  379. Refer to man pages for JOBID EXPANSION and SCRIPT JOB DIRECTIVES.
  380. """
  381. cmderr = \
  382. """
  383. qsub.py -d
  384. No executable or script specified
  385. """
  386. stubout = ''
  387. stubout_file = "stub.out"
  388. expected_results = (
  389. 256, # Expected return status
  390. cmdout, # Expected command output
  391. stubout, # Expected stub functions output
  392. cmderr, # Expected command error output
  393. )
  394. testutils.save_testhook("")
  395. results = testutils.run_cmd('qsub.py',args,stubout_file)
  396. result = testutils.validate_results(results,expected_results)
  397. testutils.remove_testhook()
  398. correct = 1
  399. assert result == correct, "Result:\n%s" % result
  400. # ---------------------------------------------------------------------------------
  401. def test_qsub_debug_flag_only_2():
  402. """
  403. qsub test run: debug_flag_only_2
  404. """
  405. args = """-debug"""
  406. cmdout = \
  407. """Usage: qsub.py --help
  408. Usage: qsub.py [options] <executable> [<excutable options>]
  409. Refer to man pages for JOBID EXPANSION and SCRIPT JOB DIRECTIVES.
  410. """
  411. cmderr = \
  412. """
  413. qsub.py -debug
  414. No executable or script specified
  415. """
  416. stubout = ''
  417. stubout_file = "stub.out"
  418. expected_results = (
  419. 256, # Expected return status
  420. cmdout, # Expected command output
  421. stubout, # Expected stub functions output
  422. cmderr, # Expected command error output
  423. )
  424. testutils.save_testhook("")
  425. results = testutils.run_cmd('qsub.py',args,stubout_file)
  426. result = testutils.validate_results(results,expected_results)
  427. testutils.remove_testhook()
  428. correct = 1
  429. assert result == correct, "Result:\n%s" % result
  430. # ---------------------------------------------------------------------------------
  431. def test_qsub_verbose_flag_only():
  432. """
  433. qsub test run: verbose_flag_only
  434. """
  435. args = """-v"""
  436. cmdout = \
  437. """Usage: qsub.py --help
  438. Usage: qsub.py [options] <executable> [<excutable options>]
  439. Refer to man pages for JOBID EXPANSION and SCRIPT JOB DIRECTIVES.
  440. """
  441. cmderr = \
  442. """No executable or script specified
  443. """
  444. stubout = ''
  445. stubout_file = "stub.out"
  446. expected_results = (
  447. 256, # Expected return status
  448. cmdout, # Expected command output
  449. stubout, # Expected stub functions output
  450. cmderr, # Expected command error output
  451. )
  452. testutils.save_testhook("")
  453. results = testutils.run_cmd('qsub.py',args,stubout_file)
  454. result = testutils.validate_results(results,expected_results)
  455. testutils.remove_testhook()
  456. correct = 1
  457. assert result == correct, "Result:\n%s" % result
  458. # ---------------------------------------------------------------------------------
  459. def test_qsub_non_integer_nodecount():
  460. """
  461. qsub test run: non_integer_nodecount
  462. """
  463. args = """--mode smp -t50 -nfive --geometry 40x40x50x50 /bin/ls"""
  464. cmdout = ''
  465. cmderr = \
  466. """Specifed mode 'smp' not valid, valid modes are
  467. co
  468. vn
  469. script
  470. interactive
  471. """
  472. stubout = ''
  473. stubout_file = "stub.out"
  474. expected_results = (
  475. 256, # Expected return status
  476. cmdout, # Expected command output
  477. stubout, # Expected stub functions output
  478. cmderr, # Expected command error output
  479. )
  480. testutils.save_testhook("")
  481. results = testutils.run_cmd('qsub.py',args,stubout_file)
  482. result = testutils.validate_results(results,expected_results)
  483. testutils.remove_testhook()
  484. correct = 1
  485. assert result == correct, "Result:\n%s" % result
  486. # ---------------------------------------------------------------------------------
  487. def test_qsub_non_realistic_nodecount():
  488. """
  489. qsub test run: non_realistic_nodecount
  490. """
  491. args = """--mode smp -t50 -n2048 --geometry 40x40x50x50x1 /bin/ls"""
  492. cmdout = ''
  493. cmderr = \
  494. """Specifed mode 'smp' not valid, valid modes are
  495. co
  496. vn
  497. script
  498. interactive
  499. """
  500. stubout = ''
  501. stubout_file = "stub.out"
  502. expected_results = (
  503. 256, # Expected return status
  504. cmdout, # Expected command output
  505. stubout, # Expected stub functions output
  506. cmderr, # Expected command error output
  507. )
  508. testutils.save_testhook("")
  509. results = testutils.run_cmd('qsub.py',args,stubout_file)
  510. result = testutils.validate_results(results,expected_results)
  511. testutils.remove_testhook()
  512. correct = 1
  513. assert result == correct, "Result:\n%s" % result
  514. # ---------------------------------------------------------------------------------
  515. def test_qsub_invalid_geometry_1():
  516. """
  517. qsub test run: invalid_geometry_1
  518. """
  519. args = """--mode script -t50 -n10 --geometry x /bin/ls"""
  520. cmdout = ''
  521. cmderr = \
  522. """Invalid geometry entered:
  523. """
  524. stubout = ''
  525. stubout_file = "stub.out"
  526. expected_results = (
  527. 256, # Expected return status
  528. cmdout, # Expected command output
  529. stubout, # Expected stub functions output
  530. cmderr, # Expected command error output
  531. )
  532. testutils.save_testhook("")
  533. results = testutils.run_cmd('qsub.py',args,stubout_file)
  534. result = testutils.validate_results(results,expected_results)
  535. testutils.remove_testhook()
  536. correct = 1
  537. assert result == correct, "Result:\n%s" % result
  538. # ---------------------------------------------------------------------------------
  539. def test_qsub_invalid_geometry_2():
  540. """
  541. qsub test run: invalid_geometry_2
  542. """
  543. args = """--mode script -t50 -n10 --geometry 1x2x3x4 /bin/ls"""
  544. cmdout = \
  545. """1
  546. """
  547. cmderr = ''
  548. stubout = \
  549. """
  550. ADD_JOBS
  551. args:[]
  552. args type: <type 'list'>
  553. command:/bin/ls
  554. command type: <type 'str'>
  555. cwd:/tmp
  556. cwd type: <type 'str'>
  557. geometry:[1, 2, 3, 4, 2]
  558. geometry type: <type 'list'>
  559. ion_kernel:default
  560. ion_kernel type: <type 'str'>
  561. jobid:*
  562. jobid type: <type 'str'>
  563. kernel:default
  564. kernel type: <type 'str'>
  565. mode:script
  566. mode type: <type 'str'>
  567. nodes:10
  568. nodes type: <type 'int'>
  569. outputdir:/tmp
  570. outputdir type: <type 'str'>
  571. path:/tmp
  572. path type: <type 'str'>
  573. procs:512
  574. procs type: <type 'str'>
  575. queue:default
  576. queue type: <type 'str'>
  577. run_project:False
  578. run_project type: <type 'bool'>
  579. script_preboot:True
  580. script_preboot type: <type 'bool'>
  581. tag:job
  582. tag type: <type 'str'>
  583. umask:18
  584. umask type: <type 'int'>
  585. user:gooduser
  586. user type: <type 'str'>
  587. user_list:['gooduser']
  588. user_list type: <type 'list'>
  589. walltime:50
  590. walltime type: <type 'str'>
  591. VALIDATE_JOB
  592. attrs:{}
  593. attrs type: <type 'dict'>
  594. cwd:/tmp
  595. cwd type: <type 'str'>
  596. debug:False
  597. debug type: <type 'bool'>
  598. debuglog:False
  599. debuglog type: <type 'bool'>
  600. dependencies:False
  601. dependencies type: <type 'bool'>
  602. disable_preboot:False
  603. disable_preboot type: <type 'bool'>
  604. env:False
  605. env type: <type 'bool'>
  606. error:False
  607. error type: <type 'bool'>
  608. forcenoval:False
  609. forcenoval type: <type 'bool'>
  610. geometry:1x2x3x4
  611. geometry type: <type 'str'>
  612. held:False
  613. held type: <type 'bool'>
  614. inputfile:False
  615. inputfile type: <type 'bool'>
  616. interactive:False
  617. interactive type: <type 'bool'>
  618. ion_kernel:default
  619. ion_kernel type: <type 'str'>
  620. ion_kerneloptions:False
  621. ion_kerneloptions type: <type 'bool'>
  622. jobname:False
  623. jobname type: <type 'bool'>
  624. kernel:default
  625. kernel type: <type 'str'>
  626. kerneloptions:False
  627. kerneloptions type: <type 'bool'>
  628. mode:script
  629. mode type: <type 'str'>
  630. nodecount:10
  631. nodecount type: <type 'str'>
  632. notify:False
  633. notify type: <type 'bool'>
  634. output:False
  635. output type: <type 'bool'>
  636. outputprefix:False
  637. outputprefix type: <type 'bool'>
  638. preemptable:False
  639. preemptable type: <type 'bool'>
  640. proccount:False
  641. proccount type: <type 'bool'>
  642. project:False
  643. project type: <type 'bool'>
  644. queue:default
  645. queue type: <type 'str'>
  646. run_project:False
  647. run_project type: <type 'bool'>
  648. time:50
  649. time type: <type 'str'>
  650. umask:False
  651. umask type: <type 'bool'>
  652. user_list:False
  653. user_list type: <type 'bool'>
  654. verbose:False
  655. verbose type: <type 'bool'>
  656. version:False
  657. version type: <type 'bool'>
  658. """
  659. stubout_file = "stub.out"
  660. expected_results = (
  661. 0, # Expected return status
  662. cmdout, # Expected command output
  663. stubout, # Expected stub functions output
  664. cmderr, # Expected command error output
  665. )
  666. testutils.save_testhook("")
  667. results = testutils.run_cmd('qsub.py',args,stubout_file)
  668. result = testutils.validate_results(results,expected_results)
  669. testutils.remove_testhook()
  670. correct = 1
  671. assert result == correct, "Result:\n%s" % result
  672. # ---------------------------------------------------------------------------------
  673. def test_qsub_invalid_geometry_3():
  674. """
  675. qsub test run: invalid_geometry_3
  676. """
  677. args = """--mode script -t50 -n10 --geometry 1x2x3x4 /bin/ls"""
  678. cmdout = \
  679. """1
  680. """
  681. cmderr = ''
  682. stubout = \
  683. """
  684. ADD_JOBS
  685. args:[]
  686. args type: <type 'list'>
  687. command:/bin/ls
  688. command type: <type 'str'>
  689. cwd:/tmp
  690. cwd type: <type 'str'>
  691. geometry:[1, 2, 3, 4, 2]
  692. geometry type: <type 'list'>
  693. ion_kernel:default
  694. ion_kernel type: <type 'str'>
  695. jobid:*
  696. jobid type: <type 'str'>
  697. kernel:default
  698. kernel type: <type 'str'>
  699. mode:script
  700. mode type: <type 'str'>
  701. nodes:10
  702. nodes type: <type 'int'>
  703. outputdir:/tmp
  704. outputdir type: <type 'str'>
  705. path:/tmp
  706. path type: <type 'str'>
  707. procs:512
  708. procs type: <type 'str'>
  709. queue:default
  710. queue type: <type 'str'>
  711. run_project:False
  712. run_project type: <type 'bool'>
  713. script_preboot:True
  714. script_preboot type: <type 'bool'>
  715. tag:job
  716. tag type: <type 'str'>
  717. umask:18
  718. umask type: <type 'int'>
  719. user:gooduser
  720. user type: <type 'str'>
  721. user_list:['gooduser']
  722. user_list type: <type 'list'>
  723. walltime:50
  724. walltime type: <type 'str'>
  725. VALIDATE_JOB
  726. attrs:{}
  727. attrs type: <type 'dict'>
  728. cwd:/tmp
  729. cwd type: <type 'str'>
  730. debug:False
  731. debug type: <type 'bool'>
  732. debuglog:False
  733. debuglog type: <type 'bool'>
  734. dependencies:False
  735. dependencies type: <type 'bool'>
  736. disable_preboot:False
  737. disable_preboot type: <type 'bool'>
  738. env:False
  739. env type: <type 'bool'>
  740. error:False
  741. error type: <type 'bool'>
  742. forcenoval:False
  743. forcenoval type: <type 'bool'>
  744. geometry:1x2x3x4
  745. geometry type: <type 'str'>
  746. held:False
  747. held type: <type 'bool'>
  748. inputfile:False
  749. inputfile type: <type 'bool'>
  750. interactive:False
  751. interactive type: <type 'bool'>
  752. ion_kernel:default
  753. ion_kernel type: <type 'str'>
  754. ion_kerneloptions:False
  755. ion_kerneloptions type: <type 'bool'>
  756. jobname:False
  757. jobname type: <type 'bool'>
  758. kernel:default
  759. kernel type: <type 'str'>
  760. kerneloptions:False
  761. kerneloptions type: <type 'bool'>
  762. mode:script
  763. mode type: <type 'str'>
  764. nodecount:10
  765. nodecount type: <type 'str'>
  766. notify:False
  767. notify type: <type 'bool'>
  768. output:False
  769. output type: <type 'bool'>
  770. outputprefix:False
  771. outputprefix type: <type 'bool'>
  772. preemptable:False
  773. preemptable type: <type 'bool'>
  774. proccount:False
  775. proccount type: <type 'bool'>
  776. project:False
  777. project type: <type 'bool'>
  778. queue:default
  779. queue type: <type 'str'>
  780. run_project:False
  781. run_project type: <type 'bool'>
  782. time:50
  783. time type: <type 'str'>
  784. umask:False
  785. umask type: <type 'bool'>
  786. user_list:False
  787. user_list type: <type 'bool'>
  788. verbose:False
  789. verbose type: <type 'bool'>
  790. version:False
  791. version type: <type 'bool'>
  792. """
  793. stubout_file = "stub.out"
  794. expected_results = (
  795. 0, # Expected return status
  796. cmdout, # Expected command output
  797. stubout, # Expected stub functions output
  798. cmderr, # Expected command error output
  799. )
  800. testutils.save_testhook("")
  801. results = testutils.run_cmd('qsub.py',args,stubout_file)
  802. result = testutils.validate_results(results,expected_results)
  803. testutils.remove_testhook()
  804. correct = 1
  805. assert result == correct, "Result:\n%s" % result
  806. # ---------------------------------------------------------------------------------
  807. def test_qsub_invalid_geometry_4():
  808. """
  809. qsub test run: invalid_geometry_4
  810. """
  811. args = """--mode script -t50 -n10 --geometry 48x48x48x48x2 /bin/ls"""
  812. cmdout = \
  813. """1
  814. """
  815. cmderr = ''
  816. stubout = \
  817. """
  818. ADD_JOBS
  819. args:[]
  820. args type: <type 'list'>
  821. command:/bin/ls
  822. command type: <type 'str'>
  823. cwd:/tmp
  824. cwd type: <type 'str'>
  825. geometry:[48, 48, 48, 48, 2]
  826. geometry type: <type 'list'>
  827. ion_kernel:default
  828. ion_kernel type: <type 'str'>
  829. jobid:*
  830. jobid type: <type 'str'>
  831. kernel:default
  832. kernel type: <type 'str'>
  833. mode:script
  834. mode type: <type 'str'>
  835. nodes:10
  836. nodes type: <type 'int'>
  837. outputdir:/tmp
  838. outputdir type: <type 'str'>
  839. path:/tmp
  840. path type: <type 'str'>
  841. procs:512
  842. procs type: <type 'str'>
  843. queue:default
  844. queue type: <type 'str'>
  845. run_project:False
  846. run_project type: <type 'bool'>
  847. script_preboot:True
  848. script_preboot type: <type 'bool'>
  849. tag:job
  850. tag type: <type 'str'>
  851. umask:18
  852. umask type: <type 'int'>
  853. user:gooduser
  854. user type: <type 'str'>
  855. user_list:['gooduser']
  856. user_list type: <type 'list'>
  857. walltime:50
  858. walltime type: <type 'str'>
  859. VALIDATE_JOB
  860. attrs:{}
  861. attrs type: <type 'dict'>
  862. cwd:/tmp
  863. cwd type: <type 'str'>
  864. debug:False
  865. debug type: <type 'bool'>
  866. debuglog:False
  867. debuglog type: <type 'bool'>
  868. dependencies:False
  869. dependencies type: <type 'bool'>
  870. disable_preboot:False
  871. disable_preboot type: <type 'bool'>
  872. env:False
  873. env type: <type 'bool'>
  874. error:False
  875. error type: <type 'bool'>
  876. forcenoval:False
  877. forcenoval type: <type 'bool'>
  878. geometry:48x48x48x48x2
  879. geometry type: <type 'str'>
  880. held:False
  881. held type: <type 'bool'>
  882. inputfile:False
  883. inputfile type: <type 'bool'>
  884. interactive:False
  885. interactive type: <type 'bool'>
  886. ion_kernel:default
  887. ion_kernel type: <type 'str'>
  888. ion_kerneloptions:False
  889. ion_kerneloptions type: <type 'bool'>
  890. jobname:False
  891. jobname type: <type 'bool'>
  892. kernel:default
  893. kernel type: <type 'str'>
  894. kerneloptions:False
  895. kerneloptions type: <type 'bool'>
  896. mode:script
  897. mode type: <type 'str'>
  898. nodecount:10
  899. nodecount type: <type 'str'>
  900. notify:False
  901. notify type: <type 'bool'>
  902. output:False
  903. output type: <type 'bool'>
  904. outputprefix:False
  905. outputprefix type: <type 'bool'>
  906. preemptable:False
  907. preemptable type: <type 'bool'>
  908. proccount:False
  909. proccount type: <type 'bool'>
  910. project:False
  911. project type: <type 'bool'>
  912. queue:default
  913. queue type: <type 'str'>
  914. run_project:False
  915. run_project type: <type 'bool'>
  916. time:50
  917. time type: <type 'str'>
  918. umask:False
  919. umask type: <type 'bool'>
  920. user_list:False
  921. user_list type: <type 'bool'>
  922. verbose:False
  923. verbose type: <type 'bool'>
  924. version:False
  925. version type: <type 'bool'>
  926. """
  927. stubout_file = "stub.out"
  928. expected_results = (
  929. 0, # Expected return status
  930. cmdout, # Expected command output
  931. stubout, # Expected stub functions output
  932. cmderr, # Expected command error output
  933. )
  934. testutils.save_testhook("")
  935. results = testutils.run_cmd('qsub.py',args,stubout_file)
  936. result = testutils.validate_results(results,expected_results)
  937. testutils.remove_testhook()
  938. correct = 1
  939. assert result == correct, "Result:\n%s" % result
  940. # ---------------------------------------------------------------------------------
  941. def test_qsub_invalid_geometry_5():
  942. """
  943. qsub test run: invalid_geometry_5
  944. """
  945. args = """--mode script -t50 -n10 --geometry 48x48x48x48x3 /bin/ls"""
  946. cmdout = ''
  947. cmderr = \
  948. """Invalid geometry entered:
  949. """
  950. stubout = ''
  951. stubout_file = "stub.out"
  952. expected_results = (
  953. 256, # Expected return status
  954. cmdout, # Expected command output
  955. stubout, # Expected stub functions output
  956. cmderr, # Expected command error output
  957. )
  958. testutils.save_testhook("")
  959. results = testutils.run_cmd('qsub.py',args,stubout_file)
  960. result = testutils.validate_results(results,expected_results)
  961. testutils.remove_testhook()
  962. correct = 1
  963. assert result == correct, "Result:\n%s" % result
  964. # ---------------------------------------------------------------------------------
  965. def test_qsub_invalid_geometry_6():
  966. """
  967. qsub test run: invalid_geometry_6
  968. """
  969. args = """--mode script -t50 -n10 --geometry 128x64x32x4 /bin/ls"""
  970. cmdout = \
  971. """1
  972. """
  973. cmderr = ''
  974. stubout = \
  975. """
  976. ADD_JOBS
  977. args:[]
  978. args type: <type 'list'>
  979. command:/bin/ls
  980. command type: <type 'str'>
  981. cwd:/tmp
  982. cwd type: <type 'str'>
  983. geometry:[128, 64, 32, 4, 2]
  984. geometry type: <type 'list'>
  985. ion_kernel:default
  986. ion_kernel type: <type 'str'>
  987. jobid:*
  988. jobid type: <type 'str'>
  989. kernel:default
  990. kernel type: <type 'str'>
  991. mode:script
  992. mode type: <type 'str'>
  993. nodes:10
  994. nodes type: <type 'int'>
  995. outputdir:/tmp
  996. outputdir type: <type 'str'>
  997. path:/tmp
  998. path type: <type 'str'>
  999. procs:512
  1000. procs type: <type 'str'>
  1001. queue:default
  1002. queue type: <type 'str'>
  1003. run_project:False
  1004. run_project type: <type 'bool'>
  1005. script_preboot:True
  1006. script_preboot type: <type 'bool'>
  1007. tag:job
  1008. tag type: <type 'str'>
  1009. umask:18
  1010. umask type: <type 'int'>
  1011. user:gooduser
  1012. user type: <type 'str'>
  1013. user_list:['gooduser']
  1014. user_list type: <type 'list'>
  1015. walltime:50
  1016. walltime type: <type 'str'>
  1017. VALIDATE_JOB
  1018. attrs:{}
  1019. attrs type: <type 'dict'>
  1020. cwd:/tmp
  1021. cwd type: <type 'str'>
  1022. debug:False
  1023. debug type: <type 'bool'>
  1024. debuglog:False
  1025. debuglog type: <type 'bool'>
  1026. dependencies:False
  1027. dependencies type: <type 'bool'>
  1028. disable_preboot:False
  1029. disable_preboot type: <type 'bool'>
  1030. env:False
  1031. env type: <type 'bool'>
  1032. error:False
  1033. error type: <type 'bool'>
  1034. forcenoval:False
  1035. forcenoval type: <type 'bool'>
  1036. geometry:128x64x32x4
  1037. geometry type: <type 'str'>
  1038. held:False
  1039. held type: <type 'bool'>
  1040. inputfile:False
  1041. inputfile type: <type 'bool'>
  1042. interactive:False
  1043. interactive type: <type 'bool'>
  1044. ion_kernel:default
  1045. ion_kernel type: <type 'str'>
  1046. ion_kerneloptions:False
  1047. ion_kerneloptions type: <type 'bool'>
  1048. jobname:False
  1049. jobname type: <type 'bool'>
  1050. kernel:default
  1051. kernel type: <type 'str'>
  1052. kerneloptions:False
  1053. kerneloptions type: <type 'bool'>
  1054. mode:script
  1055. mode type: <type 'str'>
  1056. nodecount:10
  1057. nodecount type: <type 'str'>
  1058. notify:False
  1059. notify type: <type 'bool'>
  1060. output:False
  1061. output type: <type 'bool'>
  1062. outputprefix:False
  1063. outputprefix type: <type 'bool'>
  1064. preemptable:False
  1065. preemptable type: <type 'bool'>
  1066. proccount:False
  1067. proccount type: <type 'bool'>
  1068. project:False
  1069. project type: <type 'bool'>
  1070. queue:default
  1071. queue type: <type 'str'>
  1072. run_project:False
  1073. run_project type: <type 'bool'>
  1074. time:50
  1075. time type: <type 'str'>
  1076. umask:False
  1077. umask type: <type 'bool'>
  1078. user_list:False
  1079. user_list type: <type 'bool'>
  1080. verbose:False
  1081. verbose type: <type 'bool'>
  1082. version:False
  1083. version type: <type 'bool'>
  1084. """
  1085. stubout_file = "stub.out"
  1086. expected_results = (
  1087. 0, # Expected return status
  1088. cmdout, # Expected command output
  1089. stubout, # Expected stub functions output
  1090. cmderr, # Expected command error output
  1091. )
  1092. testutils.save_testhook("")
  1093. results = testutils.run_cmd('qsub.py',args,stubout_file)
  1094. result = testutils.validate_results(results,expected_results)
  1095. testutils.remove_testhook()
  1096. correct = 1
  1097. assert result == correct, "Result:\n%s" % result
  1098. # ---------------------------------------------------------------------------------
  1099. def test_qsub_no_roject_specified():
  1100. """
  1101. qsub test run: no_roject_specified
  1102. """
  1103. args = """-A -t50 -n10 /bin/ls"""
  1104. cmdout = ''
  1105. cmderr = \
  1106. """'time' not provided
  1107. """
  1108. stubout = ''
  1109. stubout_file = "stub.out"
  1110. expected_results = (
  1111. 256, # Expected return status
  1112. cmdout, # Expected command output
  1113. stubout, # Expected stub functions output
  1114. cmderr, # Expected command error output
  1115. )
  1116. testutils.save_testhook("")
  1117. results = testutils.run_cmd('qsub.py',args,stubout_file)
  1118. result = testutils.validate_results(results,expected_results)
  1119. testutils.remove_testhook()
  1120. correct = 1
  1121. assert result == correct, "Result:\n%s" % result
  1122. # ---------------------------------------------------------------------------------
  1123. def test_qsub_project_specified():
  1124. """
  1125. qsub test run: project_specified
  1126. """
  1127. args = """-A who -t50 -n10 /bin/ls"""
  1128. cmdout = \
  1129. """1
  1130. """
  1131. cmderr = ''
  1132. stubout = \
  1133. """
  1134. ADD_JOBS
  1135. args:[]
  1136. args type: <type 'list'>
  1137. command:/bin/ls
  1138. command type: <type 'str'>
  1139. cwd:/tmp
  1140. cwd type: <type 'str'>
  1141. ion_kernel:default
  1142. ion_kernel type: <type 'str'>
  1143. jobid:*
  1144. jobid type: <type 'str'>
  1145. kernel:default
  1146. kernel type: <type 'str'>
  1147. mode:c1
  1148. mode type: <type 'str'>
  1149. nodes:10
  1150. nodes type: <type 'int'>
  1151. outputdir:/tmp
  1152. outputdir type: <type 'str'>
  1153. path:/tmp
  1154. path type: <type 'str'>
  1155. procs:512
  1156. procs type: <type 'str'>
  1157. project:who
  1158. project type: <type 'str'>
  1159. queue:default
  1160. queue type: <type 'str'>
  1161. run_project:False
  1162. run_project type: <type 'bool'>
  1163. script_preboot:True
  1164. script_preboot type: <type 'bool'>
  1165. tag:job
  1166. tag type: <type 'str'>
  1167. umask:18
  1168. umask type: <type 'int'>
  1169. user:gooduser
  1170. user type: <type 'str'>
  1171. user_list:['gooduser']
  1172. user_list type: <type 'list'>
  1173. walltime:50
  1174. walltime type: <type 'str'>
  1175. VALIDATE_JOB
  1176. attrs:{}
  1177. attrs type: <type 'dict'>
  1178. cwd:/tmp
  1179. cwd type: <type 'str'>
  1180. debug:False
  1181. debug type: <type 'bool'>
  1182. debuglog:False
  1183. debuglog type: <type 'bool'>
  1184. dependencies:False
  1185. dependencies type: <type 'bool'>
  1186. disable_preboot:False
  1187. disable_preboot type: <type 'bool'>
  1188. env:False
  1189. env type: <type 'bool'>
  1190. error:False
  1191. error type: <type 'bool'>
  1192. forcenoval:False
  1193. forcenoval type: <type 'bool'>
  1194. geometry:False
  1195. geometry type: <type 'bool'>
  1196. held:False
  1197. held type: <type 'bool'>
  1198. inputfile:False
  1199. inputfile type: <type 'bool'>
  1200. interactive:False
  1201. interactive type: <type 'bool'>
  1202. ion_kernel:default
  1203. ion_kernel type: <type 'str'>
  1204. ion_kerneloptions:False
  1205. ion_kerneloptions type: <type 'bool'>
  1206. jobname:False
  1207. jobname type: <type 'bool'>
  1208. kernel:default
  1209. kernel type: <type 'str'>
  1210. kerneloptions:False
  1211. kerneloptions type: <type 'bool'>
  1212. mode:False
  1213. mode type: <type 'bool'>
  1214. nodecount:10
  1215. nodecount type: <type 'str'>
  1216. notify:False
  1217. notify type: <type 'bool'>
  1218. output:False
  1219. output type: <type 'bool'>
  1220. outputprefix:False
  1221. outputprefix type: <type 'bool'>
  1222. preemptable:False
  1223. preemptable type: <type 'bool'>
  1224. proccount:False
  1225. proccount type: <type 'bool'>
  1226. project:who
  1227. project type: <type 'str'>
  1228. queue:default
  1229. queue type: <type 'str'>
  1230. run_project:False
  1231. run_project type: <type 'bool'>
  1232. time:50
  1233. time type: <type 'str'>
  1234. umask:False
  1235. umask type: <type 'bool'>
  1236. user_list:False
  1237. user_list type: <type 'bool'>
  1238. verbose:False
  1239. verbose type: <type 'bool'>
  1240. version:False
  1241. version type: <type 'bool'>
  1242. """
  1243. stubout_file = "stub.out"
  1244. expected_results = (
  1245. 0, # Expected return status
  1246. cmdout, # Expected command output
  1247. stubout, # Expected stub functions output
  1248. cmderr, # Expected command error output
  1249. )
  1250. testutils.save_testhook("")
  1251. results = testutils.run_cmd('qsub.py',args,stubout_file)
  1252. result = testutils.validate_results(results,expected_results)
  1253. testutils.remove_testhook()
  1254. correct = 1
  1255. assert result == correct, "Result:\n%s" % result
  1256. # ---------------------------------------------------------------------------------
  1257. def test_qsub_Check_attrs_1():
  1258. """
  1259. qsub test run: Check_attrs_1
  1260. """
  1261. args = """--attrs xxxx -t50 -n10 /bin/ls"""
  1262. cmdout = \
  1263. """1
  1264. """
  1265. cmderr = ''
  1266. stubout = \
  1267. """
  1268. ADD_JOBS
  1269. args:[]
  1270. args type: <type 'list'>
  1271. attrs:{'xxxx': 'true'}
  1272. attrs type: <type 'dict'>
  1273. command:/bin/ls
  1274. command type: <type 'str'>
  1275. cwd:/tmp
  1276. cwd type: <type 'str'>
  1277. ion_kernel:default
  1278. ion_kernel type: <type 'str'>
  1279. jobid:*
  1280. jobid type: <type 'str'>
  1281. kernel:default
  1282. kernel type: <type 'str'>
  1283. mode:c1
  1284. mode type: <type 'str'>
  1285. nodes:10
  1286. nodes type: <type 'int'>
  1287. outputdir:/tmp
  1288. outputdir type: <type 'str'>
  1289. path:/tmp
  1290. path type: <type 'str'>
  1291. procs:512
  1292. procs type: <type 'str'>
  1293. queue:default
  1294. queue type: <type 'str'>
  1295. run_project:False
  1296. run_project type: <type 'bool'>
  1297. script_preboot:True
  1298. script_preboot type: <type 'bool'>
  1299. tag:job
  1300. tag type: <type 'str'>
  1301. umask:18
  1302. umask type: <type 'int'>
  1303. user:gooduser
  1304. user type: <type 'str'>
  1305. user_list:['gooduser']
  1306. user_list type: <type 'list'>
  1307. walltime:50
  1308. walltime type: <type 'str'>
  1309. VALIDATE_JOB
  1310. attrs:{'xxxx': 'true'}
  1311. attrs type: <type 'dict'>
  1312. cwd:/tmp
  1313. cwd type: <type 'str'>
  1314. debug:False
  1315. debug type: <type 'bool'>
  1316. debuglog:False
  1317. debuglog type: <type 'bool'>
  1318. dependencies:False
  1319. dependencies type: <type 'bool'>
  1320. disable_preboot:False
  1321. disable_preboot type: <type 'bool'>
  1322. env:False
  1323. env type: <type 'bool'>
  1324. error:False
  1325. error type: <type 'bool'>
  1326. forcenoval:False
  1327. forcenoval type: <type 'bool'>
  1328. geometry:False
  1329. geometry type: <type 'bool'>
  1330. held:False
  1331. held type: <type 'bool'>
  1332. inputfile:False
  1333. inputfile type: <type 'bool'>
  1334. interactive:False
  1335. interactive type: <type 'bool'>
  1336. ion_kernel:default
  1337. ion_kernel type: <type 'str'>
  1338. ion_kerneloptions:False
  1339. ion_kerneloptions type: <type 'bool'>
  1340. jobname:False
  1341. jobname type: <type 'bool'>
  1342. kernel:default
  1343. kernel type: <type 'str'>
  1344. kerneloptions:False
  1345. kerneloptions type: <type 'bool'>
  1346. mode:False
  1347. mode type: <type 'bool'>
  1348. nodecount:10
  1349. nodecount type: <type 'str'>
  1350. notify:False
  1351. notify type: <type 'bool'>
  1352. output:False
  1353. output type: <type 'bool'>
  1354. outputprefix:False
  1355. outputprefix type: <type 'bool'>
  1356. preemptable:False
  1357. preemptable type: <type 'bool'>
  1358. proccount:False
  1359. proccount type: <type 'bool'>
  1360. project:False
  1361. project type: <type 'bool'>
  1362. queue:default
  1363. queue type: <type 'str'>
  1364. run_project:False
  1365. run_project type: <type 'bool'>
  1366. time:50
  1367. time type: <type 'str'>
  1368. umask:False
  1369. umask type: <type 'bool'>
  1370. user_list:False
  1371. user_list type: <type 'bool'>
  1372. verbose:False
  1373. verbose type: <type 'bool'>
  1374. version:False
  1375. version type: <type 'bool'>
  1376. """
  1377. stubout_file = "stub.out"
  1378. expected_results = (
  1379. 0, # Expected return status
  1380. cmdout, # Expected command output
  1381. stubout, # Expected stub functions output
  1382. cmderr, # Expected command error output
  1383. )
  1384. testutils.save_testhook("")
  1385. results = testutils.run_cmd('qsub.py',args,stubout_file)
  1386. result = testutils.validate_results(results,expected_results)
  1387. testutils.remove_testhook()
  1388. correct = 1
  1389. assert result == correct, "Result:\n%s" % result
  1390. # ---------------------------------------------------------------------------------
  1391. def test_qsub_Check_attrs_2():
  1392. """
  1393. qsub test run: Check_attrs_2
  1394. """
  1395. args = """--attrs 1111 -t50 -n10 /bin/ls"""
  1396. cmdout = \
  1397. """1
  1398. """
  1399. cmderr = ''
  1400. stubout = \
  1401. """
  1402. ADD_JOBS
  1403. args:[]
  1404. args type: <type 'list'>
  1405. attrs:{'1111': 'true'}
  1406. attrs type: <type 'dict'>
  1407. command:/bin/ls
  1408. command type: <type 'str'>
  1409. cwd:/tmp
  1410. cwd type: <type 'str'>
  1411. ion_kernel:default
  1412. ion_kernel type: <type 'str'>
  1413. jobid:*
  1414. jobid type: <type 'str'>
  1415. kernel:default
  1416. kernel type: <type 'str'>
  1417. mode:c1
  1418. mode type: <type 'str'>
  1419. nodes:10
  1420. nodes type: <type 'int'>
  1421. outputdir:/tmp
  1422. outputdir type: <type 'str'>
  1423. path:/tmp
  1424. path type: <type 'str'>
  1425. procs:512
  1426. procs type: <type 'str'>
  1427. queue:default
  1428. queue type: <type 'str'>
  1429. run_project:False
  1430. run_project type: <type 'bool'>
  1431. script_preboot:True
  1432. script_preboot type: <type 'bool'>
  1433. tag:job
  1434. tag type: <type 'str'>
  1435. umask:18
  1436. umask type: <type 'int'>
  1437. user:gooduser
  1438. user type: <type 'str'>
  1439. user_list:['gooduser']
  1440. user_list type: <type 'list'>
  1441. walltime:50
  1442. walltime type: <type 'str'>
  1443. VALIDATE_JOB
  1444. attrs:{'1111': 'true'}
  1445. attrs type: <type 'dict'>
  1446. cwd:/tmp
  1447. cwd type: <type 'str'>
  1448. debug:False
  1449. debug type: <type 'bool'>
  1450. debuglog:False
  1451. debuglog type: <type 'bool'>
  1452. dependencies:False
  1453. dependencies type: <type 'bool'>
  1454. disable_preboot:False
  1455. disable_preboot type: <type 'bool'>
  1456. env:False
  1457. env type: <type 'bool'>
  1458. error:False
  1459. error type: <type 'bool'>
  1460. forcenoval:False
  1461. forcenoval type: <type 'bool'>
  1462. geometry:False
  1463. geometry type: <type 'bool'>
  1464. held:False
  1465. held type: <type 'bool'>
  1466. inputfile:False
  1467. inputfile type: <type 'bool'>
  1468. interactive:False
  1469. interactive type: <type 'bool'>
  1470. ion_kernel:default
  1471. ion_kernel type: <type 'str'>
  1472. ion_kerneloptions:False
  1473. ion_kerneloptions type: <type 'bool'>
  1474. jobname:False
  1475. jobname type: <type 'bool'>
  1476. kernel:default
  1477. kernel type: <type 'str'>
  1478. kerneloptions:False
  1479. kerneloptions type: <type 'bool'>
  1480. mode:False
  1481. mode type: <type 'bool'>
  1482. nodecount:10
  1483. nodecount type: <type 'str'>
  1484. notify:False
  1485. notify type: <type 'bool'>
  1486. output:False
  1487. output type: <type 'bool'>
  1488. outputprefix:False
  1489. outputprefix type: <type 'bool'>
  1490. preemptable:False
  1491. preemptable type: <type 'bool'>
  1492. proccount:False
  1493. proccount type: <type 'bool'>
  1494. project:False
  1495. project type: <type 'bool'>
  1496. queue:default
  1497. queue type: <type 'str'>
  1498. run_project:False
  1499. run_project type: <type 'bool'>
  1500. time:50
  1501. time type: <type 'str'>
  1502. umask:False
  1503. umask type: <type 'bool'>
  1504. user_list:False
  1505. user_list type: <type 'bool'>
  1506. verbose:False
  1507. verbose type: <type 'bool'>
  1508. version:False
  1509. version type: <type 'bool'>
  1510. """
  1511. stubout_file = "stub.out"
  1512. expected_results = (
  1513. 0, # Expected return status
  1514. cmdout, # Expected command output
  1515. stubout, # Expected stub functions output
  1516. cmderr, # Expected command error output
  1517. )
  1518. testutils.save_testhook("")
  1519. results = testutils.run_cmd('qsub.py',args,stubout_file)
  1520. result = testutils.validate_results(results,expected_results)
  1521. testutils.remove_testhook()
  1522. correct = 1
  1523. assert result == correct, "Result:\n%s" % result
  1524. # ---------------------------------------------------------------------------------
  1525. def test_qsub_Check_attrs_3():
  1526. """
  1527. qsub test run: Check_attrs_3
  1528. """
  1529. args = """--attrs xx=:yy -t50 -n10 /bin/ls"""
  1530. cmdout = \
  1531. """1
  1532. """
  1533. cmderr = ''
  1534. stubout = \
  1535. """
  1536. ADD_JOBS
  1537. args:[]
  1538. args type: <type 'list'>
  1539. attrs:{'yy': 'true', 'xx': ''}
  1540. attrs type: <type 'dict'>
  1541. command:/bin/ls
  1542. command type: <type 'str'>
  1543. cwd:/tmp
  1544. cwd type: <type 'str'>
  1545. ion_kernel:default
  1546. ion_kernel type: <type 'str'>
  1547. jobid:*
  1548. jobid type: <type 'str'>
  1549. kernel:default
  1550. kernel type: <type 'str'>
  1551. mode:c1
  1552. mode type: <type 'str'>
  1553. nodes:10
  1554. nodes type: <type 'int'>
  1555. outputdir:/tmp
  1556. outputdir type: <type 'str'>
  1557. path:/tmp
  1558. path type: <type 'str'>
  1559. procs:512
  1560. procs type: <type 'str'>
  1561. queue:default
  1562. queue type: <type 'str'>
  1563. run_project:False
  1564. run_project type: <type 'bool'>
  1565. script_preboot:True
  1566. script_preboot type: <type 'bool'>
  1567. tag:job
  1568. tag type: <type 'str'>
  1569. umask:18
  1570. umask type: <type 'int'>
  1571. user:gooduser
  1572. user type: <type 'str'>
  1573. user_list:['gooduser']
  1574. user_list type: <type 'list'>
  1575. walltime:50
  1576. walltime type: <type 'str'>
  1577. VALIDATE_JOB
  1578. attrs:{'yy': 'true', 'xx': ''}
  1579. attrs type: <type 'dict'>
  1580. cwd:/tmp
  1581. cwd type: <type 'str'>
  1582. debug:False
  1583. debug type: <type 'bool'>
  1584. debuglog:False
  1585. debuglog type: <type 'bool'>
  1586. dependencies:False
  1587. dependencies type: <type 'bool'>
  1588. disable_preboot:False
  1589. disable_preboot type: <type 'bool'>
  1590. env:False
  1591. env type: <type 'bool'>
  1592. error:False
  1593. error type: <type 'bool'>
  1594. forcenoval:False
  1595. forcenoval type: <type 'bool'>
  1596. geometry:False
  1597. geometry type: <type 'bool'>
  1598. held:False
  1599. held type: <type 'bool'>
  1600. inputfile:False
  1601. inputfile type: <type 'bool'>
  1602. interactive:False
  1603. interactive type: <type 'bool'>
  1604. ion_kernel:default
  1605. ion_kernel type: <type 'str'>
  1606. ion_kerneloptions:False
  1607. ion_kerneloptions type: <type 'bool'>
  1608. jobname:False
  1609. jobname type: <type 'bool'>
  1610. kernel:default
  1611. kernel type: <type 'str'>
  1612. kerneloptions:False
  1613. kerneloptions type: <type 'bool'>
  1614. mode:False
  1615. mode type: <type 'bool'>
  1616. nodecount:10
  1617. nodecount type: <type 'str'>
  1618. notify:False
  1619. notify type: <type 'bool'>
  1620. output:False
  1621. output type: <type 'bool'>
  1622. outputprefix:False
  1623. outputprefix type: <type 'bool'>
  1624. preemptable:False
  1625. preemptable type: <type 'bool'>
  1626. proccount:False
  1627. proccount type: <type 'bool'>
  1628. project:False
  1629. project type: <type 'bool'>
  1630. queue:default
  1631. queue type: <type 'str'>
  1632. run_project:False
  1633. run_project type: <type 'bool'>
  1634. time:50
  1635. time type: <type 'str'>
  1636. umask:False
  1637. umask type: <type 'bool'>
  1638. user_list:False
  1639. user_list type: <type 'bool'>
  1640. verbose:False
  1641. verbose type: <type 'bool'>
  1642. version:False
  1643. version type: <type 'bool'>
  1644. """
  1645. stubout_file = "stub.out"
  1646. expected_results = (
  1647. 0, # Expected return status
  1648. cmdout, # Expected command output
  1649. stubout, # Expected stub functions output
  1650. cmderr, # Expected command error output
  1651. )
  1652. testutils.save_testhook("")
  1653. results = testutils.run_cmd('qsub.py',args,stubout_file)
  1654. result = testutils.validate_results(results,expected_results)
  1655. testutils.remove_testhook()
  1656. correct = 1
  1657. assert result == correct, "Result:\n%s" % result
  1658. # ---------------------------------------------------------------------------------
  1659. def test_qsub_Check_attrs_4():
  1660. """
  1661. qsub test run: Check_attrs_4
  1662. """
  1663. args = """--attrs xx=one:yy=1:zz=1one -t50 -n10 /bin/ls"""
  1664. cmdout = \
  1665. """1
  1666. """
  1667. cmderr = ''
  1668. stubout = \
  1669. """
  1670. ADD_JOBS
  1671. args:[]
  1672. args type: <type 'list'>
  1673. attrs:{'yy': '1', 'xx': 'one', 'zz': '1one'}
  1674. attrs type: <type 'dict'>
  1675. command:/bin/ls
  1676. command type: <type 'str'>
  1677. cwd:/tmp
  1678. cwd type: <type 'str'>
  1679. ion_kernel:default
  1680. ion_kernel type: <type 'str'>
  1681. jobid:*
  1682. jobid type: <type 'str'>
  1683. kernel:default
  1684. kernel type: <type 'str'>
  1685. mode:c1
  1686. mode type: <type 'str'>
  1687. nodes:10
  1688. nodes type: <type 'int'>
  1689. outputdir:/tmp
  1690. outputdir type: <type 'str'>
  1691. path:/tmp
  1692. path type: <type 'str'>
  1693. procs:512
  1694. procs type: <type 'str'>
  1695. queue:default
  1696. queue type: <type 'str'>
  1697. run_project:False
  1698. run_project type: <type 'bool'>
  1699. script_preboot:True
  1700. script_preboot type: <type 'bool'>
  1701. tag:job
  1702. tag type: <type 'str'>
  1703. umask:18
  1704. umask type: <type 'int'>
  1705. user:gooduser
  1706. user type: <type 'str'>
  1707. user_list:['gooduser']
  1708. user_list type: <type 'list'>
  1709. walltime:50
  1710. walltime type: <type 'str'>
  1711. VALIDATE_JOB
  1712. attrs:{'yy': '1', 'xx': 'one', 'zz': '1one'}
  1713. attrs type: <type 'dict'>
  1714. cwd:/tmp
  1715. cwd type: <type 'str'>
  1716. debug:False
  1717. debug type: <type 'bool'>
  1718. debuglog:False
  1719. debuglog type: <type 'bool'>
  1720. dependencies:False
  1721. dependencies type: <type 'bool'>
  1722. disable_preboot:False
  1723. disable_preboot type: <type 'bool'>
  1724. env:False
  1725. env type: <type 'bool'>
  1726. error:False
  1727. error type: <type 'bool'>
  1728. forcenoval:False
  1729. forcenoval type: <type 'bool'>
  1730. geometry:False
  1731. geometry type: <type 'bool'>
  1732. held:False
  1733. held type: <type 'bool'>
  1734. inputfile:False
  1735. inputfile type: <type 'bool'>
  1736. interactive:False
  1737. interactive type: <type 'bool'>
  1738. ion_kernel:default
  1739. ion_kernel type: <type 'str'>
  1740. ion_kerneloptions:False
  1741. ion_kerneloptions type: <type 'bool'>
  1742. jobname:False
  1743. jobname type: <type 'bool'>
  1744. kernel:default
  1745. kernel type: <type 'str'>
  1746. kerneloptions:False
  1747. kerneloptions type: <type 'bool'>
  1748. mode:False
  1749. mode type: <type 'bool'>
  1750. nodecount:10
  1751. nodecount type: <type 'str'>
  1752. notify:False
  1753. notify type: <type 'bool'>
  1754. output:False
  1755. output type: <type 'bool'>
  1756. outputprefix:False
  1757. outputprefix type: <type 'bool'>
  1758. preemptable:False
  1759. preemptable type: <type 'bool'>
  1760. proccount:False
  1761. proccount type: <type 'bool'>
  1762. project:False
  1763. project type: <type 'bool'>
  1764. queue:default
  1765. queue type: <type 'str'>
  1766. run_project:False
  1767. run_project type: <type 'bool'>
  1768. time:50
  1769. time type: <type 'str'>
  1770. umask:False
  1771. umask type: <type 'bool'>
  1772. user_list:False
  1773. user_list type: <type 'bool'>
  1774. verbose:False
  1775. verbose type: <type 'bool'>
  1776. version:False
  1777. version type: <type 'bool'>
  1778. """
  1779. stubout_file = "stub.out"
  1780. expected_results = (
  1781. 0, # Expected return status
  1782. cmdout, # Expected command output
  1783. stubout, # Expected stub functions output
  1784. cmderr, # Expected command error output
  1785. )
  1786. testutils.save_testhook("")
  1787. results = testutils.run_cmd('qsub.py',args,stubout_file)
  1788. result = testutils.validate_results(results,expected_results)
  1789. testutils.remove_testhook()
  1790. correct = 1
  1791. assert result == correct, "Result:\n%s" % result
  1792. # ---------------------------------------------------------------------------------
  1793. def test_qsub_cwd_option_1():
  1794. """
  1795. qsub test run: cwd_option_1
  1796. """
  1797. args = """--cwd /tmp/ -t10 -n 10 -e p /bin/ls"""
  1798. cmdout = \
  1799. """1
  1800. """
  1801. cmderr = ''
  1802. stubout = \
  1803. """
  1804. ADD_JOBS
  1805. args:[]
  1806. args type: <type 'list'>
  1807. command:/bin/ls
  1808. command type: <type 'str'>
  1809. cwd:/tmp/
  1810. cwd type: <type 'str'>
  1811. errorpath:/tmp//p
  1812. errorpath type: <type 'str'>
  1813. ion_kernel:default
  1814. ion_kernel type: <type 'str'>
  1815. jobid:*
  1816. jobid type: <type 'str'>
  1817. kernel:default
  1818. kernel type: <type 'str'>
  1819. mode:c1
  1820. mode type: <type 'str'>
  1821. nodes:10
  1822. nodes type: <type 'int'>
  1823. outputdir:/tmp/
  1824. outputdir type: <type 'str'>
  1825. path:/tmp
  1826. path type: <type 'str'>
  1827. procs:512
  1828. procs type: <type 'str'>
  1829. queue:default
  1830. queue type: <type 'str'>
  1831. run_project:False
  1832. run_project type: <type 'bool'>
  1833. script_preboot:True
  1834. script_preboot type: <type 'bool'>
  1835. tag:job
  1836. tag type: <type 'str'>
  1837. umask:18
  1838. umask type: <type 'int'>
  1839. user:gooduser
  1840. user type: <type 'str'>
  1841. user_list:['gooduser']
  1842. user_list type: <type 'list'>
  1843. walltime:10
  1844. walltime type: <type 'str'>
  1845. VALIDATE_JOB
  1846. attrs:{}
  1847. attrs type: <type 'dict'>
  1848. cwd:/tmp/
  1849. cwd type: <type 'str'>
  1850. debug:False
  1851. debug type: <type 'bool'>
  1852. debuglog:False
  1853. debuglog type: <type 'bool'>
  1854. dependencies:False
  1855. dependencies type: <type 'bool'>
  1856. disable_preboot:False
  1857. disable_preboot type: <type 'bool'>
  1858. env:False
  1859. env type: <type 'bool'>
  1860. error:p
  1861. error type: <type 'str'>
  1862. forcenoval:False
  1863. forcenoval type: <type 'bool'>
  1864. geometry:False
  1865. geometry type: <type 'bool'>
  1866. held:False
  1867. held type: <type 'bool'>
  1868. inputfile:False
  1869. inputfile type: <type 'bool'>
  1870. interactive:False
  1871. interactive type: <type 'bool'>
  1872. ion_kernel:default
  1873. ion_kernel type: <type 'str'>
  1874. ion_kerneloptions:False
  1875. ion_kerneloptions type: <type 'bool'>
  1876. jobname:False
  1877. jobname type: <type 'bool'>
  1878. kernel:default
  1879. kernel type: <type 'str'>
  1880. kerneloptions:False
  1881. kerneloptions type: <type 'bool'>
  1882. mode:False
  1883. mode type: <type 'bool'>
  1884. nodecount:10
  1885. nodecount type: <type 'str'>
  1886. notify:False
  1887. notify type: <type 'bool'>
  1888. output:False
  1889. output type: <type 'bool'>
  1890. outputprefix:False
  1891. outputprefix type: <type 'bool'>
  1892. preemptable:False
  1893. preemptable type: <type 'bool'>
  1894. proccount:False
  1895. proccount type: <type 'bool'>
  1896. project:False
  1897. project type: <type 'bool'>
  1898. queue:default
  1899. queue type: <type 'str'>
  1900. run_project:False
  1901. run_project type: <type 'bool'>
  1902. time:10
  1903. time type: <type 'str'>
  1904. umask:False
  1905. umask type: <type 'bool'>
  1906. user_list:False
  1907. user_list type: <type 'bool'>
  1908. verbose:False
  1909. verbose type: <type 'bool'>
  1910. version:False
  1911. version type: <type 'bool'>
  1912. """
  1913. stubout_file = "stub.out"
  1914. expected_results = (
  1915. 0, # Expected return status
  1916. cmdout, # Expected command output
  1917. stubout, # Expected stub functions output
  1918. cmderr, # Expected command error output
  1919. )
  1920. testutils.save_testhook("")
  1921. results = testutils.run_cmd('qsub.py',args,stubout_file)
  1922. result = testutils.validate_results(results,expected_results)
  1923. testutils.remove_testhook()
  1924. correct = 1
  1925. assert result == correct, "Result:\n%s" % result
  1926. # ---------------------------------------------------------------------------------
  1927. def test_qsub_cwd_option_2():
  1928. """
  1929. qsub test run: cwd_option_2
  1930. """
  1931. args = """--cwd /tmp -t10 -n 10 -e p /bin/ls"""
  1932. cmdout = \
  1933. """1
  1934. """
  1935. cmderr = ''
  1936. stubout = \
  1937. """
  1938. ADD_JOBS
  1939. args:[]
  1940. args type: <type 'list'>
  1941. command:/bin/ls
  1942. command type: <type 'str'>
  1943. cwd:/tmp
  1944. cwd type: <type 'str'>
  1945. errorpath:/tmp/p
  1946. errorpath type: <type 'str'>
  1947. ion_kernel:default
  1948. ion_kernel type: <type 'str'>
  1949. jobid:*
  1950. jobid type: <type 'str'>
  1951. kernel:default
  1952. kernel type: <type 'str'>
  1953. mode:c1
  1954. mode type: <type 'str'>
  1955. nodes:10
  1956. nodes type: <type 'int'>
  1957. outputdir:/tmp
  1958. outputdir type: <type 'str'>
  1959. path:/tmp
  1960. path type: <type 'str'>
  1961. procs:512
  1962. procs type: <type 'str'>
  1963. queue:default
  1964. queue type: <type 'str'>
  1965. run_project:False
  1966. run_project type: <type 'bool'>
  1967. script_preboot:True
  1968. script_preboot type: <type 'bool'>
  1969. tag:job
  1970. tag type: <type 'str'>
  1971. umask:18
  1972. umask type: <type 'int'>
  1973. user:gooduser
  1974. user type: <type 'str'>
  1975. user_list:['gooduser']
  1976. user_list type: <type 'list'>
  1977. walltime:10
  1978. walltime type: <type 'str'>
  1979. VALIDATE_JOB
  1980. attrs:{}
  1981. attrs type: <type 'dict'>
  1982. cwd:/tmp
  1983. cwd type: <type 'str'>
  1984. debug:False
  1985. debug type: <type 'bool'>
  1986. debuglog:False
  1987. debuglog type: <type 'bool'>
  1988. dependencies:False
  1989. dependencies type: <type 'bool'>
  1990. disable_preboot:False
  1991. disable_preboot type: <type 'bool'>
  1992. env:False
  1993. env type: <type 'bool'>
  1994. error:p
  1995. error type: <type 'str'>
  1996. forcenoval:False
  1997. forcenoval type: <type 'bool'>
  1998. geometry:False
  1999. geometry type: <type 'bool'>
  2000. held:False
  2001. held type: <type 'bool'>
  2002. inputfile:False
  2003. inputfile type: <type 'bool'>
  2004. interactive:False
  2005. interactive type: <type 'bool'>
  2006. ion_kernel:default
  2007. ion_kernel type: <type 'str'>
  2008. ion_kerneloptions:False
  2009. ion_kerneloptions type: <type 'bool'>
  2010. jobname:False
  2011. jobname type: <type 'bool'>
  2012. kernel:default
  2013. kernel type: <type 'str'>
  2014. kerneloptions:False
  2015. kerneloptions type: <type 'bool'>
  2016. mode:False
  2017. mode type: <type 'bool'>
  2018. nodecount:10
  2019. nodecount type: <type 'str'>
  2020. notify:False
  2021. notify type: <type 'bool'>
  2022. output:False
  2023. output type: <type 'bool'>
  2024. outputprefix:False
  2025. outputprefix type: <type 'bool'>
  2026. preemptable:False
  2027. preemptable type: <type 'bool'>
  2028. proccount:False
  2029. proccount type: <type 'bool'>
  2030. project:False
  2031. project type: <type 'bool'>
  2032. queue:default
  2033. queue type: <type 'str'>
  2034. run_project:False
  2035. run_project type: <type 'bool'>
  2036. time:10
  2037. time type: <type 'str'>
  2038. umask:False
  2039. umask type: <type 'bool'>
  2040. user_list:False
  2041. user_list type: <type 'bool'>
  2042. verbose:False
  2043. verbose type: <type 'bool'>
  2044. version:False
  2045. version type: <type 'bool'>
  2046. """
  2047. stubout_file = "stub.out"
  2048. expected_results = (
  2049. 0, # Expected return status
  2050. cmdout, # Expected command output
  2051. stubout, # Expected stub functions output
  2052. cmderr, # Expected command error output
  2053. )
  2054. testutils.save_testhook("")
  2055. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2056. result = testutils.validate_results(results,expected_results)
  2057. testutils.remove_testhook()
  2058. correct = 1
  2059. assert result == correct, "Result:\n%s" % result
  2060. # ---------------------------------------------------------------------------------
  2061. def test_qsub_cwd_option_3():
  2062. """
  2063. qsub test run: cwd_option_3
  2064. """
  2065. args = """--cwd /x -t10 -n 10 -e p /bin/ls"""
  2066. cmdout = ''
  2067. cmderr = \
  2068. """directory /x/p does not exist
  2069. """
  2070. stubout = ''
  2071. stubout_file = "stub.out"
  2072. expected_results = (
  2073. 256, # Expected return status
  2074. cmdout, # Expected command output
  2075. stubout, # Expected stub functions output
  2076. cmderr, # Expected command error output
  2077. )
  2078. testutils.save_testhook("")
  2079. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2080. result = testutils.validate_results(results,expected_results)
  2081. testutils.remove_testhook()
  2082. correct = 1
  2083. assert result == correct, "Result:\n%s" % result
  2084. # ---------------------------------------------------------------------------------
  2085. def test_qsub_cwd_option_4():
  2086. """
  2087. qsub test run: cwd_option_4
  2088. """
  2089. args = """--cwd /tmp/ -t10 -n 10 -e p -o x /bin/ls"""
  2090. cmdout = \
  2091. """1
  2092. """
  2093. cmderr = ''
  2094. stubout = \
  2095. """
  2096. ADD_JOBS
  2097. args:[]
  2098. args type: <type 'list'>
  2099. command:/bin/ls
  2100. command type: <type 'str'>
  2101. cwd:/tmp/
  2102. cwd type: <type 'str'>
  2103. errorpath:/tmp//p
  2104. errorpath type: <type 'str'>
  2105. ion_kernel:default
  2106. ion_kernel type: <type 'str'>
  2107. jobid:*
  2108. jobid type: <type 'str'>
  2109. kernel:default
  2110. kernel type: <type 'str'>
  2111. mode:c1
  2112. mode type: <type 'str'>
  2113. nodes:10
  2114. nodes type: <type 'int'>
  2115. outputdir:/tmp/
  2116. outputdir type: <type 'str'>
  2117. outputpath:/tmp//x
  2118. outputpath type: <type 'str'>
  2119. path:/tmp
  2120. path type: <type 'str'>
  2121. procs:512
  2122. procs type: <type 'str'>
  2123. queue:default
  2124. queue type: <type 'str'>
  2125. run_project:False
  2126. run_project type: <type 'bool'>
  2127. script_preboot:True
  2128. script_preboot type: <type 'bool'>
  2129. tag:job
  2130. tag type: <type 'str'>
  2131. umask:18
  2132. umask type: <type 'int'>
  2133. user:gooduser
  2134. user type: <type 'str'>
  2135. user_list:['gooduser']
  2136. user_list type: <type 'list'>
  2137. walltime:10
  2138. walltime type: <type 'str'>
  2139. VALIDATE_JOB
  2140. attrs:{}
  2141. attrs type: <type 'dict'>
  2142. cwd:/tmp/
  2143. cwd type: <type 'str'>
  2144. debug:False
  2145. debug type: <type 'bool'>
  2146. debuglog:False
  2147. debuglog type: <type 'bool'>
  2148. dependencies:False
  2149. dependencies type: <type 'bool'>
  2150. disable_preboot:False
  2151. disable_preboot type: <type 'bool'>
  2152. env:False
  2153. env type: <type 'bool'>
  2154. error:p
  2155. error type: <type 'str'>
  2156. forcenoval:False
  2157. forcenoval type: <type 'bool'>
  2158. geometry:False
  2159. geometry type: <type 'bool'>
  2160. held:False
  2161. held type: <type 'bool'>
  2162. inputfile:False
  2163. inputfile type: <type 'bool'>
  2164. interactive:False
  2165. interactive type: <type 'bool'>
  2166. ion_kernel:default
  2167. ion_kernel type: <type 'str'>
  2168. ion_kerneloptions:False
  2169. ion_kerneloptions type: <type 'bool'>
  2170. jobname:False
  2171. jobname type: <type 'bool'>
  2172. kernel:default
  2173. kernel type: <type 'str'>
  2174. kerneloptions:False
  2175. kerneloptions type: <type 'bool'>
  2176. mode:False
  2177. mode type: <type 'bool'>
  2178. nodecount:10
  2179. nodecount type: <type 'str'>
  2180. notify:False
  2181. notify type: <type 'bool'>
  2182. output:x
  2183. output type: <type 'str'>
  2184. outputprefix:False
  2185. outputprefix type: <type 'bool'>
  2186. preemptable:False
  2187. preemptable type: <type 'bool'>
  2188. proccount:False
  2189. proccount type: <type 'bool'>
  2190. project:False
  2191. project type: <type 'bool'>
  2192. queue:default
  2193. queue type: <type 'str'>
  2194. run_project:False
  2195. run_project type: <type 'bool'>
  2196. time:10
  2197. time type: <type 'str'>
  2198. umask:False
  2199. umask type: <type 'bool'>
  2200. user_list:False
  2201. user_list type: <type 'bool'>
  2202. verbose:False
  2203. verbose type: <type 'bool'>
  2204. version:False
  2205. version type: <type 'bool'>
  2206. """
  2207. stubout_file = "stub.out"
  2208. expected_results = (
  2209. 0, # Expected return status
  2210. cmdout, # Expected command output
  2211. stubout, # Expected stub functions output
  2212. cmderr, # Expected command error output
  2213. )
  2214. testutils.save_testhook("")
  2215. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2216. result = testutils.validate_results(results,expected_results)
  2217. testutils.remove_testhook()
  2218. correct = 1
  2219. assert result == correct, "Result:\n%s" % result
  2220. # ---------------------------------------------------------------------------------
  2221. def test_qsub_cwd_option_5():
  2222. """
  2223. qsub test run: cwd_option_5
  2224. """
  2225. args = """--cwd /tmp -t10 -n 10 -e p -o x /bin/ls"""
  2226. cmdout = \
  2227. """1
  2228. """
  2229. cmderr = ''
  2230. stubout = \
  2231. """
  2232. ADD_JOBS
  2233. args:[]
  2234. args type: <type 'list'>
  2235. command:/bin/ls
  2236. command type: <type 'str'>
  2237. cwd:/tmp
  2238. cwd type: <type 'str'>
  2239. errorpath:/tmp/p
  2240. errorpath type: <type 'str'>
  2241. ion_kernel:default
  2242. ion_kernel type: <type 'str'>
  2243. jobid:*
  2244. jobid type: <type 'str'>
  2245. kernel:default
  2246. kernel type: <type 'str'>
  2247. mode:c1
  2248. mode type: <type 'str'>
  2249. nodes:10
  2250. nodes type: <type 'int'>
  2251. outputdir:/tmp
  2252. outputdir type: <type 'str'>
  2253. outputpath:/tmp/x
  2254. outputpath type: <type 'str'>
  2255. path:/tmp
  2256. path type: <type 'str'>
  2257. procs:512
  2258. procs type: <type 'str'>
  2259. queue:default
  2260. queue type: <type 'str'>
  2261. run_project:False
  2262. run_project type: <type 'bool'>
  2263. script_preboot:True
  2264. script_preboot type: <type 'bool'>
  2265. tag:job
  2266. tag type: <type 'str'>
  2267. umask:18
  2268. umask type: <type 'int'>
  2269. user:gooduser
  2270. user type: <type 'str'>
  2271. user_list:['gooduser']
  2272. user_list type: <type 'list'>
  2273. walltime:10
  2274. walltime type: <type 'str'>
  2275. VALIDATE_JOB
  2276. attrs:{}
  2277. attrs type: <type 'dict'>
  2278. cwd:/tmp
  2279. cwd type: <type 'str'>
  2280. debug:False
  2281. debug type: <type 'bool'>
  2282. debuglog:False
  2283. debuglog type: <type 'bool'>
  2284. dependencies:False
  2285. dependencies type: <type 'bool'>
  2286. disable_preboot:False
  2287. disable_preboot type: <type 'bool'>
  2288. env:False
  2289. env type: <type 'bool'>
  2290. error:p
  2291. error type: <type 'str'>
  2292. forcenoval:False
  2293. forcenoval type: <type 'bool'>
  2294. geometry:False
  2295. geometry type: <type 'bool'>
  2296. held:False
  2297. held type: <type 'bool'>
  2298. inputfile:False
  2299. inputfile type: <type 'bool'>
  2300. interactive:False
  2301. interactive type: <type 'bool'>
  2302. ion_kernel:default
  2303. ion_kernel type: <type 'str'>
  2304. ion_kerneloptions:False
  2305. ion_kerneloptions type: <type 'bool'>
  2306. jobname:False
  2307. jobname type: <type 'bool'>
  2308. kernel:default
  2309. kernel type: <type 'str'>
  2310. kerneloptions:False
  2311. kerneloptions type: <type 'bool'>
  2312. mode:False
  2313. mode type: <type 'bool'>
  2314. nodecount:10
  2315. nodecount type: <type 'str'>
  2316. notify:False
  2317. notify type: <type 'bool'>
  2318. output:x
  2319. output type: <type 'str'>
  2320. outputprefix:False
  2321. outputprefix type: <type 'bool'>
  2322. preemptable:False
  2323. preemptable type: <type 'bool'>
  2324. proccount:False
  2325. proccount type: <type 'bool'>
  2326. project:False
  2327. project type: <type 'bool'>
  2328. queue:default
  2329. queue type: <type 'str'>
  2330. run_project:False
  2331. run_project type: <type 'bool'>
  2332. time:10
  2333. time type: <type 'str'>
  2334. umask:False
  2335. umask type: <type 'bool'>
  2336. user_list:False
  2337. user_list type: <type 'bool'>
  2338. verbose:False
  2339. verbose type: <type 'bool'>
  2340. version:False
  2341. version type: <type 'bool'>
  2342. """
  2343. stubout_file = "stub.out"
  2344. expected_results = (
  2345. 0, # Expected return status
  2346. cmdout, # Expected command output
  2347. stubout, # Expected stub functions output
  2348. cmderr, # Expected command error output
  2349. )
  2350. testutils.save_testhook("")
  2351. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2352. result = testutils.validate_results(results,expected_results)
  2353. testutils.remove_testhook()
  2354. correct = 1
  2355. assert result == correct, "Result:\n%s" % result
  2356. # ---------------------------------------------------------------------------------
  2357. def test_qsub_debuglog_option():
  2358. """
  2359. qsub test run: debuglog_option
  2360. """
  2361. args = """-t10 -n 10 -e p -o x --debuglog y /bin/ls"""
  2362. cmdout = \
  2363. """1
  2364. """
  2365. cmderr = ''
  2366. stubout = \
  2367. """
  2368. ADD_JOBS
  2369. args:[]
  2370. args type: <type 'list'>
  2371. cobalt_log_file:/tmp/y
  2372. cobalt_log_file type: <type 'str'>
  2373. command:/bin/ls
  2374. command type: <type 'str'>
  2375. cwd:/tmp
  2376. cwd type: <type 'str'>
  2377. errorpath:/tmp/p
  2378. errorpath type: <type 'str'>
  2379. ion_kernel:default
  2380. ion_kernel type: <type 'str'>
  2381. jobid:*
  2382. jobid type: <type 'str'>
  2383. kernel:default
  2384. kernel type: <type 'str'>
  2385. mode:c1
  2386. mode type: <type 'str'>
  2387. nodes:10
  2388. nodes type: <type 'int'>
  2389. outputdir:/tmp
  2390. outputdir type: <type 'str'>
  2391. outputpath:/tmp/x
  2392. outputpath type: <type 'str'>
  2393. path:/tmp
  2394. path type: <type 'str'>
  2395. procs:512
  2396. procs type: <type 'str'>
  2397. queue:default
  2398. queue type: <type 'str'>
  2399. run_project:False
  2400. run_project type: <type 'bool'>
  2401. script_preboot:True
  2402. script_preboot type: <type 'bool'>
  2403. tag:job
  2404. tag type: <type 'str'>
  2405. umask:18
  2406. umask type: <type 'int'>
  2407. user:gooduser
  2408. user type: <type 'str'>
  2409. user_list:['gooduser']
  2410. user_list type: <type 'list'>
  2411. walltime:10
  2412. walltime type: <type 'str'>
  2413. VALIDATE_JOB
  2414. attrs:{}
  2415. attrs type: <type 'dict'>
  2416. cwd:/tmp
  2417. cwd type: <type 'str'>
  2418. debug:False
  2419. debug type: <type 'bool'>
  2420. debuglog:y
  2421. debuglog type: <type 'str'>
  2422. dependencies:False
  2423. dependencies type: <type 'bool'>
  2424. disable_preboot:False
  2425. disable_preboot type: <type 'bool'>
  2426. env:False
  2427. env type: <type 'bool'>
  2428. error:p
  2429. error type: <type 'str'>
  2430. forcenoval:False
  2431. forcenoval type: <type 'bool'>
  2432. geometry:False
  2433. geometry type: <type 'bool'>
  2434. held:False
  2435. held type: <type 'bool'>
  2436. inputfile:False
  2437. inputfile type: <type 'bool'>
  2438. interactive:False
  2439. interactive type: <type 'bool'>
  2440. ion_kernel:default
  2441. ion_kernel type: <type 'str'>
  2442. ion_kerneloptions:False
  2443. ion_kerneloptions type: <type 'bool'>
  2444. jobname:False
  2445. jobname type: <type 'bool'>
  2446. kernel:default
  2447. kernel type: <type 'str'>
  2448. kerneloptions:False
  2449. kerneloptions type: <type 'bool'>
  2450. mode:False
  2451. mode type: <type 'bool'>
  2452. nodecount:10
  2453. nodecount type: <type 'str'>
  2454. notify:False
  2455. notify type: <type 'bool'>
  2456. output:x
  2457. output type: <type 'str'>
  2458. outputprefix:False
  2459. outputprefix type: <type 'bool'>
  2460. preemptable:False
  2461. preemptable type: <type 'bool'>
  2462. proccount:False
  2463. proccount type: <type 'bool'>
  2464. project:False
  2465. project type: <type 'bool'>
  2466. queue:default
  2467. queue type: <type 'str'>
  2468. run_project:False
  2469. run_project type: <type 'bool'>
  2470. time:10
  2471. time type: <type 'str'>
  2472. umask:False
  2473. umask type: <type 'bool'>
  2474. user_list:False
  2475. user_list type: <type 'bool'>
  2476. verbose:False
  2477. verbose type: <type 'bool'>
  2478. version:False
  2479. version type: <type 'bool'>
  2480. """
  2481. stubout_file = "stub.out"
  2482. expected_results = (
  2483. 0, # Expected return status
  2484. cmdout, # Expected command output
  2485. stubout, # Expected stub functions output
  2486. cmderr, # Expected command error output
  2487. )
  2488. testutils.save_testhook("")
  2489. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2490. result = testutils.validate_results(results,expected_results)
  2491. testutils.remove_testhook()
  2492. correct = 1
  2493. assert result == correct, "Result:\n%s" % result
  2494. # ---------------------------------------------------------------------------------
  2495. def test_qsub_inputfile_option_1():
  2496. """
  2497. qsub test run: inputfile_option_1
  2498. """
  2499. args = """-i none -t10 -n 10 /bin/ls"""
  2500. cmdout = ''
  2501. cmderr = \
  2502. """file /tmp/none not found, or is not a file
  2503. """
  2504. stubout = ''
  2505. stubout_file = "stub.out"
  2506. expected_results = (
  2507. 256, # Expected return status
  2508. cmdout, # Expected command output
  2509. stubout, # Expected stub functions output
  2510. cmderr, # Expected command error output
  2511. )
  2512. testutils.save_testhook("")
  2513. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2514. result = testutils.validate_results(results,expected_results)
  2515. testutils.remove_testhook()
  2516. correct = 1
  2517. assert result == correct, "Result:\n%s" % result
  2518. # ---------------------------------------------------------------------------------
  2519. def test_qsub_inputfile_option_2():
  2520. """
  2521. qsub test run: inputfile_option_2
  2522. """
  2523. args = """-i y -t10 -n 10 /bin/ls"""
  2524. cmdout = \
  2525. """1
  2526. """
  2527. cmderr = ''
  2528. stubout = \
  2529. """
  2530. ADD_JOBS
  2531. args:[]
  2532. args type: <type 'list'>
  2533. command:/bin/ls
  2534. command type: <type 'str'>
  2535. cwd:/tmp
  2536. cwd type: <type 'str'>
  2537. inputfile:/tmp/y
  2538. inputfile type: <type 'str'>
  2539. ion_kernel:default
  2540. ion_kernel type: <type 'str'>
  2541. jobid:*
  2542. jobid type: <type 'str'>
  2543. kernel:default
  2544. kernel type: <type 'str'>
  2545. mode:c1
  2546. mode type: <type 'str'>
  2547. nodes:10
  2548. nodes type: <type 'int'>
  2549. outputdir:/tmp
  2550. outputdir type: <type 'str'>
  2551. path:/tmp
  2552. path type: <type 'str'>
  2553. procs:512
  2554. procs type: <type 'str'>
  2555. queue:default
  2556. queue type: <type 'str'>
  2557. run_project:False
  2558. run_project type: <type 'bool'>
  2559. script_preboot:True
  2560. script_preboot type: <type 'bool'>
  2561. tag:job
  2562. tag type: <type 'str'>
  2563. umask:18
  2564. umask type: <type 'int'>
  2565. user:gooduser
  2566. user type: <type 'str'>
  2567. user_list:['gooduser']
  2568. user_list type: <type 'list'>
  2569. walltime:10
  2570. walltime type: <type 'str'>
  2571. VALIDATE_JOB
  2572. attrs:{}
  2573. attrs type: <type 'dict'>
  2574. cwd:/tmp
  2575. cwd type: <type 'str'>
  2576. debug:False
  2577. debug type: <type 'bool'>
  2578. debuglog:False
  2579. debuglog type: <type 'bool'>
  2580. dependencies:False
  2581. dependencies type: <type 'bool'>
  2582. disable_preboot:False
  2583. disable_preboot type: <type 'bool'>
  2584. env:False
  2585. env type: <type 'bool'>
  2586. error:False
  2587. error type: <type 'bool'>
  2588. forcenoval:False
  2589. forcenoval type: <type 'bool'>
  2590. geometry:False
  2591. geometry type: <type 'bool'>
  2592. held:False
  2593. held type: <type 'bool'>
  2594. inputfile:y
  2595. inputfile type: <type 'str'>
  2596. interactive:False
  2597. interactive type: <type 'bool'>
  2598. ion_kernel:default
  2599. ion_kernel type: <type 'str'>
  2600. ion_kerneloptions:False
  2601. ion_kerneloptions type: <type 'bool'>
  2602. jobname:False
  2603. jobname type: <type 'bool'>
  2604. kernel:default
  2605. kernel type: <type 'str'>
  2606. kerneloptions:False
  2607. kerneloptions type: <type 'bool'>
  2608. mode:False
  2609. mode type: <type 'bool'>
  2610. nodecount:10
  2611. nodecount type: <type 'str'>
  2612. notify:False
  2613. notify type: <type 'bool'>
  2614. output:False
  2615. output type: <type 'bool'>
  2616. outputprefix:False
  2617. outputprefix type: <type 'bool'>
  2618. preemptable:False
  2619. preemptable type: <type 'bool'>
  2620. proccount:False
  2621. proccount type: <type 'bool'>
  2622. project:False
  2623. project type: <type 'bool'>
  2624. queue:default
  2625. queue type: <type 'str'>
  2626. run_project:False
  2627. run_project type: <type 'bool'>
  2628. time:10
  2629. time type: <type 'str'>
  2630. umask:False
  2631. umask type: <type 'bool'>
  2632. user_list:False
  2633. user_list type: <type 'bool'>
  2634. verbose:False
  2635. verbose type: <type 'bool'>
  2636. version:False
  2637. version type: <type 'bool'>
  2638. """
  2639. stubout_file = "stub.out"
  2640. expected_results = (
  2641. 0, # Expected return status
  2642. cmdout, # Expected command output
  2643. stubout, # Expected stub functions output
  2644. cmderr, # Expected command error output
  2645. )
  2646. testutils.save_testhook("")
  2647. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2648. result = testutils.validate_results(results,expected_results)
  2649. testutils.remove_testhook()
  2650. correct = 1
  2651. assert result == correct, "Result:\n%s" % result
  2652. # ---------------------------------------------------------------------------------
  2653. def test_qsub_email_option():
  2654. """
  2655. qsub test run: email_option
  2656. """
  2657. args = """-M g -t10 -n10 /bin/ls"""
  2658. cmdout = \
  2659. """1
  2660. """
  2661. cmderr = ''
  2662. stubout = \
  2663. """
  2664. ADD_JOBS
  2665. args:[]
  2666. args type: <type 'list'>
  2667. command:/bin/ls
  2668. command type: <type 'str'>
  2669. cwd:/tmp
  2670. cwd type: <type 'str'>
  2671. ion_kernel:default
  2672. ion_kernel type: <type 'str'>
  2673. jobid:*
  2674. jobid type: <type 'str'>
  2675. kernel:default
  2676. kernel type: <type 'str'>
  2677. mode:c1
  2678. mode type: <type 'str'>
  2679. nodes:10
  2680. nodes type: <type 'int'>
  2681. notify:g
  2682. notify type: <type 'str'>
  2683. outputdir:/tmp
  2684. outputdir type: <type 'str'>
  2685. path:/tmp
  2686. path type: <type 'str'>
  2687. procs:512
  2688. procs type: <type 'str'>
  2689. queue:default
  2690. queue type: <type 'str'>
  2691. run_project:False
  2692. run_project type: <type 'bool'>
  2693. script_preboot:True
  2694. script_preboot type: <type 'bool'>
  2695. tag:job
  2696. tag type: <type 'str'>
  2697. umask:18
  2698. umask type: <type 'int'>
  2699. user:gooduser
  2700. user type: <type 'str'>
  2701. user_list:['gooduser']
  2702. user_list type: <type 'list'>
  2703. walltime:10
  2704. walltime type: <type 'str'>
  2705. VALIDATE_JOB
  2706. attrs:{}
  2707. attrs type: <type 'dict'>
  2708. cwd:/tmp
  2709. cwd type: <type 'str'>
  2710. debug:False
  2711. debug type: <type 'bool'>
  2712. debuglog:False
  2713. debuglog type: <type 'bool'>
  2714. dependencies:False
  2715. dependencies type: <type 'bool'>
  2716. disable_preboot:False
  2717. disable_preboot type: <type 'bool'>
  2718. env:False
  2719. env type: <type 'bool'>
  2720. error:False
  2721. error type: <type 'bool'>
  2722. forcenoval:False
  2723. forcenoval type: <type 'bool'>
  2724. geometry:False
  2725. geometry type: <type 'bool'>
  2726. held:False
  2727. held type: <type 'bool'>
  2728. inputfile:False
  2729. inputfile type: <type 'bool'>
  2730. interactive:False
  2731. interactive type: <type 'bool'>
  2732. ion_kernel:default
  2733. ion_kernel type: <type 'str'>
  2734. ion_kerneloptions:False
  2735. ion_kerneloptions type: <type 'bool'>
  2736. jobname:False
  2737. jobname type: <type 'bool'>
  2738. kernel:default
  2739. kernel type: <type 'str'>
  2740. kerneloptions:False
  2741. kerneloptions type: <type 'bool'>
  2742. mode:False
  2743. mode type: <type 'bool'>
  2744. nodecount:10
  2745. nodecount type: <type 'str'>
  2746. notify:g
  2747. notify type: <type 'str'>
  2748. output:False
  2749. output type: <type 'bool'>
  2750. outputprefix:False
  2751. outputprefix type: <type 'bool'>
  2752. preemptable:False
  2753. preemptable type: <type 'bool'>
  2754. proccount:False
  2755. proccount type: <type 'bool'>
  2756. project:False
  2757. project type: <type 'bool'>
  2758. queue:default
  2759. queue type: <type 'str'>
  2760. run_project:False
  2761. run_project type: <type 'bool'>
  2762. time:10
  2763. time type: <type 'str'>
  2764. umask:False
  2765. umask type: <type 'bool'>
  2766. user_list:False
  2767. user_list type: <type 'bool'>
  2768. verbose:False
  2769. verbose type: <type 'bool'>
  2770. version:False
  2771. version type: <type 'bool'>
  2772. """
  2773. stubout_file = "stub.out"
  2774. expected_results = (
  2775. 0, # Expected return status
  2776. cmdout, # Expected command output
  2777. stubout, # Expected stub functions output
  2778. cmderr, # Expected command error output
  2779. )
  2780. testutils.save_testhook("")
  2781. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2782. result = testutils.validate_results(results,expected_results)
  2783. testutils.remove_testhook()
  2784. correct = 1
  2785. assert result == correct, "Result:\n%s" % result
  2786. # ---------------------------------------------------------------------------------
  2787. def test_qsub_outputprefix():
  2788. """
  2789. qsub test run: outputprefix
  2790. """
  2791. args = """-O /tmp -t10 -n10 /bin/ls"""
  2792. cmdout = \
  2793. """1
  2794. """
  2795. cmderr = \
  2796. """WARNING: failed to create cobalt log file at: /tmp.cobaltlog: [Errno 13] Permission denied: '/tmp.cobaltlog'
  2797. """
  2798. stubout = \
  2799. """
  2800. ADD_JOBS
  2801. args:[]
  2802. args type: <type 'list'>
  2803. cobalt_log_file:/tmp.cobaltlog
  2804. cobalt_log_file type: <type 'str'>
  2805. command:/bin/ls
  2806. command type: <type 'str'>
  2807. cwd:/tmp
  2808. cwd type: <type 'str'>
  2809. errorpath:/tmp.error
  2810. errorpath type: <type 'str'>
  2811. ion_kernel:default
  2812. ion_kernel type: <type 'str'>
  2813. jobid:*
  2814. jobid type: <type 'str'>
  2815. kernel:default
  2816. kernel type: <type 'str'>
  2817. mode:c1
  2818. mode type: <type 'str'>
  2819. nodes:10
  2820. nodes type: <type 'int'>
  2821. outputdir:/tmp
  2822. outputdir type: <type 'str'>
  2823. outputpath:/tmp.output
  2824. outputpath type: <type 'str'>
  2825. path:/tmp
  2826. path type: <type 'str'>
  2827. procs:512
  2828. procs type: <type 'str'>
  2829. queue:default
  2830. queue type: <type 'str'>
  2831. run_project:False
  2832. run_project type: <type 'bool'>
  2833. script_preboot:True
  2834. script_preboot type: <type 'bool'>
  2835. tag:job
  2836. tag type: <type 'str'>
  2837. umask:18
  2838. umask type: <type 'int'>
  2839. user:gooduser
  2840. user type: <type 'str'>
  2841. user_list:['gooduser']
  2842. user_list type: <type 'list'>
  2843. walltime:10
  2844. walltime type: <type 'str'>
  2845. VALIDATE_JOB
  2846. attrs:{}
  2847. attrs type: <type 'dict'>
  2848. cwd:/tmp
  2849. cwd type: <type 'str'>
  2850. debug:False
  2851. debug type: <type 'bool'>
  2852. debuglog:False
  2853. debuglog type: <type 'bool'>
  2854. dependencies:False
  2855. dependencies type: <type 'bool'>
  2856. disable_preboot:False
  2857. disable_preboot type: <type 'bool'>
  2858. env:False
  2859. env type: <type 'bool'>
  2860. error:False
  2861. error type: <type 'bool'>
  2862. forcenoval:False
  2863. forcenoval type: <type 'bool'>
  2864. geometry:False
  2865. geometry type: <type 'bool'>
  2866. held:False
  2867. held type: <type 'bool'>
  2868. inputfile:False
  2869. inputfile type: <type 'bool'>
  2870. interactive:False
  2871. interactive type: <type 'bool'>
  2872. ion_kernel:default
  2873. ion_kernel type: <type 'str'>
  2874. ion_kerneloptions:False
  2875. ion_kerneloptions type: <type 'bool'>
  2876. jobname:False
  2877. jobname type: <type 'bool'>
  2878. kernel:default
  2879. kernel type: <type 'str'>
  2880. kerneloptions:False
  2881. kerneloptions type: <type 'bool'>
  2882. mode:False
  2883. mode type: <type 'bool'>
  2884. nodecount:10
  2885. nodecount type: <type 'str'>
  2886. notify:False
  2887. notify type: <type 'bool'>
  2888. output:False
  2889. output type: <type 'bool'>
  2890. outputprefix:/tmp
  2891. outputprefix type: <type 'str'>
  2892. preemptable:False
  2893. preemptable type: <type 'bool'>
  2894. proccount:False
  2895. proccount type: <type 'bool'>
  2896. project:False
  2897. project type: <type 'bool'>
  2898. queue:default
  2899. queue type: <type 'str'>
  2900. run_project:False
  2901. run_project type: <type 'bool'>
  2902. time:10
  2903. time type: <type 'str'>
  2904. umask:False
  2905. umask type: <type 'bool'>
  2906. user_list:False
  2907. user_list type: <type 'bool'>
  2908. verbose:False
  2909. verbose type: <type 'bool'>
  2910. version:False
  2911. version type: <type 'bool'>
  2912. """
  2913. stubout_file = "stub.out"
  2914. expected_results = (
  2915. 0, # Expected return status
  2916. cmdout, # Expected command output
  2917. stubout, # Expected stub functions output
  2918. cmderr, # Expected command error output
  2919. )
  2920. testutils.save_testhook("")
  2921. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2922. result = testutils.validate_results(results,expected_results)
  2923. testutils.remove_testhook()
  2924. correct = 1
  2925. assert result == correct, "Result:\n%s" % result
  2926. # ---------------------------------------------------------------------------------
  2927. def test_qsub_invalid_user():
  2928. """
  2929. qsub test run: invalid_user
  2930. """
  2931. args = """--run_users naughtyuser -t10 -n10 /bin/ls"""
  2932. cmdout = ''
  2933. cmderr = \
  2934. """user naughtyuser does not exist.
  2935. """
  2936. stubout = ''
  2937. stubout_file = "stub.out"
  2938. expected_results = (
  2939. 256, # Expected return status
  2940. cmdout, # Expected command output
  2941. stubout, # Expected stub functions output
  2942. cmderr, # Expected command error output
  2943. )
  2944. testutils.save_testhook("")
  2945. results = testutils.run_cmd('qsub.py',args,stubout_file)
  2946. result = testutils.validate_results(results,expected_results)
  2947. testutils.remove_testhook()
  2948. correct = 1
  2949. assert result == correct, "Result:\n%s" % result
  2950. # ---------------------------------------------------------------------------------
  2951. def test_qsub_mode_option_1():
  2952. """
  2953. qsub test run: mode_option_1
  2954. """
  2955. args = """-t10 -n512 --proccount 1023 --mode vn /bin/ls"""
  2956. cmdout = \
  2957. """1
  2958. """
  2959. cmderr = ''
  2960. stubout = \
  2961. """
  2962. ADD_JOBS
  2963. args:[]
  2964. args type: <type 'list'>
  2965. command:/bin/ls
  2966. command type: <type 'str'>
  2967. cwd:/tmp
  2968. cwd type: <type 'str'>
  2969. ion_kernel:default
  2970. ion_kernel type: <type 'str'>
  2971. jobid:*
  2972. jobid type: <type 'str'>
  2973. kernel:default
  2974. kernel type: <type 'str'>
  2975. mode:vn
  2976. mode type: <type 'str'>
  2977. nodes:512
  2978. nodes type: <type 'int'>
  2979. outputdir:/tmp
  2980. outputdir type: <type 'str'>
  2981. path:/tmp
  2982. path type: <type 'str'>
  2983. procs:1023
  2984. procs type: <type 'str'>
  2985. queue:default
  2986. queue type: <type 'str'>
  2987. run_project:False
  2988. run_project type: <type 'bool'>
  2989. script_preboot:True
  2990. script_preboot type: <type 'bool'>
  2991. tag:job
  2992. tag type: <type 'str'>
  2993. umask:18
  2994. umask type: <type 'int'>
  2995. user:gooduser
  2996. user type: <type 'str'>
  2997. user_list:['gooduser']
  2998. user_list type: <type 'list'>
  2999. walltime:10
  3000. walltime type: <type 'str'>
  3001. VALIDATE_JOB
  3002. attrs:{}
  3003. attrs type: <type 'dict'>
  3004. cwd:/tmp
  3005. cwd type: <type 'str'>
  3006. debug:False
  3007. debug type: <type 'bool'>
  3008. debuglog:False
  3009. debuglog type: <type 'bool'>
  3010. dependencies:False
  3011. dependencies type: <type 'bool'>
  3012. disable_preboot:False
  3013. disable_preboot type: <type 'bool'>
  3014. env:False
  3015. env type: <type 'bool'>
  3016. error:False
  3017. error type: <type 'bool'>
  3018. forcenoval:False
  3019. forcenoval type: <type 'bool'>
  3020. geometry:False
  3021. geometry type: <type 'bool'>
  3022. held:False
  3023. held type: <type 'bool'>
  3024. inputfile:False
  3025. inputfile type: <type 'bool'>
  3026. interactive:False
  3027. interactive type: <type 'bool'>
  3028. ion_kernel:default
  3029. ion_kernel type: <type 'str'>
  3030. ion_kerneloptions:False
  3031. ion_kerneloptions type: <type 'bool'>
  3032. jobname:False
  3033. jobname type: <type 'bool'>
  3034. kernel:default
  3035. kernel type: <type 'str'>
  3036. kerneloptions:False
  3037. kerneloptions type: <type 'bool'>
  3038. mode:vn
  3039. mode type: <type 'str'>
  3040. nodecount:512
  3041. nodecount type: <type 'str'>
  3042. notify:False
  3043. notify type: <type 'bool'>
  3044. output:False
  3045. output type: <type 'bool'>
  3046. outputprefix:False
  3047. outputprefix type: <type 'bool'>
  3048. preemptable:False
  3049. preemptable type: <type 'bool'>
  3050. proccount:1023
  3051. proccount type: <type 'str'>
  3052. project:False
  3053. project type: <type 'bool'>
  3054. queue:default
  3055. queue type: <type 'str'>
  3056. run_project:False
  3057. run_project type: <type 'bool'>
  3058. time:10
  3059. time type: <type 'str'>
  3060. umask:False
  3061. umask type: <type 'bool'>
  3062. user_list:False
  3063. user_list type: <type 'bool'>
  3064. verbose:False
  3065. verbose type: <type 'bool'>
  3066. version:False
  3067. version type: <type 'bool'>
  3068. """
  3069. stubout_file = "stub.out"
  3070. expected_results = (
  3071. 0, # Expected return status
  3072. cmdout, # Expected command output
  3073. stubout, # Expected stub functions output
  3074. cmderr, # Expected command error output
  3075. )
  3076. testutils.save_testhook("")
  3077. results = testutils.run_cmd('qsub.py',args,stubout_file)
  3078. result = testutils.validate_results(results,expected_results)
  3079. testutils.remove_testhook()
  3080. correct = 1
  3081. assert result == correct, "Result:\n%s" % result
  3082. # ---------------------------------------------------------------------------------
  3083. def test_qsub_mode_option_2():
  3084. """
  3085. qsub test run: mode_option_2
  3086. """
  3087. args = """-t10 -n512 --proccount 1023 --mode vn /bin/ls"""
  3088. cmdout = \
  3089. """1
  3090. """
  3091. cmderr = ''
  3092. stubout = \
  3093. """
  3094. ADD_JOBS
  3095. args:[]
  3096. args type: <type 'list'>
  3097. command:/bin/ls
  3098. command type: <type 'str'>
  3099. cwd:/tmp
  3100. cwd type: <type 'str'>
  3101. ion_kernel:default
  3102. ion_kernel type: <type 'str'>
  3103. jobid:*
  3104. jobid type: <type 'str'>
  3105. kernel:default
  3106. kernel type: <type 'str'>
  3107. mode:vn
  3108. mode type: <type 'str'>
  3109. nodes:512
  3110. nodes type: <type 'int'>
  3111. outputdir:/tmp
  3112. outputdir type: <type 'str'>
  3113. path:/tmp
  3114. path type: <type 'str'>
  3115. procs:1023
  3116. procs type: <type 'str'>
  3117. queue:default
  3118. queue type: <type 'str'>
  3119. run_project:False
  3120. run_project type: <type 'bool'>
  3121. script_preboot:True
  3122. script_preboot type: <type 'bool'>
  3123. tag:job
  3124. tag type: <type 'str'>
  3125. umask:18
  3126. umask type: <type 'int'>
  3127. user:gooduser
  3128. user type: <type 'str'>
  3129. user_list:['gooduser']
  3130. user_list type: <type 'list'>
  3131. walltime:10
  3132. walltime type: <type 'str'>
  3133. VALIDATE_JOB
  3134. attrs:{}
  3135. attrs type: <type 'dict'>
  3136. cwd:/tmp
  3137. cwd type: <type 'str'>
  3138. debug:False
  3139. debug type: <type 'bool'>
  3140. debuglog:False
  3141. debuglog type: <type 'bool'>
  3142. dependencies:False
  3143. dependencies type: <type 'bool'>
  3144. disable_preboot:False
  3145. disable_preboot type: <type 'bool'>
  3146. env:False
  3147. env type: <type 'bool'>
  3148. error:False
  3149. error type: <type 'bool'>
  3150. forcenoval:False
  3151. forcenoval type: <type 'bool'>
  3152. geometry:False
  3153. geometry type: <type 'bool'>
  3154. held:False
  3155. held type: <type 'bool'>
  3156. inputfile:False
  3157. inputfile type: <type 'bool'>
  3158. interactive:False
  3159. interactive type: <type 'bool'>
  3160. ion_kernel:default
  3161. ion_kernel type: <type 'str'>
  3162. ion_kerneloptions:False
  3163. ion_kerneloptions type: <type 'bool'>
  3164. jobname:False
  3165. jobname type: <type 'bool'>
  3166. kernel:default
  3167. kernel type: <type 'str'>
  3168. kerneloptions:False
  3169. kerneloptions type: <type 'bool'>
  3170. mode:vn
  3171. mode type: <type 'str'>
  3172. nodecount:512
  3173. nodecount type: <type 'str'>
  3174. notify:False
  3175. notify type: <type 'bool'>
  3176. output:False
  3177. output type: <type 'bool'>
  3178. outputprefix:False
  3179. outputprefix type: <type 'bool'>
  3180. preemptable:False
  3181. preemptable type: <type 'bool'>
  3182. proccount:1023
  3183. proccount type: <type 'str'>
  3184. project:False
  3185. project type: <type 'bool'>
  3186. queue:default
  3187. queue type: <type 'str'>
  3188. run_project:False
  3189. run_project type: <type 'bool'>
  3190. time:10
  3191. time type: <type 'str'>
  3192. umask:False
  3193. umask type: <type 'bool'>
  3194. user_list:False
  3195. user_list type: <type 'bool'>
  3196. verbose:False
  3197. verbose type: <type 'bool'>
  3198. version:False
  3199. version type: <type 'bool'>
  3200. """
  3201. stubout_file = "stub.out"
  3202. expected_results = (
  3203. 0, # Expected return status
  3204. cmdout, # Expected command output
  3205. stubout, # Expected stub functions output
  3206. cmderr, # Expected command error output
  3207. )
  3208. testutils.save_testhook("")
  3209. results = testutils.run_cmd('qsub.py',args,stubout_file)
  3210. result = testutils.validate_results(results,expected_results)
  3211. testutils.remove_testhook()
  3212. correct = 1
  3213. assert result == correct, "Result:\n%s" % result
  3214. # ---------------------------------------------------------------------------------
  3215. def test_qsub_mode_option_3():
  3216. """
  3217. qsub test run: mode_option_3
  3218. """
  3219. args = """--mode script -t50 -n10 --geometry 40x40x50x50 /bin/ls"""
  3220. cmdout = \
  3221. """1
  3222. """
  3223. cmderr = ''
  3224. stubout = \
  3225. """
  3226. ADD_JOBS
  3227. args:[]
  3228. args type: <type 'list'>
  3229. command:/bin/ls
  3230. command type: <type 'str'>
  3231. cwd:/tmp
  3232. cwd type: <type 'str'>
  3233. geometry:[40, 40, 50, 50, 2]
  3234. geometry type: <type 'list'>
  3235. ion_kernel:default
  3236. ion_kernel type: <type 'str'>
  3237. jobid:*
  3238. jobid type: <type 'str'>
  3239. kernel:default
  3240. kernel type: <type 'str'>
  3241. mode:script
  3242. mode type: <type 'str'>
  3243. nodes:10
  3244. nodes type: <type 'int'>
  3245. outputdir:/tmp
  3246. outputdir type: <type 'str'>
  3247. path:/tmp
  3248. path type: <type 'str'>
  3249. procs:512
  3250. procs type: <type 'str'>
  3251. queue:default
  3252. queue type: <type 'str'>
  3253. run_project:False
  3254. run_project type: <type 'bool'>
  3255. script_preboot:True
  3256. script_preboot type: <type 'bool'>
  3257. tag:job
  3258. tag type: <type 'str'>
  3259. umask:18
  3260. umask type: <type 'int'>
  3261. user:gooduser
  3262. user type: <type 'str'>
  3263. user_list:['gooduser']
  3264. user_list type: <type 'list'>
  3265. walltime:50
  3266. walltime type: <type 'str'>
  3267. VALIDATE_JOB
  3268. attrs:{}
  3269. attrs type: <type 'dict'>
  3270. cwd:/tmp
  3271. cwd type: <type 'str'>
  3272. debug:False
  3273. debug type: <type 'bool'>
  3274. debuglog:False
  3275. debuglog type: <type 'bool'>
  3276. dependencies:False
  3277. dependencies type: <type 'bool'>
  3278. disable_preboot:False
  3279. disable_preboot type: <type 'bool'>
  3280. env:False
  3281. env type: <type 'bool'>
  3282. error:False
  3283. error type: <type 'bool'>
  3284. forcenoval:False
  3285. forcenoval type: <type 'bool'>
  3286. geometry:40x40x50x50
  3287. geometry type: <type 'str'>
  3288. held:False
  3289. held type: <type 'bool'>
  3290. inputfile:False
  3291. inputfile type: <type 'bool'>
  3292. interactive:False
  3293. interactive type: <type 'bool'>
  3294. ion_kernel:default
  3295. ion_kernel type: <type 'str'>
  3296. ion_kerneloptions:False
  3297. ion_kerneloptions type: <type 'bool'>
  3298. jobname:False
  3299. jobname type: <type 'bool'>
  3300. kernel:default
  3301. kernel type: <type 'str'>
  3302. kerneloptions:False
  3303. kerneloptions type: <type 'bool'>
  3304. mode:script
  3305. mode type: <type 'str'>
  3306. nodecount:10
  3307. nodecount type: <type 'str'>
  3308. notify:False
  3309. notify type: <type 'bool'>
  3310. output:False
  3311. output type: <type 'bool'>
  3312. outputprefix:False
  3313. outputprefix type: <type 'bool'>
  3314. preemptable:False
  3315. preemptable type: <type 'bool'>
  3316. proccount:False
  3317. proccount type: <type 'bool'>
  3318. project:False
  3319. project type: <type 'bool'>
  3320. queue:default
  3321. queue type: <type 'str'>
  3322. run_project:False
  3323. run_project type: <type 'bool'>
  3324. time:50
  3325. time type: <type 'str'>
  3326. umask:False
  3327. umask type: <type 'bool'>
  3328. user_list:False
  3329. user_list type: <type 'bool'>
  3330. verbose:False
  3331. verbose type: <type 'bool'>
  3332. version:False
  3333. version type: <type 'bool'>
  3334. """
  3335. stubout_file = "stub.out"
  3336. expected_results = (
  3337. 0, # Expected return status
  3338. cmdout, # Expected command output
  3339. stubout, # Expected stub functions output
  3340. cmderr, # Expected command error output
  3341. )
  3342. testutils.save_testhook("")
  3343. results = testutils.run_cmd('qsub.py',args,stubout_file)
  3344. result = testutils.validate_results(results,expected_results)
  3345. testutils.remove_testhook()
  3346. correct = 1
  3347. assert result == correct, "Result:\n%s" % result
  3348. # ---------------------------------------------------------------------------------
  3349. def test_qsub_mode_option_4():
  3350. """
  3351. qsub test run: mode_option_4
  3352. """
  3353. args = """-A Acceptance -q testing -n 49152 -t 60 --mode script /bin/ls"""
  3354. cmdout = ''
  3355. cmderr = \
  3356. """node count out of realistic range
  3357. """
  3358. stubout = ''
  3359. stubout_file = "stub.out"
  3360. expected_results = (
  3361. 256, # Expected return status
  3362. cmdout, # Expected command output
  3363. stubout, # Expected stub functions output
  3364. cmderr, # Expected command error output
  3365. )
  3366. testutils.save_testhook("")
  3367. results = testutils.run_cmd('qsub.py',args,stubout_file)
  3368. result = testutils.validate_results(results,expected_results)
  3369. testutils.remove_testhook()
  3370. correct = 1
  3371. assert result == correct, "Result:\n%s" % result
  3372. # ---------------------------------------------------------------------------------
  3373. def test_qsub_preboot_option():
  3374. """
  3375. qsub test run: preboot_option
  3376. """
  3377. args = """--disable_preboot -t10 -n512 --proccount 1023 --mode vn /bin/ls"""
  3378. cmdout = \
  3379. """1
  3380. """
  3381. cmderr = ''
  3382. stubout = \
  3383. """
  3384. ADD_JOBS
  3385. args:[]
  3386. args type: <type 'list'>
  3387. command:/bin/ls
  3388. command type: <type 'str'>
  3389. cwd:/tmp
  3390. cwd type: <type 'str'>
  3391. ion_kernel:default
  3392. ion_kernel type: <type 'str'>
  3393. jobid:*
  3394. jobid type: <type 'str'>
  3395. kernel:default
  3396. kernel type: <type 'str'>
  3397. mode:vn
  3398. mode type: <type 'str'>
  3399. nodes:512
  3400. nodes type: <type 'int'>
  3401. outputdir:/tmp
  3402. outputdir type: <type 'str'>
  3403. path:/tmp
  3404. path type: <type 'str'>
  3405. procs:1023
  3406. procs type: <type 'str'>
  3407. queue:default
  3408. queue type: <type 'str'>
  3409. run_project:False
  3410. run_project type: <type 'bool'>
  3411. script_preboot:False
  3412. script_preboot type: <type 'bool'>
  3413. tag:job
  3414. tag type: <type 'str'>
  3415. umask:18
  3416. umask type: <type 'int'>
  3417. user:gooduser
  3418. user type: <type 'str'>
  3419. user_list:['gooduser']
  3420. user_list type: <type 'list'>
  3421. walltime:10
  3422. walltime type: <type 'str'>
  3423. VALIDATE_JOB
  3424. attrs:{}
  3425. attrs type: <type 'dict'>
  3426. cwd:/tmp
  3427. cwd type: <type 'str'>
  3428. debug:False
  3429. debug type: <type 'bool'>
  3430. debuglog:False
  3431. debuglog type: <type 'bool'>
  3432. dependencies:False
  3433. dependencies type: <type 'bool'>
  3434. disable_preboot:True
  3435. disable_preboot type: <type 'bool'>
  3436. env:False
  3437. env type: <type 'bool'>
  3438. error:False
  3439. error type: <type 'bool'>
  3440. forcenoval:False
  3441. forcenoval type: <type 'bool'>
  3442. geometry:False
  3443. geometry type: <type 'bool'>
  3444. held:False
  3445. held type: <type 'bool'>
  3446. inputfile:False
  3447. inputfile type: <type 'bool'>
  3448. interactive:False
  3449. interactive type: <type 'bool'>
  3450. ion_kernel:default
  3451. ion_kernel type: <type 'str'>
  3452. ion_kerneloptions:False
  3453. ion_kerneloptions type: <type 'bool'>
  3454. jobname:False
  3455. jobname type: <type 'bool'>
  3456. kernel:default
  3457. kernel type: <type 'str'>
  3458. kerneloptions:False
  3459. kerneloptions type: <type 'bool'>
  3460. mode:vn
  3461. mode type: <type 'str'>
  3462. nodecount:512
  3463. nodecount type: <type 'str'>
  3464. notify:False
  3465. notify type: <type 'bool'>
  3466. output:False
  3467. output type: <type 'bool'>
  3468. outputprefix:False
  3469. outputprefix type: <type 'bool'>
  3470. preemptable:False
  3471. preemptable type: <type 'bool'>
  3472. proccount:1023
  3473. proccount type: <type 'str'>
  3474. project:False
  3475. project type: <type 'bool'>
  3476. queue:default
  3477. queue type: <type 'str'>
  3478. run_project:False
  3479. run_project type: <type 'bool'>
  3480. time:10
  3481. time type: <type 'str'>
  3482. umask:False
  3483. umask type: <type 'bool'>
  3484. user_list:False
  3485. user_list type: <type 'bool'>
  3486. verbose:False
  3487. verbose type: <type 'bool'>
  3488. version:False
  3489. version type: <type 'bool'>
  3490. """
  3491. stubout_file = "stub.out"
  3492. expected_results = (
  3493. 0, # Expected return status
  3494. cmdout, # Expected command output
  3495. stubout, # Expected stub functions output
  3496. cmderr, # Expected command error output
  3497. )
  3498. testutils.save_testhook("")
  3499. results = testutils.run_cmd('qsub.py',args,stubout_file)
  3500. result = testutils.validate_results(results,expected_results)
  3501. testutils.remove_testhook()
  3502. correct = 1
  3503. assert result == correct, "Result:\n%s" % result
  3504. # ---------------------------------------------------------------------------------
  3505. def test_qsub_env_option_1():
  3506. """
  3507. qsub test run: env_option_1
  3508. """
  3509. args = """--env var1=val1,var2=val2 -t50 -n10 /bin/ls"""
  3510. cmdout = \
  3511. """1
  3512. """
  3513. cmderr = ''
  3514. stubout = \
  3515. """
  3516. ADD_JOBS
  3517. args:[]
  3518. args type: <type 'list'>
  3519. command:/bin/ls
  3520. command type: <type 'str'>
  3521. cwd:/tmp
  3522. cwd type: <type 'str'>
  3523. envs:{'var1': 'val1,var2=val2'}
  3524. envs type: <type 'dict'>
  3525. ion_kernel:default
  3526. ion_kernel type: <type 'str'>
  3527. jobid:*
  3528. jobid type: <type 'str'>
  3529. kernel:default
  3530. kernel type: <type 'str'>
  3531. mode:c1
  3532. mode type: <type 'str'>
  3533. nodes:10
  3534. nodes type: <type 'int'>
  3535. outputdir:/tmp
  3536. outputdir type: <type 'str'>
  3537. path:/tmp
  3538. path type: <type 'str'>
  3539. procs:512
  3540. procs type: <type 'str'>
  3541. queue:default
  3542. queue type: <type 'str'>
  3543. run_project:False
  3544. run_project type: <type 'bool'>
  3545. script_preboot:True
  3546. script_preboot type: <type 'bool'>
  3547. tag:job
  3548. tag type: <type 'str'>
  3549. umask:18
  3550. umask type: <type 'int'>
  3551. user:gooduser
  3552. user type: <type 'str'>
  3553. user_list:['gooduser']
  3554. user_list type: <type 'list'>
  3555. walltime:50
  3556. walltime type: <type 'str'>
  3557. VALIDATE_JOB
  3558. attrs:{}
  3559. attrs type: <type 'dict'>
  3560. cwd:/tmp
  3561. cwd type: <type 'str'>
  3562. debug:False
  3563. debug type: <type 'bool'>
  3564. debuglog:False
  3565. debuglog type: <type 'bool'>
  3566. dependencies:False
  3567. dependencies type: <type 'bool'>
  3568. disable_preboot:False
  3569. disable_preboot type: <type 'bool'>
  3570. env:var1=val1,var2=val2
  3571. env type: <type 'str'>
  3572. error:False
  3573. error type: <type 'bool'>
  3574. forcenoval:False
  3575. forcenoval type: <type 'bool'>
  3576. geometry:False
  3577. geometry type: <type 'bool'>
  3578. held:False
  3579. held type: <type 'bool'>
  3580. inputfile:False
  3581. inputfile type: <type 'bool'>
  3582. interactive:False
  3583. interactive type: <type 'bool'>
  3584. ion_kernel:default
  3585. ion_kernel type: <type 'str'>
  3586. ion_kerneloptions:False
  3587. ion_kerneloptions type: <type 'bool'>
  3588. jobname:False
  3589. jobname type: <type 'bool'>
  3590. kernel:default
  3591. kernel type: <type 'str'>
  3592. kerneloptions:False
  3593. kerneloptions type: <type 'bool'>
  3594. mode:False
  3595. mode type: <type 'bool'>
  3596. nodecount:10
  3597. nodecount type: <type 'str'>
  3598. notify:False
  3599. notify type: <type 'bool'>
  3600. output:False
  3601. output type: <type 'bool'>
  3602. outputprefix:False
  3603. outputprefix type: <type 'bool'>
  3604. preemptable:False
  3605. preemptable type: <type 'bool'>
  3606. proccount:False
  3607. proccount type: <type 'bool'>
  3608. project:False
  3609. project type: <type 'bool'>
  3610. queue:default
  3611. queue type: <type 'str'>
  3612. run_project:False
  3613. run_project type: <type 'bool'>
  3614. time:50
  3615. time type: <type 'str'>
  3616. umask:False
  3617. umask type: <type 'bool'>
  3618. user_list:False
  3619. user_list type: <type 'bool'>
  3620. verbose:False
  3621. verbose type: <type 'bool'>
  3622. version:False
  3623. version type: <type 'bool'>
  3624. """
  3625. stubout_file = "stub.out"
  3626. expected_results = (
  3627. 0, # Expected return status
  3628. cmdout, # Expected command output
  3629. stubout, # Expected stub functions output
  3630. cmderr, # Expected command error output
  3631. )
  3632. testutils.save_testhook("")
  3633. results = testutils.run_cmd('qsub.py',args,stubout_file)
  3634. result = testutils.validate_results(results,expected_results)
  3635. testutils.remove_testhook()
  3636. correct = 1
  3637. assert result == correct, "Result:\n%s" % result
  3638. # ---------------------------------------------------------------------------------
  3639. def test_qsub_env_option_2():
  3640. """
  3641. qsub test run: env_option_2
  3642. """
  3643. args = """--env var1=val1:var2=val2 -t50 -n10 /bin/ls"""
  3644. cmdout = \
  3645. """1
  3646. """
  3647. cmderr = ''
  3648. stubout = \
  3649. """
  3650. ADD_JOBS
  3651. args:[]
  3652. args type: <type 'list'>
  3653. command:/bin/ls
  3654. command type: <type 'str'>
  3655. cwd:/tmp
  3656. cwd type: <type 'str'>
  3657. envs:{'var1': 'val1', 'var2': 'val2'}
  3658. envs type: <type 'dict'>
  3659. ion_kernel:default
  3660. ion_kernel type: <type 'str'>
  3661. jobid:*
  3662. jobid type: <type 'str'>
  3663. kernel:default
  3664. kernel type: <type 'str'>
  3665. mode:c1
  3666. mode type: <type 'str'>
  3667. nodes:10
  3668. nodes type: <type 'int'>
  3669. outputdir:/tmp
  3670. outputdir type: <type 'str'>
  3671. path:/tmp
  3672. path type: <type 'str'>
  3673. procs:512
  3674. procs type: <type 'str'>
  3675. queue:default
  3676. queue type: <type 'str'>
  3677. run_project:False
  3678. run_project type: <type 'bool'>
  3679. script_preboot:True
  3680. script_preboot type: <type 'bool'>
  3681. tag:job
  3682. tag type: <type 'str'>
  3683. umask:18
  3684. umask type: <type 'int'>
  3685. user:gooduser
  3686. user type: <type 'str'>
  3687. user_list:['gooduser']
  3688. user_list type: <type 'list'>
  3689. walltime:50
  3690. walltime type: <type 'str'>
  3691. VALIDATE_JOB
  3692. attrs:{}
  3693. attrs type: <type 'dict'>
  3694. cwd:/tmp
  3695. cwd type: <type 'str'>
  3696. debug:False
  3697. debug type: <type 'bool'>
  3698. debuglog:False
  3699. debuglog type: <type 'bool'>
  3700. dependencies:False
  3701. dependencies type: <type 'bool'>
  3702. disable_preboot:False
  3703. disable_preboot type: <type 'bool'>
  3704. env:var1=val1:var2=val2
  3705. env type: <type 'str'>
  3706. error:False
  3707. error type: <type 'bool'>
  3708. forcenoval:False
  3709. forcenoval type: <type 'bool'>
  3710. geometry:False
  3711. geometry type: <type 'bool'>
  3712. held:False
  3713. held type: <type 'bool'>
  3714. inputfile:False
  3715. inputfile type: <type 'bool'>
  3716. interactive:False
  3717. interactive type: <type 'bool'>
  3718. ion_kernel:default
  3719. ion_kernel type: <type 'str'>
  3720. ion_kerneloptions:False
  3721. ion_kerneloptions type: <type 'bool'>
  3722. jobname:False
  3723. jobname type: <type 'bool'>
  3724. kernel:default
  3725. kernel type: <type 'str'>
  3726. kerneloptions:False
  3727. kerneloptions type: <type 'bool'>
  3728. mode:False
  3729. mode type: <type 'bool'>
  3730. nodecount:10
  3731. nodecount type: <type 'str'>
  3732. notify:False
  3733. notify type: <type 'bool'>
  3734. output:False
  3735. output type: <type 'bool'>
  3736. outputprefix:False
  3737. outputprefix type: <type 'bool'>
  3738. preemptable:False
  3739. preemptable type: <type 'bool'>
  3740. proccount:False
  3741. proccount type: <type 'bool'>
  3742. project:False
  3743. project type: <type 'bool'>
  3744. queue:default
  3745. queue type: <type 'str'>
  3746. run_project:False
  3747. run_project type: <type 'bool'>
  3748. time:50
  3749. time type: <type 'str'>
  3750. umask:False
  3751. umask type: <type 'bool'>
  3752. user_list:False
  3753. user_list type: <type 'bool'>
  3754. verbose:False
  3755. verbose type: <type 'bool'>
  3756. version:False
  3757. version type: <type 'bool'>
  3758. """
  3759. stubout_file = "stub.out"
  3760. expected_results = (
  3761. 0, # Expected return status
  3762. cmdout, # Expected command output
  3763. stubout, # Expected stub functions output
  3764. cmderr, # Expected command error output
  3765. )
  3766. testutils.save_testhook("")
  3767. results = testutils.run_cmd('qsub.py',args,stubout_file)
  3768. result = testutils.validate_results(results,expected_results)
  3769. testutils.remove_testhook()
  3770. correct = 1
  3771. assert result == correct, "Result:\n%s" % result
  3772. # ---------------------------------------------------------------------------------
  3773. def test_qsub_env_option_3():
  3774. """
  3775. qsub test run: env_option_3
  3776. """
  3777. args = """--env "var1=val1:var2=svar1\=sval1\:svar2\=sval2:var3=val3" -t50 -n10 -d /bin/ls"""
  3778. cmdout = \
  3779. """1
  3780. """
  3781. cmderr = \
  3782. """
  3783. qsub.py --env var1=val1:var2=svar1\=sval1\:svar2\=sval2:var3=val3 -t50 -n10 -d /bin/ls
  3784. component: "system.validate_job", defer: False
  3785. validate_job(
  3786. {'kernel': 'default', 'verbose': False, 'held': False, 'notify': False, 'ion_kerneloptions': False, 'project': False, 'preemptable': False, 'outputprefix': False, 'umask': False, 'version': False, 'env': 'var1=val1:var2=svar1\\=sval1\\:svar2\\=sval2:var3=val3', 'cwd': '/tmp', 'run_project': False, 'forcenoval': False, 'kerneloptions': False, 'time': '50', 'jobname': False, 'debug': True, 'dependencies': False, 'debuglog': False, 'ion_kernel': 'default', 'proccount': False, 'disable_preboot': False, 'geometry': False, 'queue': 'default', 'mode': False, 'error': False, 'nodecount': '10', 'output': False, 'inputfile': False, 'attrs': {}, 'user_list': False, 'interactive': False},
  3787. )
  3788. component: "queue-manager.add_jobs", defer: False
  3789. add_jobs(
  3790. [{'kernel': 'default', 'args': [], 'outputdir': '/tmp', 'envs': {'var1': 'val1', 'var3': 'val3', 'var2': 'svar1=sval1:svar2=sval2'}, 'user_list': ['gooduser'], 'umask': 18, 'jobid': '*', 'queue': 'default', 'script_preboot': True, 'tag': 'job', 'command': '/bin/ls', 'mode': 'c1', 'run_project': False, 'path': '/tmp', 'nodes': 10, 'walltime': '50', 'ion_kernel': 'default', 'cwd': '/tmp', 'procs': '512', 'user': 'gooduser'}],
  3791. )
  3792. Environment Vars: {'var1': 'val1', 'var3': 'val3', 'var2': 'svar1=sval1:svar2=sval2'}
  3793. """
  3794. stubout = \
  3795. """
  3796. ADD_JOBS
  3797. args:[]
  3798. args type: <type 'list'>
  3799. command:/bin/ls
  3800. command type: <type 'str'>
  3801. cwd:/tmp
  3802. cwd type: <type 'str'>
  3803. envs:{'var1': 'val1', 'var3': 'val3', 'var2': 'svar1=sval1:svar2=sval2'}
  3804. envs type: <type 'dict'>
  3805. ion_kernel:default
  3806. ion_kernel type: <type 'str'>
  3807. jobid:*
  3808. jobid type: <type 'str'>
  3809. kernel:default
  3810. kernel type: <type 'str'>
  3811. mode:c1
  3812. mode type: <type 'str'>
  3813. nodes:10
  3814. nodes type: <type 'int'>
  3815. outputdir:/tmp
  3816. outputdir type: <type 'str'>
  3817. path:/tmp
  3818. path type: <type 'str'>
  3819. procs:512
  3820. procs type: <type 'str'>
  3821. queue:default
  3822. queue type: <type 'str'>
  3823. run_project:False
  3824. run_project type: <type 'bool'>
  3825. script_preboot:True
  3826. script_preboot type: <type 'bool'>
  3827. tag:job
  3828. tag type: <type 'str'>
  3829. umask:18
  3830. umask type: <type 'int'>
  3831. user:gooduser
  3832. user type: <type 'str'>
  3833. user_list:['gooduser']
  3834. user_list type: <type 'list'>
  3835. walltime:50
  3836. walltime type: <type 'str'>
  3837. VALIDATE_JOB
  3838. attrs:{}
  3839. attrs type: <type 'dict'>
  3840. cwd:/tmp
  3841. cwd type: <type 'str'>
  3842. debug:True
  3843. debug type: <type 'bool'>
  3844. debuglog:False
  3845. debuglog type: <type 'bool'>
  3846. dependencies:False
  3847. dependencies type: <type 'bool'>
  3848. disable_preboot:False
  3849. disable_preboot type: <type 'bool'>
  3850. env:var1=val1:var2=svar1\=sval1\:svar2\=sval2:var3=val3
  3851. env type: <type 'str'>
  3852. error:False
  3853. error type: <type 'bool'>
  3854. forcenoval:False
  3855. forcenoval type: <type 'bool'>
  3856. geometry:False
  3857. geometry type: <type 'bool'>
  3858. held:False
  3859. held type: <type 'bool'>
  3860. inputfile:False
  3861. inputfile type: <type 'bool'>
  3862. interactive:False
  3863. interactive type: <type 'bool'>
  3864. ion_kernel:default
  3865. ion_kernel type: <type 'str'>
  3866. ion_kerneloptions:False
  3867. ion_kerneloptions type: <type 'bool'>
  3868. jobname:False
  3869. jobname type: <type 'bool'>
  3870. kernel:default
  3871. kernel type: <type 'str'>
  3872. kerneloptions:False
  3873. kerneloptions type: <type 'bool'>
  3874. mode:False
  3875. mode type: <type 'bool'>
  3876. nodecount:10
  3877. nodecount type: <type 'str'>
  3878. notify:False
  3879. notify type: <type 'bool'>
  3880. output:False
  3881. output type: <type 'bool'>
  3882. outputprefix:False
  3883. outputprefix type: <type 'bool'>
  3884. preemptable:False
  3885. preemptable type: <type 'bool'>
  3886. proccount:False
  3887. proccount type: <type 'bool'>
  3888. project:False
  3889. project type: <type 'bool'>
  3890. queue:default
  3891. queue type: <type 'str'>
  3892. run_project:False
  3893. run_project type: <type 'bool'>
  3894. time:50
  3895. time type: <type 'str'>
  3896. umask:False
  3897. umask type: <type 'bool'>
  3898. user_list:False
  3899. user_list type: <type 'bool'>
  3900. verbose:False
  3901. verbose type: <type 'bool'>
  3902. version:False
  3903. version type: <type 'bool'>
  3904. """
  3905. stubout_file = "stub.out"
  3906. expected_results = (
  3907. 0, # Expected return status
  3908. cmdout, # Expected command output
  3909. stubout, # Expected stub functions output
  3910. cmderr, # Expected command error output
  3911. )
  3912. testutils.save_testhook("")
  3913. results = testutils.run_cmd('qsub.py',args,stubout_file)
  3914. result = testutils.validate_results(results,expected_results)
  3915. testutils.remove_testhook()
  3916. correct = 1
  3917. assert result == correct, "Result:\n%s" % result
  3918. # ---------------------------------------------------------------------------------
  3919. def test_qsub_env_option_4():
  3920. """
  3921. qsub test run: env_option_4
  3922. """
  3923. args = """--env var1=val1 --env "var2=svar1\=sval1\:svar2\=sval2" --env var3=val3 -t50 -n10 /bin/ls"""
  3924. cmdout = \
  3925. """1
  3926. """
  3927. cmderr = ''
  3928. stubout = \
  3929. """
  3930. ADD_JOBS
  3931. args:[]
  3932. args type: <type 'list'>
  3933. command:/bin/ls
  3934. command type: <type 'str'>
  3935. cwd:/tmp
  3936. cwd type: <type 'str'>
  3937. envs:{'var1': 'val1', 'var3': 'val3', 'var2': 'svar1=sval1:svar2=sval2'}
  3938. envs type: <type 'dict'>
  3939. ion_kernel:default
  3940. ion_kernel type: <type 'str'>
  3941. jobid:*
  3942. jobid type: <type 'str'>
  3943. kernel:default
  3944. kernel type: <type 'str'>
  3945. mode:c1
  3946. mode type: <type 'str'>
  3947. nodes:10
  3948. nodes type: <type 'int'>
  3949. outputdir:/tmp
  3950. outputdir type: <type 'str'>
  3951. path:/tmp
  3952. path type: <type 'str'>
  3953. procs:512
  3954. procs type: <type 'str'>
  3955. queue:default
  3956. queue type: <type 'str'>
  3957. run_project:False
  3958. run_project type: <type 'bool'>
  3959. script_preboot:True
  3960. script_preboot type: <type 'bool'>
  3961. tag:job
  3962. tag type: <type 'str'>
  3963. umask:18
  3964. umask type: <type 'int'>
  3965. user:gooduser
  3966. user type: <type 'str'>
  3967. user_list:['gooduser']
  3968. user_list type: <type 'list'>
  3969. walltime:50
  3970. walltime type: <type 'str'>
  3971. VALIDATE_JOB
  3972. attrs:{}
  3973. attrs type: <type 'dict'>
  3974. cwd:/tmp
  3975. cwd type: <type 'str'>
  3976. debug:False
  3977. debug type: <type 'bool'>
  3978. debuglog:False
  3979. debuglog type: <type 'bool'>
  3980. dependencies:False
  3981. dependencies type: <type 'bool'>
  3982. disable_preboot:False
  3983. disable_preboot type: <type 'bool'>
  3984. env:var1=val1:var2=svar1\=sval1\:svar2\=sval2:var3=val3
  3985. env type: <type 'str'>
  3986. error:False
  3987. error type: <type 'bool'>
  3988. forcenoval:False
  3989. forcenoval type: <type 'bool'>
  3990. geometry:False
  3991. geometry type: <type 'bool'>
  3992. held:False
  3993. held type: <type 'bool'>
  3994. inputfile:False
  3995. inputfile type: <type 'bool'>
  3996. interactive:False
  3997. interactive type: <type 'bool'>
  3998. ion_kernel:default
  3999. ion_kernel type: <type 'str'>
  4000. ion_kerneloptions:False
  4001. ion_kerneloptions type: <type 'bool'>
  4002. jobname:False
  4003. jobname type: <type 'bool'>
  4004. kernel:default
  4005. kernel type: <type 'str'>
  4006. kerneloptions:False
  4007. kerneloptions type: <type 'bool'>
  4008. mode:False
  4009. mode type: <type 'bool'>
  4010. nodecount:10
  4011. nodecount type: <type 'str'>
  4012. notify:False
  4013. notify type: <type 'bool'>
  4014. output:False
  4015. output type: <type 'bool'>
  4016. outputprefix:False
  4017. outputprefix type: <type 'bool'>
  4018. preemptable:False
  4019. preemptable type: <type 'bool'>
  4020. proccount:False
  4021. proccount type: <type 'bool'>
  4022. project:False
  4023. project type: <type 'bool'>
  4024. queue:default
  4025. queue type: <type 'str'>
  4026. run_project:False
  4027. run_project type: <type 'bool'>
  4028. time:50
  4029. time type: <type 'str'>
  4030. umask:False
  4031. umask type: <type 'bool'>
  4032. user_list:False
  4033. user_list type: <type 'bool'>
  4034. verbose:False
  4035. verbose type: <type 'bool'>
  4036. version:False
  4037. version type: <type 'bool'>
  4038. """
  4039. stubout_file = "stub.out"
  4040. expected_results = (
  4041. 0, # Expected return status
  4042. cmdout, # Expected command output
  4043. stubout, # Expected stub functions output
  4044. cmderr, # Expected command error output
  4045. )
  4046. testutils.save_testhook("")
  4047. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4048. result = testutils.validate_results(results,expected_results)
  4049. testutils.remove_testhook()
  4050. correct = 1
  4051. assert result == correct, "Result:\n%s" % result
  4052. # ---------------------------------------------------------------------------------
  4053. def test_qsub_script_1():
  4054. """
  4055. qsub test run: script_1
  4056. """
  4057. args = """cobalt_script1.sh"""
  4058. cmdout = \
  4059. """1
  4060. """
  4061. cmderr = ''
  4062. stubout = \
  4063. """
  4064. ADD_JOBS
  4065. args:[]
  4066. args type: <type 'list'>
  4067. command:/tmp/cobalt_script1.sh
  4068. command type: <type 'str'>
  4069. cwd:/tmp
  4070. cwd type: <type 'str'>
  4071. envs:{'a': '1', 'c': '3', 'b': '2'}
  4072. envs type: <type 'dict'>
  4073. ion_kernel:default
  4074. ion_kernel type: <type 'str'>
  4075. jobid:*
  4076. jobid type: <type 'str'>
  4077. kernel:default
  4078. kernel type: <type 'str'>
  4079. mode:script
  4080. mode type: <type 'str'>
  4081. nodes:100
  4082. nodes type: <type 'int'>
  4083. outputdir:/tmp
  4084. outputdir type: <type 'str'>
  4085. path:/tmp
  4086. path type: <type 'str'>
  4087. procs:512
  4088. procs type: <type 'str'>
  4089. queue:default
  4090. queue type: <type 'str'>
  4091. run_project:False
  4092. run_project type: <type 'bool'>
  4093. script_preboot:True
  4094. script_preboot type: <type 'bool'>
  4095. tag:job
  4096. tag type: <type 'str'>
  4097. umask:18
  4098. umask type: <type 'int'>
  4099. user:gooduser
  4100. user type: <type 'str'>
  4101. user_list:['gooduser']
  4102. user_list type: <type 'list'>
  4103. walltime:75
  4104. walltime type: <type 'str'>
  4105. VALIDATE_JOB
  4106. attrs:{}
  4107. attrs type: <type 'dict'>
  4108. cwd:/tmp
  4109. cwd type: <type 'str'>
  4110. debug:False
  4111. debug type: <type 'bool'>
  4112. debuglog:False
  4113. debuglog type: <type 'bool'>
  4114. dependencies:False
  4115. dependencies type: <type 'bool'>
  4116. disable_preboot:False
  4117. disable_preboot type: <type 'bool'>
  4118. env:a=1:c=3:b=2
  4119. env type: <type 'str'>
  4120. error:False
  4121. error type: <type 'bool'>
  4122. forcenoval:False
  4123. forcenoval type: <type 'bool'>
  4124. geometry:False
  4125. geometry type: <type 'bool'>
  4126. held:False
  4127. held type: <type 'bool'>
  4128. inputfile:False
  4129. inputfile type: <type 'bool'>
  4130. interactive:False
  4131. interactive type: <type 'bool'>
  4132. ion_kernel:default
  4133. ion_kernel type: <type 'str'>
  4134. ion_kerneloptions:False
  4135. ion_kerneloptions type: <type 'bool'>
  4136. jobname:False
  4137. jobname type: <type 'bool'>
  4138. kernel:default
  4139. kernel type: <type 'str'>
  4140. kerneloptions:False
  4141. kerneloptions type: <type 'bool'>
  4142. mode:script
  4143. mode type: <type 'str'>
  4144. nodecount:100
  4145. nodecount type: <type 'str'>
  4146. notify:False
  4147. notify type: <type 'bool'>
  4148. output:False
  4149. output type: <type 'bool'>
  4150. outputprefix:False
  4151. outputprefix type: <type 'bool'>
  4152. preemptable:False
  4153. preemptable type: <type 'bool'>
  4154. proccount:False
  4155. proccount type: <type 'bool'>
  4156. project:False
  4157. project type: <type 'bool'>
  4158. queue:default
  4159. queue type: <type 'str'>
  4160. run_project:False
  4161. run_project type: <type 'bool'>
  4162. time:75
  4163. time type: <type 'str'>
  4164. umask:False
  4165. umask type: <type 'bool'>
  4166. user_list:False
  4167. user_list type: <type 'bool'>
  4168. verbose:False
  4169. verbose type: <type 'bool'>
  4170. version:False
  4171. version type: <type 'bool'>
  4172. """
  4173. stubout_file = "stub.out"
  4174. expected_results = (
  4175. 0, # Expected return status
  4176. cmdout, # Expected command output
  4177. stubout, # Expected stub functions output
  4178. cmderr, # Expected command error output
  4179. )
  4180. testutils.save_testhook("")
  4181. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4182. result = testutils.validate_results(results,expected_results)
  4183. testutils.remove_testhook()
  4184. correct = 1
  4185. assert result == correct, "Result:\n%s" % result
  4186. # ---------------------------------------------------------------------------------
  4187. def test_qsub_script_2():
  4188. """
  4189. qsub test run: script_2
  4190. """
  4191. args = """-t 50 cobalt_script1.sh"""
  4192. cmdout = \
  4193. """1
  4194. """
  4195. cmderr = ''
  4196. stubout = \
  4197. """
  4198. ADD_JOBS
  4199. args:[]
  4200. args type: <type 'list'>
  4201. command:/tmp/cobalt_script1.sh
  4202. command type: <type 'str'>
  4203. cwd:/tmp
  4204. cwd type: <type 'str'>
  4205. envs:{'a': '1', 'c': '3', 'b': '2'}
  4206. envs type: <type 'dict'>
  4207. ion_kernel:default
  4208. ion_kernel type: <type 'str'>
  4209. jobid:*
  4210. jobid type: <type 'str'>
  4211. kernel:default
  4212. kernel type: <type 'str'>
  4213. mode:script
  4214. mode type: <type 'str'>
  4215. nodes:100
  4216. nodes type: <type 'int'>
  4217. outputdir:/tmp
  4218. outputdir type: <type 'str'>
  4219. path:/tmp
  4220. path type: <type 'str'>
  4221. procs:512
  4222. procs type: <type 'str'>
  4223. queue:default
  4224. queue type: <type 'str'>
  4225. run_project:False
  4226. run_project type: <type 'bool'>
  4227. script_preboot:True
  4228. script_preboot type: <type 'bool'>
  4229. tag:job
  4230. tag type: <type 'str'>
  4231. umask:18
  4232. umask type: <type 'int'>
  4233. user:gooduser
  4234. user type: <type 'str'>
  4235. user_list:['gooduser']
  4236. user_list type: <type 'list'>
  4237. walltime:50
  4238. walltime type: <type 'str'>
  4239. VALIDATE_JOB
  4240. attrs:{}
  4241. attrs type: <type 'dict'>
  4242. cwd:/tmp
  4243. cwd type: <type 'str'>
  4244. debug:False
  4245. debug type: <type 'bool'>
  4246. debuglog:False
  4247. debuglog type: <type 'bool'>
  4248. dependencies:False
  4249. dependencies type: <type 'bool'>
  4250. disable_preboot:False
  4251. disable_preboot type: <type 'bool'>
  4252. env:a=1:c=3:b=2
  4253. env type: <type 'str'>
  4254. error:False
  4255. error type: <type 'bool'>
  4256. forcenoval:False
  4257. forcenoval type: <type 'bool'>
  4258. geometry:False
  4259. geometry type: <type 'bool'>
  4260. held:False
  4261. held type: <type 'bool'>
  4262. inputfile:False
  4263. inputfile type: <type 'bool'>
  4264. interactive:False
  4265. interactive type: <type 'bool'>
  4266. ion_kernel:default
  4267. ion_kernel type: <type 'str'>
  4268. ion_kerneloptions:False
  4269. ion_kerneloptions type: <type 'bool'>
  4270. jobname:False
  4271. jobname type: <type 'bool'>
  4272. kernel:default
  4273. kernel type: <type 'str'>
  4274. kerneloptions:False
  4275. kerneloptions type: <type 'bool'>
  4276. mode:script
  4277. mode type: <type 'str'>
  4278. nodecount:100
  4279. nodecount type: <type 'str'>
  4280. notify:False
  4281. notify type: <type 'bool'>
  4282. output:False
  4283. output type: <type 'bool'>
  4284. outputprefix:False
  4285. outputprefix type: <type 'bool'>
  4286. preemptable:False
  4287. preemptable type: <type 'bool'>
  4288. proccount:False
  4289. proccount type: <type 'bool'>
  4290. project:False
  4291. project type: <type 'bool'>
  4292. queue:default
  4293. queue type: <type 'str'>
  4294. run_project:False
  4295. run_project type: <type 'bool'>
  4296. time:50
  4297. time type: <type 'str'>
  4298. umask:False
  4299. umask type: <type 'bool'>
  4300. user_list:False
  4301. user_list type: <type 'bool'>
  4302. verbose:False
  4303. verbose type: <type 'bool'>
  4304. version:False
  4305. version type: <type 'bool'>
  4306. """
  4307. stubout_file = "stub.out"
  4308. expected_results = (
  4309. 0, # Expected return status
  4310. cmdout, # Expected command output
  4311. stubout, # Expected stub functions output
  4312. cmderr, # Expected command error output
  4313. )
  4314. testutils.save_testhook("")
  4315. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4316. result = testutils.validate_results(results,expected_results)
  4317. testutils.remove_testhook()
  4318. correct = 1
  4319. assert result == correct, "Result:\n%s" % result
  4320. # ---------------------------------------------------------------------------------
  4321. def test_qsub_script_3():
  4322. """
  4323. qsub test run: script_3
  4324. """
  4325. args = """--mode vn cobalt_script1.sh"""
  4326. cmdout = ''
  4327. cmderr = \
  4328. """Mode already set to 'script' and trying to set it again to 'vn'
  4329. """
  4330. stubout = ''
  4331. stubout_file = "stub.out"
  4332. expected_results = (
  4333. 256, # Expected return status
  4334. cmdout, # Expected command output
  4335. stubout, # Expected stub functions output
  4336. cmderr, # Expected command error output
  4337. )
  4338. testutils.save_testhook("")
  4339. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4340. result = testutils.validate_results(results,expected_results)
  4341. testutils.remove_testhook()
  4342. correct = 1
  4343. assert result == correct, "Result:\n%s" % result
  4344. # ---------------------------------------------------------------------------------
  4345. def test_qsub_script_4():
  4346. """
  4347. qsub test run: script_4
  4348. """
  4349. args = """-d cobalt_script2.sh"""
  4350. cmdout = ''
  4351. cmderr = \
  4352. """
  4353. qsub.py -d cobalt_script2.sh
  4354. Mode already set to 'script' and trying to set it again to 'vn'
  4355. """
  4356. stubout = ''
  4357. stubout_file = "stub.out"
  4358. expected_results = (
  4359. 256, # Expected return status
  4360. cmdout, # Expected command output
  4361. stubout, # Expected stub functions output
  4362. cmderr, # Expected command error output
  4363. )
  4364. testutils.save_testhook("")
  4365. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4366. result = testutils.validate_results(results,expected_results)
  4367. testutils.remove_testhook()
  4368. correct = 1
  4369. assert result == correct, "Result:\n%s" % result
  4370. # ---------------------------------------------------------------------------------
  4371. def test_qsub_walltime_0():
  4372. """
  4373. qsub test run: walltime_0
  4374. """
  4375. args = """-t0 -n 10 /bin/ls"""
  4376. cmdout = \
  4377. """1
  4378. """
  4379. cmderr = ''
  4380. stubout = \
  4381. """
  4382. ADD_JOBS
  4383. args:[]
  4384. args type: <type 'list'>
  4385. command:/bin/ls
  4386. command type: <type 'str'>
  4387. cwd:/tmp
  4388. cwd type: <type 'str'>
  4389. ion_kernel:default
  4390. ion_kernel type: <type 'str'>
  4391. jobid:*
  4392. jobid type: <type 'str'>
  4393. kernel:default
  4394. kernel type: <type 'str'>
  4395. mode:c1
  4396. mode type: <type 'str'>
  4397. nodes:10
  4398. nodes type: <type 'int'>
  4399. outputdir:/tmp
  4400. outputdir type: <type 'str'>
  4401. path:/tmp
  4402. path type: <type 'str'>
  4403. procs:512
  4404. procs type: <type 'str'>
  4405. queue:default
  4406. queue type: <type 'str'>
  4407. run_project:False
  4408. run_project type: <type 'bool'>
  4409. script_preboot:True
  4410. script_preboot type: <type 'bool'>
  4411. tag:job
  4412. tag type: <type 'str'>
  4413. umask:18
  4414. umask type: <type 'int'>
  4415. user:gooduser
  4416. user type: <type 'str'>
  4417. user_list:['gooduser']
  4418. user_list type: <type 'list'>
  4419. walltime:0
  4420. walltime type: <type 'str'>
  4421. VALIDATE_JOB
  4422. attrs:{}
  4423. attrs type: <type 'dict'>
  4424. cwd:/tmp
  4425. cwd type: <type 'str'>
  4426. debug:False
  4427. debug type: <type 'bool'>
  4428. debuglog:False
  4429. debuglog type: <type 'bool'>
  4430. dependencies:False
  4431. dependencies type: <type 'bool'>
  4432. disable_preboot:False
  4433. disable_preboot type: <type 'bool'>
  4434. env:False
  4435. env type: <type 'bool'>
  4436. error:False
  4437. error type: <type 'bool'>
  4438. forcenoval:False
  4439. forcenoval type: <type 'bool'>
  4440. geometry:False
  4441. geometry type: <type 'bool'>
  4442. held:False
  4443. held type: <type 'bool'>
  4444. inputfile:False
  4445. inputfile type: <type 'bool'>
  4446. interactive:False
  4447. interactive type: <type 'bool'>
  4448. ion_kernel:default
  4449. ion_kernel type: <type 'str'>
  4450. ion_kerneloptions:False
  4451. ion_kerneloptions type: <type 'bool'>
  4452. jobname:False
  4453. jobname type: <type 'bool'>
  4454. kernel:default
  4455. kernel type: <type 'str'>
  4456. kerneloptions:False
  4457. kerneloptions type: <type 'bool'>
  4458. mode:False
  4459. mode type: <type 'bool'>
  4460. nodecount:10
  4461. nodecount type: <type 'str'>
  4462. notify:False
  4463. notify type: <type 'bool'>
  4464. output:False
  4465. output type: <type 'bool'>
  4466. outputprefix:False
  4467. outputprefix type: <type 'bool'>
  4468. preemptable:False
  4469. preemptable type: <type 'bool'>
  4470. proccount:False
  4471. proccount type: <type 'bool'>
  4472. project:False
  4473. project type: <type 'bool'>
  4474. queue:default
  4475. queue type: <type 'str'>
  4476. run_project:False
  4477. run_project type: <type 'bool'>
  4478. time:0
  4479. time type: <type 'str'>
  4480. umask:False
  4481. umask type: <type 'bool'>
  4482. user_list:False
  4483. user_list type: <type 'bool'>
  4484. verbose:False
  4485. verbose type: <type 'bool'>
  4486. version:False
  4487. version type: <type 'bool'>
  4488. """
  4489. stubout_file = "stub.out"
  4490. expected_results = (
  4491. 0, # Expected return status
  4492. cmdout, # Expected command output
  4493. stubout, # Expected stub functions output
  4494. cmderr, # Expected command error output
  4495. )
  4496. testutils.save_testhook("")
  4497. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4498. result = testutils.validate_results(results,expected_results)
  4499. testutils.remove_testhook()
  4500. correct = 1
  4501. assert result == correct, "Result:\n%s" % result
  4502. # ---------------------------------------------------------------------------------
  4503. def test_qsub_interactive_1():
  4504. """
  4505. qsub test run: interactive_1
  4506. """
  4507. args = """-I -t50 -n 1 /bin/ls"""
  4508. cmdout = ''
  4509. cmderr = \
  4510. """An executable may not be specified if using the interactive option.
  4511. """
  4512. stubout = ''
  4513. stubout_file = "stub.out"
  4514. expected_results = (
  4515. 256, # Expected return status
  4516. cmdout, # Expected command output
  4517. stubout, # Expected stub functions output
  4518. cmderr, # Expected command error output
  4519. )
  4520. testutils.save_testhook("")
  4521. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4522. result = testutils.validate_results(results,expected_results)
  4523. testutils.remove_testhook()
  4524. correct = 1
  4525. assert result == correct, "Result:\n%s" % result
  4526. # ---------------------------------------------------------------------------------
  4527. def test_qsub_interactive_2():
  4528. """
  4529. qsub test run: interactive_2
  4530. """
  4531. args = """-I -t50 -n 1 -i inputfile"""
  4532. cmdout = ''
  4533. cmderr = \
  4534. """Cannot specify an input file for interactive jobs.
  4535. """
  4536. stubout = ''
  4537. stubout_file = "stub.out"
  4538. expected_results = (
  4539. 256, # Expected return status
  4540. cmdout, # Expected command output
  4541. stubout, # Expected stub functions output
  4542. cmderr, # Expected command error output
  4543. )
  4544. testutils.save_testhook("")
  4545. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4546. result = testutils.validate_results(results,expected_results)
  4547. testutils.remove_testhook()
  4548. correct = 1
  4549. assert result == correct, "Result:\n%s" % result
  4550. # ---------------------------------------------------------------------------------
  4551. def test_qsub_interactive_4():
  4552. """
  4553. qsub test run: interactive_4
  4554. """
  4555. args = """-I -t50 -n 1 --mode script"""
  4556. cmdout = ''
  4557. cmderr = \
  4558. """Mode already set to 'interactive' and trying to set it again to 'script'
  4559. """
  4560. stubout = ''
  4561. stubout_file = "stub.out"
  4562. expected_results = (
  4563. 256, # Expected return status
  4564. cmdout, # Expected command output
  4565. stubout, # Expected stub functions output
  4566. cmderr, # Expected command error output
  4567. )
  4568. testutils.save_testhook("")
  4569. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4570. result = testutils.validate_results(results,expected_results)
  4571. testutils.remove_testhook()
  4572. correct = 1
  4573. assert result == correct, "Result:\n%s" % result
  4574. # ---------------------------------------------------------------------------------
  4575. def test_qsub_interactive_5():
  4576. """
  4577. qsub test run: interactive_5
  4578. """
  4579. args = """-I -t50 -n 1"""
  4580. cmdout = \
  4581. """Wait for job 1 to start...
  4582. Opening interactive session to /
  4583. Deleting interactive job 1
  4584. """
  4585. cmderr = ''
  4586. stubout = \
  4587. """
  4588. ADD_JOBS
  4589. cwd:/tmp
  4590. cwd type: <type 'str'>
  4591. ion_kernel:default
  4592. ion_kernel type: <type 'str'>
  4593. jobid:*
  4594. jobid type: <type 'str'>
  4595. kernel:default
  4596. kernel type: <type 'str'>
  4597. mode:interactive
  4598. mode type: <type 'str'>
  4599. nodes:1
  4600. nodes type: <type 'int'>
  4601. outputdir:/tmp
  4602. outputdir type: <type 'str'>
  4603. path:/tmp
  4604. path type: <type 'str'>
  4605. procs:512
  4606. procs type: <type 'str'>
  4607. queue:default
  4608. queue type: <type 'str'>
  4609. run_project:False
  4610. run_project type: <type 'bool'>
  4611. script_preboot:True
  4612. script_preboot type: <type 'bool'>
  4613. tag:job
  4614. tag type: <type 'str'>
  4615. umask:18
  4616. umask type: <type 'int'>
  4617. user:gooduser
  4618. user type: <type 'str'>
  4619. user_list:['gooduser']
  4620. user_list type: <type 'list'>
  4621. walltime:50
  4622. walltime type: <type 'str'>
  4623. VALIDATE_JOB
  4624. attrs:{}
  4625. attrs type: <type 'dict'>
  4626. cwd:/tmp
  4627. cwd type: <type 'str'>
  4628. debug:False
  4629. debug type: <type 'bool'>
  4630. debuglog:False
  4631. debuglog type: <type 'bool'>
  4632. dependencies:False
  4633. dependencies type: <type 'bool'>
  4634. disable_preboot:False
  4635. disable_preboot type: <type 'bool'>
  4636. env:False
  4637. env type: <type 'bool'>
  4638. error:False
  4639. error type: <type 'bool'>
  4640. forcenoval:False
  4641. forcenoval type: <type 'bool'>
  4642. geometry:False
  4643. geometry type: <type 'bool'>
  4644. held:False
  4645. held type: <type 'bool'>
  4646. inputfile:False
  4647. inputfile type: <type 'bool'>
  4648. interactive:False
  4649. interactive type: <type 'bool'>
  4650. ion_kernel:default
  4651. ion_kernel type: <type 'str'>
  4652. ion_kerneloptions:False
  4653. ion_kerneloptions type: <type 'bool'>
  4654. jobname:False
  4655. jobname type: <type 'bool'>
  4656. kernel:default
  4657. kernel type: <type 'str'>
  4658. kerneloptions:False
  4659. kerneloptions type: <type 'bool'>
  4660. mode:interactive
  4661. mode type: <type 'str'>
  4662. nodecount:1
  4663. nodecount type: <type 'str'>
  4664. notify:False
  4665. notify type: <type 'bool'>
  4666. output:False
  4667. output type: <type 'bool'>
  4668. outputprefix:False
  4669. outputprefix type: <type 'bool'>
  4670. preemptable:False
  4671. preemptable type: <type 'bool'>
  4672. proccount:False
  4673. proccount type: <type 'bool'>
  4674. project:False
  4675. project type: <type 'bool'>
  4676. queue:default
  4677. queue type: <type 'str'>
  4678. run_project:False
  4679. run_project type: <type 'bool'>
  4680. time:50
  4681. time type: <type 'str'>
  4682. umask:False
  4683. umask type: <type 'bool'>
  4684. user_list:False
  4685. user_list type: <type 'bool'>
  4686. verbose:False
  4687. verbose type: <type 'bool'>
  4688. version:False
  4689. version type: <type 'bool'>
  4690. GET_IMPLEMENTATION
  4691. GET_JOBS
  4692. jobid:1
  4693. jobid type: <type 'int'>
  4694. location:*
  4695. location type: <type 'str'>
  4696. resid:*
  4697. resid type: <type 'str'>
  4698. state:*
  4699. state type: <type 'str'>
  4700. tag:job
  4701. tag type: <type 'str'>
  4702. DEL_JOBS
  4703. force:False
  4704. whoami:gooduser
  4705. jobid:1
  4706. jobid type: <type 'int'>
  4707. tag:job
  4708. tag type: <type 'str'>
  4709. user:gooduser
  4710. user type: <type 'str'>
  4711. """
  4712. stubout_file = "stub.out"
  4713. expected_results = (
  4714. 0, # Expected return status
  4715. cmdout, # Expected command output
  4716. stubout, # Expected stub functions output
  4717. cmderr, # Expected command error output
  4718. )
  4719. testutils.save_testhook("JOB_RUNNING")
  4720. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4721. result = testutils.validate_results(results,expected_results)
  4722. testutils.remove_testhook()
  4723. correct = 1
  4724. assert result == correct, "Result:\n%s" % result
  4725. # ---------------------------------------------------------------------------------
  4726. def test_qsub_interactive_6():
  4727. """
  4728. qsub test run: interactive_6
  4729. """
  4730. args = """--interactive -t50 -n 1"""
  4731. cmdout = \
  4732. """Wait for job 1 to start...
  4733. Opening interactive session to /
  4734. Deleting interactive job 1
  4735. """
  4736. cmderr = ''
  4737. stubout = \
  4738. """
  4739. ADD_JOBS
  4740. cwd:/tmp
  4741. cwd type: <type 'str'>
  4742. ion_kernel:default
  4743. ion_kernel type: <type 'str'>
  4744. jobid:*
  4745. jobid type: <type 'str'>
  4746. kernel:default
  4747. kernel type: <type 'str'>
  4748. mode:interactive
  4749. mode type: <type 'str'>
  4750. nodes:1
  4751. nodes type: <type 'int'>
  4752. outputdir:/tmp
  4753. outputdir type: <type 'str'>
  4754. path:/tmp
  4755. path type: <type 'str'>
  4756. procs:512
  4757. procs type: <type 'str'>
  4758. queue:default
  4759. queue type: <type 'str'>
  4760. run_project:False
  4761. run_project type: <type 'bool'>
  4762. script_preboot:True
  4763. script_preboot type: <type 'bool'>
  4764. tag:job
  4765. tag type: <type 'str'>
  4766. umask:18
  4767. umask type: <type 'int'>
  4768. user:gooduser
  4769. user type: <type 'str'>
  4770. user_list:['gooduser']
  4771. user_list type: <type 'list'>
  4772. walltime:50
  4773. walltime type: <type 'str'>
  4774. VALIDATE_JOB
  4775. attrs:{}
  4776. attrs type: <type 'dict'>
  4777. cwd:/tmp
  4778. cwd type: <type 'str'>
  4779. debug:False
  4780. debug type: <type 'bool'>
  4781. debuglog:False
  4782. debuglog type: <type 'bool'>
  4783. dependencies:False
  4784. dependencies type: <type 'bool'>
  4785. disable_preboot:False
  4786. disable_preboot type: <type 'bool'>
  4787. env:False
  4788. env type: <type 'bool'>
  4789. error:False
  4790. error type: <type 'bool'>
  4791. forcenoval:False
  4792. forcenoval type: <type 'bool'>
  4793. geometry:False
  4794. geometry type: <type 'bool'>
  4795. held:False
  4796. held type: <type 'bool'>
  4797. inputfile:False
  4798. inputfile type: <type 'bool'>
  4799. interactive:False
  4800. interactive type: <type 'bool'>
  4801. ion_kernel:default
  4802. ion_kernel type: <type 'str'>
  4803. ion_kerneloptions:False
  4804. ion_kerneloptions type: <type 'bool'>
  4805. jobname:False
  4806. jobname type: <type 'bool'>
  4807. kernel:default
  4808. kernel type: <type 'str'>
  4809. kerneloptions:False
  4810. kerneloptions type: <type 'bool'>
  4811. mode:interactive
  4812. mode type: <type 'str'>
  4813. nodecount:1
  4814. nodecount type: <type 'str'>
  4815. notify:False
  4816. notify type: <type 'bool'>
  4817. output:False
  4818. output type: <type 'bool'>
  4819. outputprefix:False
  4820. outputprefix type: <type 'bool'>
  4821. preemptable:False
  4822. preemptable type: <type 'bool'>
  4823. proccount:False
  4824. proccount type: <type 'bool'>
  4825. project:False
  4826. project type: <type 'bool'>
  4827. queue:default
  4828. queue type: <type 'str'>
  4829. run_project:False
  4830. run_project type: <type 'bool'>
  4831. time:50
  4832. time type: <type 'str'>
  4833. umask:False
  4834. umask type: <type 'bool'>
  4835. user_list:False
  4836. user_list type: <type 'bool'>
  4837. verbose:False
  4838. verbose type: <type 'bool'>
  4839. version:False
  4840. version type: <type 'bool'>
  4841. GET_IMPLEMENTATION
  4842. GET_JOBS
  4843. jobid:1
  4844. jobid type: <type 'int'>
  4845. location:*
  4846. location type: <type 'str'>
  4847. resid:*
  4848. resid type: <type 'str'>
  4849. state:*
  4850. state type: <type 'str'>
  4851. tag:job
  4852. tag type: <type 'str'>
  4853. DEL_JOBS
  4854. force:False
  4855. whoami:gooduser
  4856. jobid:1
  4857. jobid type: <type 'int'>
  4858. tag:job
  4859. tag type: <type 'str'>
  4860. user:gooduser
  4861. user type: <type 'str'>
  4862. """
  4863. stubout_file = "stub.out"
  4864. expected_results = (
  4865. 0, # Expected return status
  4866. cmdout, # Expected command output
  4867. stubout, # Expected stub functions output
  4868. cmderr, # Expected command error output
  4869. )
  4870. testutils.save_testhook("JOB_RUNNING")
  4871. results = testutils.run_cmd('qsub.py',args,stubout_file)
  4872. result = testutils.validate_results(results,expected_results)
  4873. testutils.remove_testhook()
  4874. correct = 1
  4875. assert result == correct, "Result:\n%s" % result
  4876. # ---------------------------------------------------------------------------------
  4877. def test_qsub_interactive_7():
  4878. """
  4879. qsub test run: interactive_7
  4880. """
  4881. args = """--mode interactive -t50 -n 1"""
  4882. cmdout = \
  4883. """Wait for job 1 to start...
  4884. Opening interactive session to /
  4885. Deleting interactive job 1
  4886. """
  4887. cmderr = ''
  4888. stubout = \
  4889. """
  4890. ADD_JOBS
  4891. cwd:/tmp
  4892. cwd type: <type 'str'>
  4893. ion_kernel:default
  4894. ion_kernel type: <type 'str'>
  4895. jobid:*
  4896. jobid type: <type 'str'>
  4897. kernel:default
  4898. kernel type: <type 'str'>
  4899. mode:interactive
  4900. mode type: <type 'str'>
  4901. nodes:1
  4902. nodes type: <type 'int'>
  4903. outputdir:/tmp
  4904. outputdir type: <type 'str'>
  4905. path:/tmp
  4906. path type: <type 'str'>
  4907. procs:512
  4908. procs type: <type 'str'>
  4909. queue:default
  4910. queue type: <type 'str'>
  4911. run_project:False
  4912. run_project type: <type 'bool'>
  4913. script_preboot:True
  4914. script_preboot type: <type 'bool'>
  4915. tag:job
  4916. tag type: <type 'str'>
  4917. umask:18
  4918. umask type: <type 'int'>
  4919. user:gooduser
  4920. user type: <type 'str'>
  4921. user_list:['gooduser']
  4922. user_list type: <type 'list'>
  4923. walltime:50
  4924. walltime type: <type 'str'>
  4925. VALIDATE_JOB
  4926. attrs:{}
  4927. attrs type: <type 'dict'>
  4928. cwd:/tmp
  4929. cwd type: <type 'str'>
  4930. debug:False
  4931. debug type: <type 'bool'>
  4932. debuglog:False
  4933. debuglog type: <type 'bool'>
  4934. dependencies:False
  4935. dependencies type: <type 'bool'>
  4936. disable_preboot:False
  4937. disable_preboot type: <type 'bool'>
  4938. env:False
  4939. env type: <type 'bool'>
  4940. error:False
  4941. error type: <type 'bool'>
  4942. forcenoval:False
  4943. forcenoval type: <type 'bool'>
  4944. geometry:False
  4945. geometry type: <type 'bool'>
  4946. held:False
  4947. held type: <type 'bool'>
  4948. inputfile:False
  4949. inputfile type: <type 'bool'>
  4950. interactive:False
  4951. interactive type: <type 'bool'>
  4952. ion_kernel:default
  4953. ion_kernel type: <type 'str'>
  4954. ion_kerneloptions:False
  4955. ion_kerneloptions type: <type 'bool'>
  4956. jobname:False
  4957. jobname type: <type 'bool'>
  4958. kernel:default
  4959. kernel type: <type 'str'>
  4960. kerneloptions:False
  4961. kerneloptions type: <type 'bool'>
  4962. mode:interactive
  4963. mode type: <type 'str'>
  4964. nodecount:1
  4965. nodecount type: <type 'str'>
  4966. notify:False
  4967. notify type: <type 'bool'>
  4968. output:False
  4969. output type: <type 'bool'>
  4970. outputprefix:False
  4971. outputprefix type: <type 'bool'>
  4972. preemptable:False
  4973. preemptable type: <type 'bool'>
  4974. proccount:False
  4975. proccount type: <type 'bool'>
  4976. project:False
  4977. project type: <type 'bool'>
  4978. queue:default
  4979. queue type: <type 'str'>
  4980. run_project:False
  4981. run_project type: <type 'bool'>
  4982. time:50
  4983. time type: <type 'str'>
  4984. umask:False
  4985. umask type: <type 'bool'>
  4986. user_list:False
  4987. user_list type: <type 'bool'>
  4988. verbose:False
  4989. verbose type: <type 'bool'>
  4990. version:False
  4991. version type: <type 'bool'>
  4992. GET_IMPLEMENTATION
  4993. GET_JOBS
  4994. jobid:1
  4995. jobid type: <type 'int'>
  4996. location:*
  4997. location type: <type 'str'>
  4998. resid:*
  4999. resid type: <type 'str'>
  5000. state:*
  5001. state type: <type 'str'>
  5002. tag:job
  5003. tag type: <type 'str'>
  5004. DEL_JOBS
  5005. force:False
  5006. whoami:gooduser
  5007. jobid:1
  5008. jobid type: <type 'int'>
  5009. tag:job
  5010. tag type: <type 'str'>
  5011. user:gooduser
  5012. user type: <type 'str'>
  5013. """
  5014. stubout_file = "stub.out"
  5015. expected_results = (
  5016. 0, # Expected return status
  5017. cmdout, # Expected command output
  5018. stubout, # Expected stub functions output
  5019. cmderr, # Expected command error output
  5020. )
  5021. testutils.save_testhook("JOB_RUNNING")
  5022. results = testutils.run_cmd('qsub.py',args,stubout_file)
  5023. result = testutils.validate_results(results,expected_results)
  5024. testutils.remove_testhook()
  5025. correct = 1
  5026. assert result == correct, "Result:\n%s" % result