0

I'm writing a front-end script to enable users to simply submit and query jobs to a gridengine cluster. Specifically, we want to be able to display via this script info about all of the queues including the name of the logfile for the currently running job in that queue.

I see how to tell SGE/OGE to write to a specific logfile, but our logfiles typically have the name of the host that ran the job in their paths (this gridengine system is being fitted into an already existing system). So we can't construct the logfile name at submittal time, but rather at the time of the job's start on the execution node.

What we'd like to do is take that logfile path and somehow associate it with the job such that SGE knows about it and could display it back to us via qstat or qacct. Is there any way to stuff the logfile name into some structure that qstat has access to?

I was initially thinking of adding an env var to the job via qalter, but if I'm understanding the docs correctly I'd need to kill and resubmit the job in that case as qalter only works on pending jobs.

1
  • The assertion that qalter only works on pending jobs is obviously not true for all attributes as the solution (workaround?) I posted shows. Oct 27, 2011 at 15:24

1 Answer 1

0

Wow, I guess I didn't read the man pages enough. There is an -ac flag to qalter that does just about this very thing.

Specifically, in my script that runs on the execution node I can do something like this:

# compute logfile name
logfile=/my/path/to/logfiles/$queuename/$jobname.log

# send the logfile back to SGE via a context entry
qalter $JOB_ID -ac MYLOGFILE=$logfile

# now start the real job work
somecommand -with some -options

$JOB_ID is one of the magical env vars that SGE inserts into the process space of the job running on the execution nodes. The context info will be displayed via a 'qstat -j ID' command or to get them all 'qstat -j \*'

It's not clear to me yet what kinds of info I can stash in that field, but it seems to be working for the case of putting a logfile back into the job record.

1
  • But I'm still interested to see if others have better ideas. Oct 26, 2011 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .