Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def propose_eval(self, *args):
"Generate an eval proposal with a callback to on_reply."
proposal = Proposal('eval', *args)
proposal.add_callback(self.on_reply)
return proposal
def propose_action(self):
if self.target:
logger.info("Monkey attack! {0}".format(self.target.params))
proposal = Proposal('kill', self.target)
self.target = None
else:
proposal = self.strategy.propose_action()
return proposal
def propose_terminate(self):
"Generate a terminate proposal with a callback to on_terminate."
proposal = Proposal('terminate')
proposal.add_callback(self.on_terminate_reply)
return proposal
def propose_action(self):
"Propose termination once the eval counter is high enough."
if self.counter >= self.max_counter:
logger.debug("MaxEvalStrategy: request termination")
return Proposal('terminate')
else:
return None
def propose_kill(self, r):
"Generate a kill proposal with a callback to on_reply_kill."
proposal = Proposal('kill', r)
proposal.add_callback(self.on_kill_reply)
return proposal