Code Monkey home page Code Monkey logo

Comments (8)

joehuchette avatar joehuchette commented on July 20, 2024

Yeah I see this as well, I mostly use CPLEX but I think I've noticed it for other solvers as well. I have pretty much no idea how to work around this though, but @mlubin maybe has some thoughts?

from cplex.jl.

mlubin avatar mlubin commented on July 20, 2024

I've seen similar issues but haven't been following the state of signal
handling in julia.
CC @tkelman @vtjnash
On Jul 30, 2015 1:02 PM, "Joey Huchette" [email protected] wrote:

Yeah I see this as well, I mostly use CPLEX but I think I've noticed it for
other solvers as well. I have pretty much no idea how to work around this
though, but @mlubin https://github.com/mlubin maybe has some thoughts?


Reply to this email directly or view it on GitHub
#45 (comment).

from cplex.jl.

tkelman avatar tkelman commented on July 20, 2024

might need some sigint fiddling? ref JuliaLang/julia#2622 and JuliaLang/julia#12309

from cplex.jl.

joehuchette avatar joehuchette commented on July 20, 2024

So just wrapping e.g.

stat = disable_sigint() do
    @cpx_ccall(mipopt, Cint, (Ptr{Void}, Ptr{Void}), model.env.ptr, model.lp)
end

means CPLEX just keeps running after CTRL+C, which IMO is less desirable than a brutal segfault. Ideally we'd want to propagate the SIGINT to CPLEX so it can fail gracefully, but I'm not certain how to do that.

from cplex.jl.

leotac avatar leotac commented on July 20, 2024

The CPLEX callable library does provide a function to terminate it gracefully: http://www-01.ibm.com/support/knowledgecenter/SSSA5P_12.6.2/ilog.odms.cplex.help/refcallablelibrary/cpxapi/setterminate.html?cp=SSSA5P_12.6.2%2F2-8-0-30-2&lang=en
I wonder if it's possible to (temporarily) replace the default Julia signal handler with something that ccalls CPXsetterminate(). Make sense?

from cplex.jl.

joehuchette avatar joehuchette commented on July 20, 2024

Looks like maybe we could do something like this:

try 
    @cpx_ccall(mipopt, Cint, (Ptr{Void}, Ptr{Void}), model.env.ptr, model.lp)
catch ex
    if isa(ex, InterruptException)
        @cpx_ccall(setterminate, Cint, (Ptr{Void}, Ptr{Void}), model.env.ptr, CPLEX_SIGINT)
    else
        rethrow(ex)
    end
end

(ref http://stackoverflow.com/questions/20831290/julia-handle-keyboard-interrupt)

from cplex.jl.

joehuchette avatar joehuchette commented on July 20, 2024

I don't know what CPLEX_SIGINT should be, though.

from cplex.jl.

joehuchette avatar joehuchette commented on July 20, 2024

In my not too exhaustive testing, ab71579 seems to give the expected behavior now. Reopen if I'm wrong!

from cplex.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.