How to update "application status" in dirac job monitor?
Hello I was wondering I there is a way for a general user (i.e. me) to dynamically change what is displayed under “Application status” in the Job monitor when an application is running? At the moment it just says “Unknown” for my applications and I was wondering if I could change it to be a bit more informative since the applications can be quite long and the StdOut peek doesn’t always make it obvious how far things have got. Is there something I can add to the run script to update that field? Cheers Anna
Hi Anna, On Wed, Aug 04, 2021 at 04:43:01PM +0000, Anna Scaife wrote:
Is there something I can add to the run script to update that field?
There is no simple way to update this field from a job, but it can be written via the python API. I've attached an example script for doing this, which can be included in the input sandbox and run from a job script: ./update_status.py "Job is doing something..." (Note that this must be run in the default DIRAC python environment within a job, if any other python environment is used, it has to be run outside of that). Regards, Simon ### update_status.py ### #!/usr/bin/env python import os import sys from DIRAC.Core.Base import Script Script.initialize() from DIRAC.WorkloadManagementSystem.Client.JobReport import JobReport jobid = os.getenv('DIRACJOBID') if not jobid: print("This command only works from within a DIRAC job") sys.exit(1) if len(sys.argv) < 2: print("Usage: update_status.py <status message>") sys.exit(1) appstatus = sys.argv[1] jr = JobReport(int(jobid)) res = jr.setApplicationStatus(appstatus) if not res['OK']: print("Failed to update application status: %s" % str(res)) sys.exit(1) sys.exit(0)
participants (2)
- 
                
                Anna Scaife
- 
                
                Simon Fayer