pbs_rerunjob_file_transfer_perf.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.performance import *
  37. class JobRerunFileTransferPerf(TestPerformance):
  38. """
  39. This test suite is for testing the performance of job script
  40. and job output (stdout) transfers in case of rerun
  41. """
  42. def setUp(self):
  43. TestPerformance.setUp(self)
  44. if len(self.moms) != 2:
  45. self.logger.error('test requires two MoMs as input, ' +
  46. ' use -p moms=<mom1>:<mom2>')
  47. self.assertEqual(len(self.moms), 2)
  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_SET, SERVER,
  57. {'log_events': 4095}, expect=True)
  58. self.server.manager(MGR_CMD_SET, SERVER,
  59. {'job_requeue_timeout': 1000}, expect=True)
  60. @timeout(600)
  61. def test_huge_job_file(self):
  62. j = Job(TEST_USER, attrs={
  63. ATTR_N: 'huge_job_file', 'Resource_List.select': '1:host=%s'
  64. % self.momB.shortname})
  65. test = []
  66. test += ['dd if=/dev/zero of=file bs=1024 count=0 seek=250000\n']
  67. test += ['cat file\n']
  68. test += ['sleep 10000\n']
  69. j.create_script(test, hostname=self.server.client)
  70. now1 = int(time.time())
  71. jid = self.server.submit(j)
  72. self.server.expect(
  73. JOB, {'job_state': 'R', 'substate': 42}, id=jid,
  74. max_attempts=30, interval=5)
  75. now2 = int(time.time())
  76. self.logger.info("Job %s took %d seconds to start\n",
  77. jid, (now2 - now1))
  78. # give a few seconds to job to create large spool file
  79. time.sleep(5)
  80. now1 = int(time.time())
  81. self.server.rerunjob(jid)
  82. self.server.expect(
  83. JOB, {'job_state': 'R', 'substate': 42}, id=jid,
  84. max_attempts=500, interval=5)
  85. now2 = int(time.time())
  86. self.logger.info("Job %s took %d seconds to rerun\n",
  87. jid, (now2 - now1))