-
Notifications
You must be signed in to change notification settings - Fork 841
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
stack build --ghc-output
(or similar) to print GHC output during a build
#426
Comments
We already have logic in place to send output to stdout under specific circumstances (namely: on the terminal, only one package left to build, and it's a "wanted" package). Adding a flag to simply override that logic with "always output to stdout" is trivial, though the result will likely not be what you're looking for unless you also use @chrisdone Thoughts? |
As long as it gives some indication of GHC making progress, it's helpful. On Fri, Jun 26, 2015, 03:21 Michael Snoyman [email protected]
|
Yeah, outputting interleaved GHC output would be a bit messy. We could indeed prefix lines, that was discussed once. It might not be too bad. |
@spinda This part of the code base is pretty isolated. You interested in giving a crack at a PR on it? I can give you pointers of where to start. |
@snoyberg I'm traveling from Friday to Monday, but if the delay isn't an issue then I'd be happy to have a go at it. |
Shouldn't be a problem at all. When you're ready to look into this, check out Stack.Build.Execute and look for |
👍 |
This may well be an overengineered solution, but it seems like it ought to be possible to have uninterleaved GHC output if some of it is delayed. Here's how this would work:
Stack messages and logging would get interleaved with the ghc output, but that seems rather reasonable to me, if line buffered. |
@mgsloan I'm -1 on that solution, it seems like it's contrary to the stated goal of this issue: get regular output to stdout as long as a build is occurring. Delaying output from other processes would impair that. Additionally, implementing the solution you've described would be very difficult to do without introducing the possibility of significant memory usage or hurting performance in the common case. |
Agreed, the complication isn't worth it. |
@spinda Are you still planning on looking into this? |
(Continuing conversation here from the duplicate #642.) Regarding the complexity of the implementation -- my hope was that this policy could be completely encapsulated in a function roughly of the type Once the policy is factored out like that, then any of these fancy policies could live in their own modules, expose that one function, and not touch anything else. (And also not be the default, probably.) Maybe with some help factoring the plumbing (to route through that single arbiter function), then subsequently myself or @spinda, or @mgsloan or whoever could easily implement and try out different policies. A richer type than the one above will probably be necessary to have metadata for the substreams (e.g. human readable names) plus some way to implement the current policy of hiding output but still printing status messages.... I don't know conduit yet, but I'll have a look at the async/concurrent stuff out there for it and then make a specific proposal based on Conduit. |
Even modules / functions that are only used in one spot add complexity - they'd also need to be wired up to the CLI.
In the other thread, @snoyberg mentioned concerns about huge logs building up in memory. For consumers of this stream that wait a while to send their data, this could easily be the case (and hard to catch when only tested on small examples). It's not clear how to resolve this while keeping the type of the function simple. That said, I do think this output stuff could use some attention. Here are the things I'd like to see resolved:
One somewhat hacky approach to these last two would be to attempt to parse out the following parts of output:
Considering how hacky this is, I wouldn't want it to make it stack's canonical behavior, at least not at first. So, yeah, maybe it'd be good to have this be something where it's easy to swap in a different output behavior.
|
Well it would be nice if the sticky line could report fine-grained module progress as well as coarse-grained progress. But that does require a hacky parsing of GHC output, right? (I suppose the alternative is to do like Jenkins and remember what typical amounts of time/console-output are for particular subtasks, to estimate progress based on that.) Regarding memory usage: I think some experimentation could lead to a real-time behavior that feels comfortable, not leaving those "it looks stuck" windows of time, nor producing ugly interleavings. |
Actually, on second thought, even without having a "denominator", just having a counter in the sticky line that tracks the total number of lines of output from all subtasks.... that would go a huge way towards showing that the thing isn't stuck. |
Whatever you can do to improve the output for multiple projects would be appreciated. This is the most frustrating part of stack for me at the moment. I get a lot of spurious Travis CI build failures. Locally I'd much rather get all the output interleaved (with some prefix would be nice) than have no output until it hits an error. Thanks. |
As mentioned in #896, I would like to see ghc warnings for my local packages when doing a multi-package One work around is to pass the Another work around is to pass a package name to |
What is the status on this? Is someone working on a PR or should I just try do that myself (seems pretty straightforward to implement)? |
I do not believe anyone else is working on this right now. |
The other day I was trying to see template haskell output by passing Maybe a --ghc-output` flag would solve this problem as well? |
Dump output should be going into a dump file inside .stack-work On Tue, Oct 27, 2015 at 6:15 AM, Dennis Gosnell [email protected]
|
I did find the file it was going to, but I had assumed it would work like cabal where the code generated by template haskell is output to stdout. |
@cdepillabout: We pass |
@borsboom Thanks for the updated documentation! Having the |
Should probably use a different argument name than |
@borsboom - I think I am getting stung by this. EDIT: Oh wait, this was unrelated. Sorry for confusion |
I've opened PR #2594 to add a |
I've filed #3225 for a flag that outputs to stdout, instead of a file that one first has to find. |
IIUC
[1] https://discuss.circleci.com/t/too-long-with-no-output-while-building-docker-image/12275 |
@saurabhnanda Should be possibly by parsing GHC output. How about opening a new issue about it? This one is closed and already has a ton of comments. |
Relevant PR: #4097 |
Provide an option to pipe GHC's output to the terminal to better keep track of progress, instead of hanging on
Cabal-1.22.4.0: build
for dependencies that take some time to compile.The text was updated successfully, but these errors were encountered: