From f3091112ac5fdd9336f42ed57df44a1796ed2a72 Mon Sep 17 00:00:00 2001 From: Andre Merzky Date: Mon, 30 Sep 2024 13:52:44 +0200 Subject: [PATCH] apply cb lock --- src/radical/pilot/pilot.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/radical/pilot/pilot.py b/src/radical/pilot/pilot.py index 466127bb4..1772db6e9 100644 --- a/src/radical/pilot/pilot.py +++ b/src/radical/pilot/pilot.py @@ -252,17 +252,18 @@ def _update(self, pilot_dict): # invoke pilot specific callbacks # FIXME: this iteration needs to be thread-locked! - for _,cb_val in self._callbacks[rpc.PILOT_STATE].items(): + with self._cb_lock: + for _,cb_val in self._callbacks[rpc.PILOT_STATE].items(): - cb = cb_val['cb'] - cb_data = cb_val['cb_data'] + cb = cb_val['cb'] + cb_data = cb_val['cb_data'] - self._log.debug('call %s', cb) + self._log.debug('call %s', cb) - self._log.debug('%s calls cb %s', self.uid, cb) + self._log.debug('%s calls cb %s', self.uid, cb) - if cb_data: cb([self], cb_data) - else : cb([self]) + if cb_data: cb([self], cb_data) + else : cb([self]) # ask pmgr to invoke any global callbacks self._pmgr._call_pilot_callbacks(self)