Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fail_fast can skip stop call (in known cases of failure)

If messaging is dead, stop isn't going to work at all.
  • Loading branch information...
commit 62dbc6a17e55b3a8ca28a4f11e1434dd353c1e9a 1 parent 4a77aec
@daf daf authored
Showing with 10 additions and 2 deletions.
  1. +3 −2 pyon/container/cc.py
  2. +7 −0 pyon/container/test/test_cc.py
View
5 pyon/container/cc.py
@@ -417,12 +417,13 @@ def _stop_capability(self, capability):
else:
raise ContainerError("Cannot stop capability: %s" % capability)
- def fail_fast(self, err_msg=""):
+ def fail_fast(self, err_msg="", skip_stop=False):
"""
Container needs to shut down and NOW.
"""
log.error("Fail Fast: %s", err_msg)
- self.stop()
+ if not skip_stop:
+ self.stop()
log.error("Fail Fast: killing container")
traceback.print_exc()
View
7 pyon/container/test/test_cc.py
@@ -29,6 +29,13 @@ def test_fail_fast(self, osmock, logmock):
self.cc.stop.assert_called_once_with()
osmock.kill.assert_called_once_with(osmock.getpid(), signal.SIGTERM)
+ @patch('pyon.container.cc.os')
+ def test_fail_fast_no_stop(self, osmock):
+ self.cc.stop = Mock()
+
+ self.cc.fail_fast("icecream (of the future)", True)
+ self.assertEquals(self.cc.stop.call_count, 0)
+
def test_node_when_not_started(self):
self.assertEquals(self.cc.node, None)
Please sign in to comment.
Something went wrong with that request. Please try again.