From f068d239c5e6bc73ea6055cb95adc6441fca55e1 Mon Sep 17 00:00:00 2001 From: Wen Guan Date: Tue, 18 Jun 2024 13:59:41 +0200 Subject: [PATCH 1/2] add function to remove some results --- workflow/lib/idds/iworkflow/asyncresult.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/workflow/lib/idds/iworkflow/asyncresult.py b/workflow/lib/idds/iworkflow/asyncresult.py index 2f5c2204..ca4f29e2 100644 --- a/workflow/lib/idds/iworkflow/asyncresult.py +++ b/workflow/lib/idds/iworkflow/asyncresult.py @@ -115,6 +115,25 @@ def get_result(self, name=None, args=None, key=None, verbose=False): logging.info("get_result: name key %s, args key %s, ret: %s" % (name_key, key, ret)) return ret + def set_result(self, name=None, args=None, key=None, value=None, verbose=False): + if verbose: + logging.info("set_result: key %s, name: %s, args: %s, value: %s" % (key, name, args, value)) + logging.info("set_result: results: %s, name_results: %s" % (self._results, self._name_results)) + + name_key = key + if name_key is not None: + self._name_results.set[name_key] = value + else: + key = get_unique_id_for_dict(args) + + if name is not None: + name_key = '%s:%s' % (name, key) + self._name_results[name_key] = value + else: + self._results.get[key] = value + if verbose: + logging.info("set_result: name key %s, args key %s, value: %s" % (name_key, key, value)) + def get_all_results(self): return self._results From 186ba85ba14c90fca14a2b3f104269dd853118d4 Mon Sep 17 00:00:00 2001 From: Wen Guan Date: Mon, 24 Jun 2024 00:02:04 +0200 Subject: [PATCH 2/2] fix set result --- workflow/lib/idds/iworkflow/asyncresult.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/lib/idds/iworkflow/asyncresult.py b/workflow/lib/idds/iworkflow/asyncresult.py index ca4f29e2..f8a132cb 100644 --- a/workflow/lib/idds/iworkflow/asyncresult.py +++ b/workflow/lib/idds/iworkflow/asyncresult.py @@ -122,7 +122,7 @@ def set_result(self, name=None, args=None, key=None, value=None, verbose=False): name_key = key if name_key is not None: - self._name_results.set[name_key] = value + self._name_results[name_key] = value else: key = get_unique_id_for_dict(args) @@ -130,7 +130,7 @@ def set_result(self, name=None, args=None, key=None, value=None, verbose=False): name_key = '%s:%s' % (name, key) self._name_results[name_key] = value else: - self._results.get[key] = value + self._results[key] = value if verbose: logging.info("set_result: name key %s, args key %s, value: %s" % (name_key, key, value))