Skip to main content

Restart Gurobi Compute Server job with python code after status 502

Awaiting user input

Comments

3 comments

  • Alex Ginete
    Gurobi Staff Gurobi Staff

    Hi Hancheng,

    You can implement a retry mechanism using a try-except block. Something like:

    try:
        model.optimize()
    except gp.GurobiError as e:
        error_message = str(e)
        if "status 502" in error_message:
            print("Retrying due to 502")
            model.optimize()

    However, this only retries to optimize the model once. Setting up a retry limit can mitigate this.

    Regards,
    Alex

    0
  • Hancheng Li
    Curious
    First Comment
    Gurobi-versary

    Hi Alex. Thanks for the response, but I don't think it solves the issue, as the code is failing at model creation when it initially communicates with the Compute Server. I think it's gone into idle shutdown after 60 minutes per the Instant Cloud documentation

    model = gp.Model("model_name")

    If I put a try-except here, the except needs to be some command that wakes up the server from idle

    0
  • Alex Ginete
    Gurobi Staff Gurobi Staff

    Hi Hancheng,

    Since you are using Instant Cloud, can you provide me the Job ID so I can check the logs?

    Regards,
    Alex

    0

Please sign in to leave a comment.