Commit 744273f2 authored by Łukasz Nowak's avatar Łukasz Nowak

Use (if possible) configured timeout for restart

If Test Result is associated with Test Node and thus distributor, and
distributor defines process timeout use this timeout to now when to
restart test lines. This is useful to avoid needless restart of tests
running on nodes related to long time outing distributors.

Otherwise fallback to default.
parent 718c995a
from DateTime import DateTime
now = DateTime()
timeout = None
# Try to fetch timeout from distributor if defined there...
for test_result_node in context.contentValues(portal_type='Test Result Node'):
test_node = test_result_node.getSpecialiseValue(portal_type='Test Node')
if test_node is not None:
distributor = test_node.getSpecialiseValue(portal_type='ERP5 Project Unit Test Distributor')
if distributor is not None:
if distributor.getProcessTimeout() is not None:
timeout = distributor.getProcessTimeout()
break
# ...or fallback to default:
# Consider that a test running for more than 3 hours is a stuck
# test. Very long tests are not good, they should be splitted to
# let testnodes work on other test suites. So if we have 3 hours
# it should mean testnode is dead, this test should be restarted
old_date = now-1.0/24*3
if timeout is None:
timeout = 1.0/24*3
old_date = now-timeout
if context.getSimulationState() == "started":
for line in context.objectValues(portal_type="Test Result Line"):
if line.getSimulationState() == "started":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment