Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass list of names for task input/output directly #343

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

GeigerJ2
Copy link
Contributor

So far, one would always have to pass a list of dictionaries, specifying at least the "name" identifier to a Tasks inputs/outputs, such as:

SeekpathTask = build_task(
    seekpath_structure_analysis,
    outputs=[
        {"name": "primitive_structure"},
        {"name": "explicit_kpoints"},
    ],
)

With this PR, it is now possible to just directly specify a list of strings, which will internally be automatically converted to a list of dictionaries, with the "name" key assigned to it. With this, it is now possible to write the above function call shorter, as:

SeekpathTask = build_task(
    seekpath_structure_analysis,
    outputs=["primitive_structure", "explicit_kpoints"]
)

To avoid confusion, I only allow either a list of str, or a list of dict, but not of mixed types. I added tests for the validate_task_inout function, as well as one test for the full call to build_graph.

Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GeigerJ2 , thanks for the nice work! LGTM!

@GeigerJ2 GeigerJ2 merged commit d4a1e3a into aiidateam:main Nov 18, 2024
8 checks passed
@GeigerJ2 GeigerJ2 deleted the feature/task-name-optional branch November 18, 2024 20:28
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