English 中文(简体)
Troubleshooting SIGTERMs with tee on a cluster within SGE jobs
原标题:

I have some legacy scientific code running on a Rocks cluster, with SGE. I have an application-specific job submission script that generates qsub scripts (i.e. the script which Sun Grid Engine takes and runs).

Within the qsub script, my legacy app is called. This app sends it s output to STDOUT. SGE intercepts STDOUT and spools it into a file in the users home directory, so the user can see results build up in real-time. I want this behavior to be maintained, but at the same time, I want to transparently log all output in the background. I figured tee would be perfect to achieve this.

So I modified the job submission script to run the app and pipe STDOUT to tee, which saves STDOUT to a file that is copied to a central store once the job completes. The app is run and piped to tee as follows:

$GMSCOMMAND | tee $SCRATCHDIR/gamess_output.log

The problem is, ever since I ve started piping the code to tee, the app has been dying with SIGTERMs, especially when I request several nodes. I tried using the -i (ignore interrupts) parameter with tee: it makes no difference.

Things work fine if I redirect the app output to a file then cat the file once the app is done, but then I can t allow users to view results buildup in real-time (which is an important requirement).

Any ideas about why this use of tee might be failing? Or alternatively, any ideas about how else I might achieve the desired functionality?

最佳回答

I don t know anything about why your particular case is failing, but one option might be to make $GMSCOMMAND do it s own logging. (Effectively put the tee inside the app). I guess this option depends on cost of changing the legacy app.

Failing that you could wrap the legacy app with your own script/application to do the redirection/duplication.

问题回答

If pipes are your problem perhaps you can get around this by using a while/read loop with process substitution. Does this work for you?

while read line; do
    echo "$line"
    echo "$line" >> ${SCRATCHDIR}/gamess_output.log
done <(${GMSCOMMAND})




相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签