I’d suggest using the "-xml” argument, since the output will be easier to parse for web use, I think. That would also never have empty output so you could see exactly what you are getting back.

“Empty” output with the -xml argument looks like:
<?xml version='1.0'?>
<job_info  xmlns:xsd="http://arc.liv.ac.uk/repos/darcs/sge/source/dist/util/resources/schemas/qstat/qstat.xsd">

So maybe that will help.

Brooke Storm
Staff SRE
Wikimedia Cloud Services

On May 11, 2021, at 1:15 PM, Huji Lee <huji.huji@gmail.com> wrote:


Some of the jobs I submit to the grid take a long time (say, 30-60 minutes) and I would like to check on their status without having to log back into the labs.

I was hoping I could run shell_exec('qstat') in PHP and display its output on a web page. While shell_exec() works with other commands—e.g. echo shell_exec('whoami') correctly displays my tool's username on the webpage—for reasons I cannot explain, the output of shell_exec('qstat') is always blank. When I run qstat on the CLI at that same time, it does show me the familiar table output of ongoing jobs.

Any idea why that is the case? Has anyone already created a solution for fetching a list of active jobs from the grid and displaying it on a web-based status page for your tool?

Wikimedia Cloud Services mailing list
To unsubscribe send an email to cloud-leave@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org)