Closed baggepinnen closed 7 years ago
I would guess that it's an error in show(::IOContext{Base.Terminals.TTYTerminal}, ::JuMP.Model) at /home/fredrikb/.julia/v0.6/JuMP/src/print.jl:167
. The Trace
object seems to be correctly computed, but there's an error when displaying some part of it. You could probably fix it by writing TraceCalls.show_val(io::IO, mime, ::JuMP.Model) = write(io, "SomeModel")
, but it's better to track it down and file an issue in JuMP. If you write trace_jump = @trace JuMP ...your_code...;
with the ;
at the end, then it won't be displayed, and you can inspect trace_jump
gradually with prune
. Or maybe try
for tr in collect(trace_jump)
for arg in tr.args
if arg isa JuMP.Model println(arg) end
end
end
This will print all Model
objects in your trace, and hopefully can identify the one that cannot be printed properly.
I just pushed a potential fix. It will display the trace correctly, but with <error displaying Model instance>
where it gets the error from JuMP. Of course, it'd be nice to fix the broken show
method in JuMP.
Please Pkg.checkout("TraceCalls")
then try again your @stacktrace
call. Let me know if it works.
Pkg.checkout("TraceCalls")
does fix the error, thanks! As for reporting in the JuMP
repo, do you think it's a good idea to save the trace_jump
to a file, e.g., using JLD
and have them look at it, or there is no guarantee that it will open correctly on another system?
Either way, I'll look into the JuMP error and report it over there
When I run the code
for tr in collect(trace_jump)
for arg in tr.args
if arg isa JuMP.Model println(arg) end
end
end
The error does not occur, are you sure the same code is called by println(arg)
as is called when the stacktrace is printed?
Can you see the <error displaying Model>
? If you can, you can get the object from the trace by indexing (eg. trace_jump[1,1]
), then access the args/kwargs/value (trace_jump[1,1].args[2]
- get second argument). show_val
calls show(STDOUT, object)
by default, so you can try calling that manually on the object, or dump
it.
JLD
doesn't work, unfortunately, because it cannot save functions and modules. It should ideally be fixed over there, but I suppose we could implement a work-around.
We found the source of the error in JuMP (https://github.com/JuliaOpt/JuMP.jl/issues/1092). It was due to JuMP
expecting solver type names to follow a certain format, and the solver used did not. I'm letting the authors of JuMP
decide how they want to handle it.
Let me know if you have any other issue!
I get an error while using
TraceCalls
together withJuMP
. Without@trace
, the Eception trace looks like thiswith
@stacktrace
, I get an error in JuMP (which makes me unsure whether this is the right place to report this or not)I hope you can tell me if this is an
TraceCalls
bug or aJuMP
bug. Either way, this new package is super exciting! Found it through discourse.