pbs_sched_fifo.py 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # coding: utf-8
  2. # Copyright (C) 1994-2018 Altair Engineering, Inc.
  3. # For more information, contact Altair at www.altair.com.
  4. #
  5. # This file is part of the PBS Professional ("PBS Pro") software.
  6. #
  7. # Open Source License Information:
  8. #
  9. # PBS Pro is free software. You can redistribute it and/or modify it under the
  10. # terms of the GNU Affero General Public License as published by the Free
  11. # Software Foundation, either version 3 of the License, or (at your option) any
  12. # later version.
  13. #
  14. # PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
  15. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16. # FOR A PARTICULAR PURPOSE.
  17. # See the GNU Affero General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Affero General Public License
  20. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. #
  22. # Commercial License Information:
  23. #
  24. # For a copy of the commercial license terms and conditions,
  25. # go to: (http://www.pbspro.com/UserArea/agreement.html)
  26. # or contact the Altair Legal Department.
  27. #
  28. # Altair’s dual-license business model allows companies, individuals, and
  29. # organizations to create proprietary derivative works of PBS Pro and
  30. # distribute them - whether embedded or bundled with other software -
  31. # under a commercial license agreement.
  32. #
  33. # Use of Altair’s trademarks, including but not limited to "PBS™",
  34. # "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
  35. # trademark licensing policies.
  36. from tests.functional import *
  37. class TestSchedFifo(TestFunctional):
  38. """
  39. Test suite for PBSPro's FIFO scheduling
  40. """
  41. def test_sched_fifo(self):
  42. """
  43. Check that FIFO works.
  44. """
  45. # Configure sched for FIFO
  46. self.scheduler.set_sched_config({'strict_ordering': 'True',
  47. 'by_queue': 'False',
  48. 'help_starving_jobs': 'False'})
  49. # Create a new queue to test FIFO
  50. queue_attrib = {ATTR_qtype: 'execution',
  51. ATTR_start: 'True',
  52. ATTR_enable: 'True'}
  53. self.server.manager(MGR_CMD_CREATE,
  54. QUEUE, queue_attrib, id="workq2")
  55. # Set ncpus to 2 so it is easy to test, and scheduling off
  56. self.server.manager(MGR_CMD_SET,
  57. NODE, {'resources_available.ncpus': 2},
  58. self.mom.shortname)
  59. self.server.manager(MGR_CMD_SET,
  60. SERVER, {'scheduling': 'False'})
  61. # Submit 3 jobs: j1 (workq), j2 (workq2), j3 (workq)
  62. j1 = Job(TEST_USER, attrs={
  63. ATTR_queue: "workq"})
  64. j2 = Job(TEST_USER, attrs={
  65. ATTR_queue: "workq2"})
  66. j3 = Job(TEST_USER, attrs={
  67. ATTR_queue: "workq"})
  68. j_id1 = self.server.submit(j1)
  69. j_id2 = self.server.submit(j2)
  70. j_id3 = self.server.submit(j3)
  71. # Turn scheduling on again
  72. self.server.manager(MGR_CMD_SET,
  73. SERVER, {'scheduling': 'True'})
  74. # j1 and j2 should be running
  75. self.server.expect(JOB, {ATTR_state: 'R'}, id=j_id1, max_attempts=10)
  76. self.server.expect(JOB, {ATTR_state: 'R'}, id=j_id2, max_attempts=10)
  77. self.server.expect(JOB, {ATTR_state: 'Q'}, id=j_id3, max_attempts=10)