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

Binary artifact from shell_command wrapped by experimental_wrap_as_resources is not copied into the sandbox of a python_test #21156

Closed
eguiraud-pf opened this issue Jul 10, 2024 · 4 comments
Assignees
Labels

Comments

@eguiraud-pf
Copy link

Describe the bug
I have a shell_command that produces

If there is an experimental_wrap_as_resources target between the shell_command that produces the binary artifact and a python_test that consumes it, the binary artifact is not put in the sandbox, breaking the python test.

If the python_test target depends directly on the shell_command, things work fine.
But I need the intermediate experimental_wrap_as_resources because otherwise pants check does not honor the dependency of the python test on the output of the shell_command.

I put a reproducer at https://github.com/eguiraud/pants-workspace-exec-testing/tree/problem-with-wrap-as-resources.

cc: @tdyas

Pants version
Pants from source, main@ae91cdf241 (latest main as of 10th of July 2024).

OS
Linux

Additional info
This problem arose as part of our effort, at https://www.proximafusion.com, to better interface pants and bazel -- effort with which @tdyas is assisting.

@tdyas
Copy link
Contributor

tdyas commented Jul 23, 2024

I figured out the issue. The outputs field for the applicable experimental_wrap_as_resources target was set to hello_cpp instead of cpp/hello_cpp and so Pants filtered out the output file resulting in an empty digest.

Pants probably should have errored in that case because it ended up with an empty digest. Similar UX should probably exist for shell_command and adhoc_tool as well.

@eguiraud-pf
Copy link
Author

Huh, thank you @tdyas !

It is surprising to me that shell_command wants output_files=["hello_cpp"] while experimental_wrap_as_resources requires outputs=["cpp/hello_cpp"]. Seems arbitrary/inconsistent?

Pants probably should have errored in that case because it ended up with an empty digest. Similar UX should probably exist for shell_command and adhoc_tool as well.

+1. As a user that's not well versed in pants internals, I'm not sure how I could have figured out the problem given the absence of diagnostics.

@tdyas
Copy link
Contributor

tdyas commented Jul 23, 2024

Opened a discussion about better diagnostics: #21189

@eguiraud-pf
Copy link
Author

Thank you, closing this one as clarified then!

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

No branches or pull requests

2 participants