Skip to content

Commit

Permalink
fixed extraction of expanded tasks
Browse files Browse the repository at this point in the history
The function has generated wrong execution order if processes have the same ID
  • Loading branch information
ak-cube committed Dec 1, 2024
1 parent 27a457a commit a5a63f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions rushti.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ def parse_line_arguments(line: str) -> Dict[str, Any]:
def expand_task(
tm1_services: Dict[str, TM1Service],
task: Union[Task, OptimizedTask]) -> List[Union[Task, OptimizedTask]]:

if "*" not in ",".join(task.parameters.keys()):
result = [task]
return result

tm1 = tm1_services[task.instance_name]
list_params = []
result = []
Expand Down Expand Up @@ -330,12 +335,16 @@ def extract_tasks_from_file_type_opt(
tasks[task.id].append(task)

# expand tasks
expanded_tasks = dict()
if expand:
for task_id in tasks:
for task in tasks[task_id]:
for expanded_task in expand_task(tm1_services, task):
tasks[task.id].append(expanded_task)
tasks[task.id].remove(task)
if task.id not in expanded_tasks:
expanded_tasks[task.id] = [expanded_task]
else:
expanded_tasks[task.id].append(expanded_task)
tasks = expanded_tasks

# Populate the successors attribute
for task_id in tasks:
Expand Down
3 changes: 2 additions & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def test_extract_lines_from_file_type_opt_happy_case(self):
def test_extract_lines_from_file_type_opt_multi_task_per_id(self):
ordered_tasks = extract_ordered_tasks_and_waits_from_file_type_opt(
5,
r"tests/resources/tasks_opt_multi_task_per_id.txt")
r"tests/resources/tasks_opt_multi_task_per_id.txt",
True)

expected_tasks = [
OptimizedTask("1", "tm1srv01", "}bedrock.server.wait", {"pWaitSec": "1"}, [], True),
Expand Down

0 comments on commit a5a63f4

Please sign in to comment.