MCPcopy Create free account
hub / github.com/StackStorm/st2 / _do_pause

Method _do_pause

st2actions/st2actions/container/base.py:212–242  ·  view source on GitHub ↗
(self, runner)

Source from the content-addressed store, hash-verified

210 return runner.liveaction
211
212 def _do_pause(self, runner):
213 # Initialise to avoid E0601: Use before assignment.
214 status = result = context = None
215 try:
216 extra = {"runner": runner}
217 LOG.debug(
218 "Performing pause for runner: %s", (runner.runner_id), extra=extra
219 )
220 (status, result, context) = runner.pause()
221 except:
222 _, ex, tb = sys.exc_info()
223 # include the error message and traceback to try and provide some hints.
224 status = action_constants.LIVEACTION_STATUS_FAILED
225 result = {
226 "error": str(ex),
227 "traceback": "".join(traceback.format_tb(tb, 20)),
228 }
229 context = runner.liveaction.context
230 LOG.exception(
231 "Failed to pause action %s." % (runner.liveaction.id), extra=result
232 )
233 finally:
234 # Update the final status of liveaction and corresponding action execution.
235 runner.liveaction = self._update_status(
236 runner.liveaction.id, status, result, context
237 )
238
239 # Always clean-up the auth_token
240 self._clean_up_auth_token(runner=runner, status=runner.liveaction.status)
241
242 return runner.liveaction
243
244 def _do_resume(self, runner):
245 # Initialise to avoid E0601: Use before assignment.

Callers

nothing calls this directly

Calls 3

_update_statusMethod · 0.95
_clean_up_auth_tokenMethod · 0.95
pauseMethod · 0.45

Tested by

no test coverage detected