pbs_nodes_queues.py 3.5 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 TestNodesQueues(TestFunctional):
  38. def setUp(self):
  39. TestFunctional.setUp(self)
  40. self.server.add_resource('foo', 'string', 'h')
  41. a = {'resources_available.ncpus': 4}
  42. self.server.create_vnodes(
  43. 'vnode', a, 8, self.mom, attrfunc=self.cust_attr)
  44. a = {'queue_type': 'execution', 'started': 't', 'enabled': 't'}
  45. self.server.manager(MGR_CMD_CREATE, QUEUE, a, id='workq2')
  46. self.server.manager(MGR_CMD_SET, NODE, {
  47. 'queue': 'workq2'}, id='vnode[0]')
  48. self.server.manager(MGR_CMD_SET, NODE, {
  49. 'queue': 'workq2'}, id='vnode[1]')
  50. self.server.manager(MGR_CMD_SET, NODE, {
  51. 'queue': 'workq2'}, id='vnode[2]')
  52. self.server.manager(MGR_CMD_SET, NODE, {
  53. 'queue': 'workq2'}, id='vnode[3]')
  54. self.server.manager(MGR_CMD_SET, SERVER, {'node_group_key': 'foo'})
  55. self.server.manager(MGR_CMD_SET, SERVER, {'node_group_enable': 't'})
  56. def cust_attr(self, name, totnodes, numnode, attrib):
  57. a = {}
  58. if numnode % 2 == 0:
  59. a['resources_available.foo'] = 'A'
  60. else:
  61. a['resources_available.foo'] = 'B'
  62. return dict(attrib.items() + a.items())
  63. def test_node_queue_assoc_ignored(self):
  64. """
  65. Issue with node grouping and nodes associated with queues. If
  66. node_grouping is set at the server level, node/queue association is
  67. not honored
  68. """
  69. a = {'Resource_List.select': '2:ncpus=1',
  70. 'Resource_List.place': 'vscatter', 'queue': 'workq2'}
  71. j = Job(TEST_USER, attrs=a)
  72. jid = self.server.submit(j)
  73. self.server.expect(JOB, 'exec_vnode', id=jid, op=SET)
  74. nodes = j.get_vnodes(j.exec_vnode)
  75. self.assertTrue((nodes[0] == 'vnode[0]' and nodes[1] == 'vnode[2]') or
  76. (nodes[0] == 'vnode[1]' and nodes[1] == 'vnode[3]'))