Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-merzky committed Sep 22, 2023
1 parent 48d2df4 commit dd8420e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/radical/pilot/agent/agent_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ def control_cb(self, topic, msg):
self._log.debug_1('control msg %s: %s', topic, msg)

cmd = msg['cmd']
arg = msg['arg']
arg = msg.get('arg')

self._log.debug('pilot command: %s: %s', cmd, arg)
self._prof.prof('cmd', msg="%s : %s" % (cmd, arg), uid=self._pid)
Expand Down
11 changes: 5 additions & 6 deletions src/radical/pilot/utils/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def _control_cb(self, topic, msg):
self._log.debug_5('command incoming: %s', msg)

cmd = msg['cmd']
arg = msg['arg']
arg = msg.get('arg')

if cmd == 'cancel_tasks':

Expand Down Expand Up @@ -419,7 +419,7 @@ def _handle_rpc_msg(self, msg):

if msg.cmd not in self._rpc_handlers:
# this RPC message is *silently* ignored
self._log.debug('no rpc handler for [%s])', msg.cmd)
self._log.debug('no rpc handler for [%s]', msg.cmd)
return

rpc_handler, addr = self._rpc_handlers[msg.cmd]
Expand All @@ -428,7 +428,6 @@ def _handle_rpc_msg(self, msg):
self._log.debug('ignore rpc handler for [%s] [%s])', msg, addr)
return


try:
self._log.debug('rpc handler for %s: %s',
msg.cmd, self._rpc_handlers[msg.cmd])
Expand All @@ -452,10 +451,10 @@ def _handle_rpc_msg(self, msg):
sys.stdout = bakout
sys.stderr = bakerr

rpc_rep = RPCResultMessage(rpc_req=msg, val=val, out=out, err=err, exc=exc)
self._log.debug_3('rpc reply: %s', rpc_rep)
rpc_res = RPCResultMessage(rpc_req=msg, val=val, out=out, err=err, exc=exc)
self._log.debug_3('rpc reply: %s', rpc_res)

self.publish(rpc.CONTROL_PUBSUB, rpc_rep)
self.publish(rpc.CONTROL_PUBSUB, rpc_res)


# --------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_agent_0/test_agent_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _prepenv_effect(env_name, env_spec):
agent_cmp.publish = mock.MagicMock(side_effect=_publish_effect)
agent_cmp._prepare_env = mock.MagicMock(side_effect=_prepenv_effect)

agent_cmp._rpc_handlers = {'prepare_env': agent_cmp._prepare_env}
agent_cmp._rpc_handlers = {'prepare_env': (agent_cmp._prepare_env, None)}

msg = {'cmd': 'test',
'arg': {'uid': 'rpc.0000',
Expand Down

0 comments on commit dd8420e

Please sign in to comment.