Search code examples
pythonwindowsloggingsshpbs

How to set default app to open log-files despite changing file endings (in MobaXterm)?


Is there a way to set the default application for those log files even if the file endings are constantly changing?

I am working on MobaXterm, and after running some code through a *.pbs file I get the error and output log files in the form:

sample_code.o23456
sample_code.e23456

When I am opening the log files I am asked to set a default app and to choose an app to open the log files.

The next time I execute it the file endings will have changed

sample_code.o23457
sample_code.e23457

Which will leave me again with selecting the app to open the log files.

This is time consuming.

Is there a way to set the default application for those log files even if the file endings are constantly changing?

Note: I am coding in python if that helps and I found this but I don't really want to mess with the log handler.

Edit: Okay this is what I found out so far. One can set the default editor, but this is not solving my problem with the changing file endings.


Solution

  • The answer lies within the *.pbs file

    You can rename the pbs directive by adding following lines for the output and error logs to the *.pbs script, choosing names and file endings that suit your purpose (in my case just having the same endings every time to choose a default application to open the log files):

    #PBS -o output.log
    #PBS -e error.log
    

    Once I got into this I found even more nice things which could be interesting:

    Combine output and error log with:

    $ qsub -o output.log -j oe your.pbs
    

    Place the joined output in another location other than the working directory

    $ qsub -o $HOME/tutorials/logs/output.log -j oe your.pbs
    

    Using the *.pbs script created earlier, submit a job that emails you for all conditions:

    $ qsub -m abe -M NetID@nyu.edu your.pbs
    

    Note: More and in greater detail can be found here