メインコンテンツへスキップ

gurobi.log files abound!

回答済み

コメント

10件のコメント

  • Riley Clement
    • Gurobi Staff

    Hi Krister,

    these appear in any directory where gurobi is used from,

    This is normal

    but also in any directory where .bashrc is sources

    This is not.

    export GRB_LOGFILE=/home/myuser/.gurobi/gurobi.log

    This seems like an AI hallucination (there is no GRB_LOGFILE variable)

    The environment variables you have set look ok, and they would not trigger Gurobi to run (which is really the only way we can get a log file).  I'm thinking there is something else going on in your .bashrc

    If I open a ticket in our Help Center would you be willing to share your entire .bashrc file there?

    - Riley

    0
  • Krister Swenson
    • Conversationalist
    • First Question

    Sure.

    0
  • Krister Swenson
    • Conversationalist
    • First Question

    these appear in any directory where gurobi is used from,

    This is normal

    Thanks for your response Riley,  is there any way to get gurobi to write a log to somewhere other than the current working directory?  I use gurobi on it's own, but snakemake will also use it, meaning anywhere I use snakemake, a gurobi.log file will appear as well.  It's a nuisance.

    0
  • Riley Clement
    • Gurobi Staff

    Hi Krister,

    Yes the LogFile parameter is what you need.

    You can set its value to either relative or absolute paths to where you want the logfile to be.  E.g. in Python:

    model.params.LogFile = “/path/to/folder/containing/logs/mylogfile.log”

    I will open up the ticket shortly and you will receive an email to this effect.

    - Riley

    0
  • Krister Swenson
    • Conversationalist
    • First Question

    I'm running other people's snakemake pipelines, therefore I don't want to modify and install the gurobi python API for every pipeline I have access to.  It would help to have a global setting or environment variable to this effect!

    0
  • Riley Clement
    • Gurobi Staff

    Hi Krister,

    You can add a file named gurobi.env to a directory where you run Gurobi from.  Inside the gurobi.env you can add parameters (one line for each) like so:

    LogFile /path/to/folder/containing/logs/mylogfile.log

    This is the closest thing to a global setting I can imagine will ever be available.

    You could consider creating a shell function to that takes a log filepath (or reads it from an environment variables) and snakemake args, creates the gurobi.env file with that setting, runs snakemake, then deletes the gurobi.env file if you want to automate it further.

    - Riley

    0
  • Krister Swenson
    • Conversationalist
    • First Question

    OK.

    Are you going to make that ticket so that we can get rid of the log files that appear when the .bashrc is read?

    0
  • Riley Clement
    • Gurobi Staff

    The ticket was created Thursday last week and you should have received two emails in regards to it.  Can you check you check your spam/junk folder?

    0
  • Krister Swenson
    • Conversationalist
    • First Question

    Hello Riley Clement,

    I'm trying to implement the bash function you mentioned.  I put this in my .bashrc:

    snakemake() {
      echo "LogFile=/tmp/gurobi.log" > gurobi.env
      echo "OutputFlag=0" >> gurobi.env
      command snakemake "$@"
      rm -f gurobi.env
      }

    In addition to appending log output to /tmp/gurobi.log, the file ./gurobi.log is ALSO created.  This is not the behavior I was expecting. I will probably remove the ./gurobi.log file inside the bash function, but I am communicating that this LogFile parameter may not be working as advertised.

    0
  • Riley Clement
    • Gurobi Staff

    Hi Krister,

    Unfortunately I think this will be unavoidable, unless you are using a license which can be enabled via connection parameters (for example, WLS, InstantCloud, ComputeServer).

    Right down the bottom of this article we mention the order that things are processed.
    https://support.gurobi.com/hc/en-us/articles/360044784552-How-do-I-suppress-all-console-output-from-Gurobi

    In particular you will see that Gurobi reads the license file (if it exists) before reading gurobi.env, and so there is a little bit of logging, such as:

    Gurobi 13.0.0 (mac64[arm], gurobi_cl) logging started Tue Jan 20 15:48:04 2026
    
    Set parameter LicenseID to value 123456

    which will end up in the gurobi.log file, before the LogFile parameter can take effect.  The rest of the logging will end up in your /tmp/gurobi.log file.

    The other alternative, as explained in the article, is to use an API as opposed to the command line, but this won't apply in your situation.

    - Riley

    0

サインインしてコメントを残してください。