Skip to content

fix: used task's id instead of name in abstract recipe generation#78

Merged
rafaelfsilva merged 1 commit intowfcommons:mainfrom
ftschirpke:fix-abstract-recipe-generation
Jun 14, 2025
Merged

fix: used task's id instead of name in abstract recipe generation#78
rafaelfsilva merged 1 commit intowfcommons:mainfrom
ftschirpke:fix-abstract-recipe-generation

Conversation

@ftschirpke
Copy link
Copy Markdown
Contributor

Summary

This PR changes multiple uses of .name to the respective ID (.task_id or .file_id respectively) in the abstract recipe classes.

Problem

I noticed that generating a workflow from a recipe produced tasks do not interact with eachother. Minimal example:

wf: Workflow = BlastRecipe.from_num_tasks(200).build_workflow()

all_ins = set()
all_outs = set()
for id, task in wf.tasks.items():
    for infile in task.input_files:
        all_ins.add(infile)
    for outfile in task.output_files:
        all_outs.add(outfile)

intersect = all_ins.intersection(all_outs)
print(f"{len(intersect)=}")

output:

len(intersect)=0

This means that no task has input files that are outputs of a previous task.

Solution

After a bit of debugging, I found that new files are generated for each task because checks in the abstract recipe generation fail to find the files in parent tasks due to inconsistent usage of task.name and task.task_id.

output after the changes:

# Expectation:
# 1 split_fasta task with 1 output
# 195 blastall tasks with 2 outputs each
# 2 leaf nodes (1 cat_blast task, 1 cat task) using all the above outputs
# => we expect 1 + 2 * 195 = 391 outputs used as inputs

len(intersect)=391  # CORRECT

@rafaelfsilva rafaelfsilva merged commit 684c8ea into wfcommons:main Jun 14, 2025
1 check passed
@rafaelfsilva
Copy link
Copy Markdown
Member

Thank you @ftschirpke for finding this issue and fixing the bug. The PR has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants