qevent(1)

πŸ’– qevent(1) β€” the Grid Engine event-listener era πŸ’–

okay bestie, come closer, because qevent is one of those lil utilities that's lowkey iconic once you get it. It lives in the General Commands Manual section, and it's about to be your new hyperfixation. πŸ¦‹


✨ NAME ✨

qevent β€” subscribe and respond to Grid Engine events. yes queen, it's literally in the name. πŸ‘‘


🌸 DESCRIPTION 🌸

So here's the vibe: qevent subscribes to "events" that the Grid Engine system is out here generating, and then it just... loops. Forever. Living its best life. πŸ™ˆ But before it starts looping, it writes its own pid to the file qevent.pid, which is giving "leaving a note on the fridge so you know where I am."

Who's using this? The Grid Engine test suite, mostly. But also β€” and this is the slay part β€” you can use it to wait for a job or a task to finish, and it's way more efficient than sitting there running qstat in a loop like some kind of peasant. 😭 No cap.

Peep the example down below, it'll make it click. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

qevent [-h|-help] [-ts|-testsuite] [-sm|-subscribe] [-trigger event
script [-trigger event script],...]

πŸ’… OPTIONS πŸ’…

  • -h, -help β€” shows you the usage. that's it, that's the whole job. short king behavior. πŸ‘‘
  • -ts, -testsuite β€” run in test suite mode. yes, the mode named after the test suite. we love a self-explanatory moment. ✨
  • -sm, -subscribe β€” run in subscribe mode, which means it prints events from the system as they come in. it's giving live commentary. πŸ“
  • -trigger event script β€” this is the main character right here. it starts an executable script whenever the specified event occurs. the script gets handed three arguments, in this order: the event name, the job id, and the task id. fr fr, three whole arguments. 🫢

and event has to be one of these two:

  • JB_END β€” signals a job end. it's over, bestie. πŸ’€
  • JB_TASK_END β€” signals a job task end. one lil piece of the job said bye. 🌈

🧚 FILES 🧚

  • qevent.pid β€” the id of the qevent process. that's the receipt, keep it. πŸ’œ

⭐ EXAMPLE ⭐

okay so this is the moment. here's how you'd wait for a job β€” and you'd reach for this when the -sync, -hold_jid, or -hold_jid_ad options of qsub just aren't cutting it. like, they tried their best, but no. πŸ™ˆ

$ cat wait-for-job
#!/bin/sh
if [ "$2" = $JOBID ]; then
    echo Job $JOBID finished
    kill $(cat qevent.pid)
    exit 0
fi
$ export JOBID=`qsub -b y -terse sleep 30`
$ qevent -trigger JB_END ./wait-for-job
Job 122837 finished
$

see how the script checks $2 against $JOBID? that's the job id argument showing up exactly where the manpage said it would. and then it goes and kills the process using the pid it read out of qevent.pid. iconic. the whole loop. ate. πŸ”₯


πŸ’€ BUGS πŸ’€

Needs tidying up and extending.

yep. that's the entire bug report. it's giving "we'll fix it later" energy and honestly? relatable. 😭


and that's the whole page, bestie!! every flag, every argument, every file, every vibe β€” all accounted for. πŸ¦‹

this lil legend is from 2012-01-09, and it's part of the General Commands Manual family (that's the qevent(1) you'll see floating around in the header/footer). mwah. take care of her. πŸ’–