pbs_qstat_2servers.py 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 TestQstatTwoServers(TestFunctional):
  38. """
  39. This test suite checks that qstat works correctly when there
  40. are 2 PBS servers set up
  41. """
  42. def setUp(self):
  43. if len(self.servers) != 2 or self.server.client in self.servers:
  44. self.skipTest("This test needs two servers and one client")
  45. # Because of a bug in PTL, having moms on respective server hosts
  46. # don't work, so the server hosts need to be passed as nomom hosts
  47. svrnames = self.servers.keys()
  48. if "nomom" not in self.conf or \
  49. svrnames[0] not in self.conf["nomom"] or \
  50. svrnames[1] not in self.conf["nomom"]:
  51. self.skipTest("This test needs the server hosts to be passed"
  52. " as nomom hosts: -p servers=<host1>:<host2>,"
  53. "nomom=<host1>:<host2>")
  54. TestFunctional.setUp(self)
  55. def test_qstat_req_server(self):
  56. _m = self.server.get_op_mode()
  57. if _m != PTL_CLI:
  58. self.skipTest("Test only supported for CLI mode")
  59. self.server1 = self.servers.values()[0]
  60. self.server2 = self.servers.values()[1]
  61. a = {'scheduling': 'false', 'flatuid': 'true'}
  62. self.server1.manager(MGR_CMD_SET, SERVER, a)
  63. self.server2.manager(MGR_CMD_SET, SERVER, a)
  64. j = Job(TEST_USER)
  65. jid = self.server1.submit(j)
  66. destination = '@%s' % self.server2.hostname
  67. self.server1.movejob(jobid=jid, destination=destination)
  68. self.server1.status(JOB, id=jid + '@%s' % self.server2.hostname,
  69. runas=str(TEST_USER))
  70. expmsg = "Type 19 request received"\
  71. " from %s@%s" % (str(TEST_USER), self.server.client)
  72. self.server1.log_match(msg=expmsg, existence=False, max_attempts=5)
  73. self.server2.log_match(msg=expmsg)