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

Engine: Remove *args from the Process.submit method #5753

Merged
merged 1 commit into from
Nov 9, 2022

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Nov 9, 2022

Fixes #3609

This method erroneously accepted variable arguments, however, they would simply be passed down the stack to ultimately be ignored in the function aiida.engine.utils.instantiate_process. This silently ignoring of arguments led to problems with users accidentally forgetting to expand a dictionary of inputs when calling submit. For example they called:

self.submit(cls, inputs)

inside of a workchain step, instead of:

self.submit(cls, **inputs)

The exception that would be raised is the validation error of the first required input port that would be parsed:

Error occurred validating port: required value was not provided

Instead, the passing of unsupported argument should be detected way earlier. This is now the case by removing the variable arguments from the signature of the Process.submit method and all the methods it calls downstream. This will now cause a TypeError to be raised:

submit() takes 2 positional arguments but 3 were given

This method erroneously accepted variable arguments, however, they would
simply be passed down the stack to ultimately be ignored in the function
`aiida.engine.utils.instantiate_process`. This silently ignoring of
arguments led to problems with users accidentally forgetting to expand a
dictionary of inputs when calling submit. For example they called:

    self.submit(cls, inputs)

inside of a workchain step, instead of:

    self.submit(cls, **inputs)

The exception that would be raised is the validation error of the first
required input port that would be parsed:

    Error occurred validating port: required value was not provided

Instead, the passing of unsupported argument should be detected way
earlier. This is now the case by removing the variable arguments from
the signature of the `Process.submit` method and all the methods it
calls downstream. This will now cause a `TypeError` to be raised:

    submit() takes 2 positional arguments but 3 were given
@sphuber sphuber requested a review from unkcpz November 9, 2022 15:55
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

@sphuber Thanks! Looks good to me.

@sphuber sphuber merged commit ed620c0 into aiidateam:main Nov 9, 2022
@sphuber sphuber deleted the fix/3609/submit-variable-args branch November 9, 2022 22: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.

Misleading port validating error message
2 participants