# Losing some output from redirect\_stdout() on remote workers

**URL:** <https://discourse.julialang.org/t/losing-some-output-from-redirect-stdout-on-remote-workers/33153>\
**Category:** Julia at Scale\
**Tags:** optimization\
**Created:** [January 9, 2020, 1:14pm UTC](https://discourse.julialang.org/t/losing-some-output-from-redirect-stdout-on-remote-workers/33153 "2020-01-09T13:14:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![healyp](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@healyp](https://discourse.julialang.org/u/healyp)\
**Post date:** [January 9, 2020, 1:14pm UTC](https://discourse.julialang.org/t/losing-some-output-from-redirect-stdout-on-remote-workers/33153/1 "2020-01-09T13:14:55Z")

</div>

I’m running some CPLEX (a Math. Programming solver) jobs as remote jobs and trapping each job’s output with the following (more or less):

```julia
    local res
    open(traceFile, "w") do out # https://discourse.julialang.org/t/redirect-stdout-and-stderr/13424/4
        redirect_stdout(out) do
            res =runInstance("instance", otherStuff)
        end
        close(out)
    end

```

This appears to work fine from REPL but while it seems to catch the output for /most/ of the remote jobs, I always seem to get some residue output to REPL from (some of) the remote CPLEX jobs like the following:

```julia
      From worker 3:	
      From worker 3:	Cover cuts applied: 61
      From worker 3:	Implied bound cuts applied: 359
      From worker 3:	Flow cuts applied: 82
      From worker 3:	Mixed integer rounding cuts applied: 571
      From worker 3:	Zero-half cuts applied: 243
      From worker 3:	Lift and project cuts applied: 6
      From worker 3:	Gomory fractional cuts applied: 103
      From worker 3:	
      From worker 3:	Root node processing (before b&c):
      From worker 3: Real time = 1.65 sec. (2333.42 ticks)
      From worker 3:	Sequential b&c:
      From worker 3: Real time = 66.38 sec. (92988.06 ticks)
      From worker 3: ------------
      From worker 3:	Total (root+branch&cut) = 68.03 sec. (95321.48 ticks)

```

I don’t know if this is a CPLEX problem or if it is my poor understanding of remote processes.

All help / suggestions appreciated.

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [January 9, 2020, 4:00pm UTC](https://discourse.julialang.org/t/losing-some-output-from-redirect-stdout-on-remote-workers/33153/2 "2020-01-09T16:00:46Z")

</div>

Try also redirecting stderr, I bet it’s coming from there.

---

<div class="post-metadata">

**Author:** ![healyp](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@healyp](https://discourse.julialang.org/u/healyp)\
**Post date:** [January 9, 2020, 4:52pm UTC](https://discourse.julialang.org/t/losing-some-output-from-redirect-stdout-on-remote-workers/33153/3 "2020-01-09T16:52:01Z")

</div>

Thanks, I’m not so sure though. I can’t think of why CPLEX would direct this (albeit, summary) information to stderr and the remainder to stdout. And also, I seem to catch all output when it is run from the REPL.
