diff options
author | 2017-03-02 01:25:51 +0200 | |
---|---|---|
committer | 2017-03-02 01:25:51 +0200 | |
commit | 3ea197e5df0de834151dccfa0c7f70651741cac9 (patch) | |
tree | c87d2b499578aa906b443e866926aef3b3dbab03 /scripts/automation/trex_control_plane/server | |
parent | dc905a7dd6c6938b170964d957a0fafb3cb1ac7f (diff) |
t-rex-64: catch exit with trap to restore tty settings
Change-Id: Id336aa95ceff5e958e9bce329c85eb7201772712
Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts/automation/trex_control_plane/server')
3 files changed, 6 insertions, 5 deletions
diff --git a/scripts/automation/trex_control_plane/server/trex_launch_thread.py b/scripts/automation/trex_control_plane/server/trex_launch_thread.py index a4a7a97c..9598bc98 100755 --- a/scripts/automation/trex_control_plane/server/trex_launch_thread.py +++ b/scripts/automation/trex_control_plane/server/trex_launch_thread.py @@ -77,7 +77,7 @@ class AsynchronousTRexSession(threading.Thread): logger.debug("Finished handling a single run of TRex.")
self.trexObj.zmq_dump = None
- def join (self, timeout = None):
+ def join (self, timeout = 5):
self.stoprequest.set()
super(AsynchronousTRexSession, self).join(timeout)
diff --git a/scripts/automation/trex_control_plane/server/trex_server.py b/scripts/automation/trex_control_plane/server/trex_server.py index cd4af11a..bcbec069 100755 --- a/scripts/automation/trex_control_plane/server/trex_server.py +++ b/scripts/automation/trex_control_plane/server/trex_server.py @@ -256,7 +256,8 @@ class CTRexServer(object): def assert_zmq_ok(self): if self.trex.zmq_error: - raise Exception('ZMQ thread got error: %s' % self.trex.zmq_error) + self.trex.zmq_error, err = None, self.trex.zmq_error + raise Exception('ZMQ thread got error: %s' % err) if not self.zmq_monitor.is_alive(): if self.trex.get_status() != TRexStatus.Idle: self.force_trex_kill() @@ -326,6 +327,7 @@ class CTRexServer(object): return False def start_trex(self, trex_cmd_options, user, block_to_success = True, timeout = 40, stateless = False, debug_image = False, trex_args = ''): + self.trex.zmq_error = None self.assert_zmq_ok() with self.start_lock: logger.info("Processing start_trex() command.") @@ -418,7 +420,6 @@ class CTRexServer(object): def wait_until_kickoff_finish (self, timeout = 40): # block until TRex exits Starting state logger.info("Processing wait_until_kickoff_finish() command.") - trex_state = None start_time = time.time() while (time.time() - start_time) < timeout : self.assert_zmq_ok() diff --git a/scripts/automation/trex_control_plane/server/zmq_monitor_thread.py b/scripts/automation/trex_control_plane/server/zmq_monitor_thread.py index 172e2eb3..950e909f 100755 --- a/scripts/automation/trex_control_plane/server/zmq_monitor_thread.py +++ b/scripts/automation/trex_control_plane/server/zmq_monitor_thread.py @@ -48,12 +48,12 @@ class ZmqMonitorSession(threading.Thread): pass
else:
logger.error("ZMQ monitor thrown an exception. Received exception: {ex}".format(ex=e))
- raise
+ self.trexObj.zmq_error = e
except Exception as e:
logger.error('ZMQ monitor error: %s' % e)
self.trexObj.zmq_error = e
- def join(self, timeout=None):
+ def join(self, timeout=5):
self.stoprequest.set()
logger.debug("Handling termination of ZMQ monitor thread")
self.socket.close()
|