Skip to content

Commit

Permalink
Merge pull request #297 from wguanicedew/dev
Browse files Browse the repository at this point in the history
fix the asyncresult assumes return value 0 as not returning result
  • Loading branch information
wguanicedew authored Apr 3, 2024
2 parents 1ee443a + 00c5cba commit 383646d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion workflow/lib/idds/iworkflow/asyncresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def __init__(self, work_context, name=None, wait_num=1, wait_keys=[], multi_jobs
self._bad_results = []
self._results_percentage = 0
self._map_results = map_results
self.waiting_result_terminated = False

self._wait_num = wait_num
if not self._wait_num:
Expand Down Expand Up @@ -432,10 +433,13 @@ def wait_results(self, timeout=None, force_return_results=False):
time.sleep(1)
if percent >= self._wait_percent:
get_results = True
self.waiting_result_terminated = True
self.logger.info("Got result percentage %s is not smaller then wait_percent %s, set waiting_result_terminated to True" % (percent, self._wait_percent))
if self._timeout is not None and self._timeout > 0 and time.time() - time_start > self._timeout:
# global timeout
self.logger.info("Waiting result timeout(%s seconds)" % self._timeout)
self.logger.info("Waiting result timeout(%s seconds), set waiting_result_terminated to True" % self._timeout)
get_results = True
self.waiting_result_terminated = True
if timeout is not None and timeout > 0 and time.time() - time_start > timeout:
# local timeout
break
Expand Down
4 changes: 3 additions & 1 deletion workflow/lib/idds/iworkflow/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,10 @@ def wait_results(self):
# time.sleep(10)
ret = async_ret.wait_results(timeout=10)
if ret:
logging.info("Recevied result: %s" % ret)
logging.info("Recevied result: %s" % str(ret))
break
if async_ret.waiting_result_terminated:
logging.info("waiting_result_terminated is set, Received result is: %s" % str(ret))
if time.time() - time_last_check_status > 600: # 10 minutes
status = self.get_status()
time_last_check_status = time.time()
Expand Down

0 comments on commit 383646d

Please sign in to comment.