Skip to content

Output vs Result #820

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

Open
djarecka opened this issue May 2, 2025 · 5 comments
Open

Output vs Result #820

djarecka opened this issue May 2, 2025 · 5 comments
Labels
question Further information is requested

Comments

@djarecka
Copy link
Collaborator

djarecka commented May 2, 2025

@tclose - I've been working with pydra this week, and I was having problem on how to get Result object if the task is run in the simplest way as callable. Is it actually possible to get it or I'm able to get only the Output.

This is what I am able to get:

resample = ResampleTask(source_filename=source_file)
output = resample()
resample = ResampleTask(source_filename=source_file)
with Submitter(worker="debug") as sub:
    res=sub(resample)

So the second one gives full Result as expected, but the first only gives output that is equivalent to Result.Output

The problem with this is that we loose the access to many useful informations, e.g., cache_dir, error, etc.

@djarecka djarecka added the question Further information is requested label May 2, 2025
@tclose
Copy link
Contributor

tclose commented May 2, 2025

There is a Outputs._results property to access the Results object

@djarecka
Copy link
Collaborator Author

djarecka commented May 5, 2025

but do we have good reason to hide it?

@tclose
Copy link
Contributor

tclose commented May 5, 2025

I was just endeavouring to keep the namespace of the outputs object clear. Although I walked that back a little and added an inputs property to it so you can access the task inputs when building a workflow, so we could also keep "results" or "result" as a reserved output name

@djarecka
Copy link
Collaborator Author

djarecka commented May 6, 2025

but in general you believe, that task() should not be returning Result?

@tclose
Copy link
Contributor

tclose commented May 7, 2025

I could be talked out of it, but I just thought it offers a slightly more convenient/less surprising introduction to Pydra if you get back a "namedtuple-like" outputs object rather than a results object. There is also the option of using the submitter explicitly if you want the result object.

Sorry if this slipped through with all the other changes in my refactor. At this point it would be a bit of a pain to rewrite all the unittests back to handling Result objects, but not insurmountable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants