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

Access to worker stdout/stderr #82

Open
Socob opened this issue Sep 2, 2024 · 2 comments
Open

Access to worker stdout/stderr #82

Socob opened this issue Sep 2, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Socob
Copy link

Socob commented Sep 2, 2024

It would be nice to have some control over where the worker’s stdout/stderr goes. Currently, there is no (documented) way to access this, and output is just silently dropped. To some extent, this can be done via Worker.proc, but presumably this should not be relied on?

@fonsp
Copy link
Member

fonsp commented Sep 3, 2024

Thanks for the feedback!

I think this stdout should be shown on the terminal of the server, just like Distributed. You said that you can access this with .proc. Do you know how to relay this to the server terminal?

Distributed adds From Worker 5: before each stdout line. Is that easy to implement?

@Socob
Copy link
Author

Socob commented Sep 3, 2024

I think this stdout should be shown on the terminal of the server, just like Distributed.

To clarify, do you mean that this is how it currently works (which it doesn’t, as far as I can tell), or that the behavior should be changed to this in the future?

Distributed does this:

function redirect_worker_output(ident, stream)
    t = @async while !eof(stream)
        line = readline(stream)
        if startswith(line, "      From worker ")
            # stdout's of "additional" workers started from an initial worker on a host are not available
            # on the master directly - they are routed via the initial worker's stdout.
            println(line)
        else
            println("      From worker $(ident):\t$line")
        end
    end
    errormonitor(t)
end

The same could be done here, with stream being Worker.proc. I actually find the prefix " From worker " quite annoying in Distributed though (it can’t be turned off), so if this is implemented, I’d argue in favor of at least making it configurable.

@fonsp fonsp added good first issue Good for newcomers enhancement New feature or request labels Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants