Skip to content

Commit

Permalink
add is_processed to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
wguanicedew committed Mar 14, 2024
1 parent 6aa605c commit 9abbf4e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
11 changes: 11 additions & 0 deletions workflow/lib/idds/workflow/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,12 @@ def is_subfinished(self, synchronize=True):
"""
return self.is_terminated() and (self.num_finished_works + self.num_subfinished_works > 0 and self.num_finished_works + self.num_subfinished_works <= self.num_total_works)

def is_processed(self, synchronize=True):
"""
*** Function called by Transformer agent.
"""
return self.is_terminated(synchronize=synchronize) and (self.num_finished_works + self.num_subfinished_works > 0 and self.num_finished_works + self.num_subfinished_works <= self.num_total_works)

def is_failed(self, synchronize=True):
"""
*** Function called by Marshaller agent.
Expand Down Expand Up @@ -2218,6 +2224,11 @@ def is_subfinished(self, synchronize=True):
return self.runs[str(self.num_run)].is_subfinished()
return False

def is_processed(self, synchronize=True):
if self.is_terminated():
return self.runs[str(self.num_run)].is_processed()
return False

def is_failed(self, synchronize=True):
if self.is_terminated():
return self.runs[str(self.num_run)].is_failed()
Expand Down
20 changes: 20 additions & 0 deletions workflow/lib/idds/workflowv2/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,12 @@ def is_subfinished(self, synchronize=True):
"""
return self.is_terminated(synchronize=synchronize) and (self.num_finished_works + self.num_subfinished_works > 0 and self.num_finished_works + self.num_subfinished_works <= self.num_total_works)

def is_processed(self, synchronize=True):
"""
*** Function called by Transformer agent.
"""
return self.is_terminated(synchronize=synchronize) and (self.num_finished_works + self.num_subfinished_works > 0 and self.num_finished_works + self.num_subfinished_works <= self.num_total_works)

def is_failed(self, synchronize=True):
"""
*** Function called by Marshaller agent.
Expand Down Expand Up @@ -2500,6 +2506,20 @@ def is_subfinished(self, synchronize=True):
return self.runs[str(self.num_run)].is_subfinished(synchronize=False)
return False

def is_processed(self, synchronize=True):
if self.is_terminated(synchronize=synchronize):
build_work = self.get_build_work()
if build_work:
if build_work.is_terminated():
if not build_work.is_processed():
return False
else:
pass
else:
return False
return self.runs[str(self.num_run)].is_processed(synchronize=False)
return False

def is_failed(self, synchronize=True):
if self.is_terminated(synchronize=synchronize):
build_work = self.get_build_work()
Expand Down

0 comments on commit 9abbf4e

Please sign in to comment.