Skip to content

Commit

Permalink
Check if there is only a single task call in parallel loop
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhoerstr committed Aug 21, 2024
1 parent 9a49858 commit f180401
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pfdl_scheduler/validation/semantic_error_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,12 +709,19 @@ def check_counting_loop(self, counting_loop: CountingLoop, task: Task) -> bool:
Returns:
True if the Counting Loop statement is valid.
"""
valid = True
for statement in counting_loop.statements:
if not self.check_statement(statement, task):
valid = False
if counting_loop.parallel:
if len(counting_loop.statements) == 1 and isinstance(counting_loop.statements[0], TaskCall):
return True
error_msg = "Only a single task is allowed in a parallel loop statement!"
self.error_handler.print_error(error_msg, context=counting_loop.context)
return False
else:
valid = True
for statement in counting_loop.statements:
if not self.check_statement(statement, task):
valid = False

return valid
return valid

def check_conditional_statement(self, condition: Condition, task: Task) -> bool:
"""Calls check methods for the conditional statement.
Expand Down

0 comments on commit f180401

Please sign in to comment.