Skip to content

Commit

Permalink
Merge pull request #326 from wguanicedew/dev
Browse files Browse the repository at this point in the history
add function to set async results
  • Loading branch information
wguanicedew authored Jun 23, 2024
2 parents bf2374b + 186ba85 commit 9d8c61a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions workflow/lib/idds/iworkflow/asyncresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[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[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

Expand Down

0 comments on commit 9d8c61a

Please sign in to comment.