pbs_job_requeue_timeout_error.py 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 TestJobRequeueTimeoutErrorMsg(TestFunctional):
  38. """
  39. This test suite is for testing the new job_requeue_timeout error
  40. message that informs the user that the job rerun process is still
  41. in progress.
  42. """
  43. def setUp(self):
  44. TestFunctional.setUp(self)
  45. if len(self.moms) != 2:
  46. self.skip_test(reason="need 2 mom hosts: -p moms=<m1>:<m2>")
  47. self.server.set_op_mode(PTL_CLI)
  48. # PBSTestSuite returns the moms passed in as parameters as dictionary
  49. # of hostname and MoM object
  50. self.momA = self.moms.values()[0]
  51. self.momB = self.moms.values()[1]
  52. self.momA.delete_vnode_defs()
  53. self.momB.delete_vnode_defs()
  54. self.hostA = self.momA.shortname
  55. self.hostB = self.momB.shortname
  56. self.server.manager(MGR_CMD_DELETE, NODE, None, "")
  57. islocal = self.du.is_localhost(self.hostA)
  58. if islocal is False:
  59. self.server.manager(MGR_CMD_CREATE, NODE, id=self.hostA)
  60. else:
  61. self.server.manager(MGR_CMD_CREATE, NODE, id=self.hostB)
  62. self.server.manager(MGR_CMD_SET, SERVER,
  63. {'job_requeue_timeout': 1}, expect=True)
  64. def test_error_message(self):
  65. j = Job(TEST_USER, attrs={ATTR_N: 'job_requeue_timeout'})
  66. test = []
  67. test += ['dd if=/dev/zero of=file bs=1024 count=0 seek=10240\n']
  68. test += ['cat file\n']
  69. test += ['sleep 30\n']
  70. j.create_script(test, hostname=self.server.client)
  71. jid = self.server.submit(j)
  72. self.server.expect(
  73. JOB, {'job_state': 'R', 'substate': 42}, id=jid, max_attempts=30,
  74. interval=2)
  75. try:
  76. self.server.rerunjob(jid)
  77. except PbsRerunError as e:
  78. self.assertTrue('qrerun: Response timed out. Job rerun request ' +
  79. 'still in progress for' in e.msg[0])