Sarah Mulholland <[email protected]> writes:

> Thanks, I have read it several times, but I haven’t found a solution.
> I want my epilog to communicate the job exit status through a specific
> port.  Thus I generate the epilog script on the fly before submitting
> the job.  I tried running squeue in the epilog, but the job is already
> off the queue.  Are there any other tricks I could use for getting the
> job exit status in the epilog?

While the epilog is running, the job in question should be in
completing state, and you should be able to query it with squeue
or scontrol. I'm not sure if squeue has a mode to show exit code,
but using 'scontrol show job' you should be able to grab
the jobid of interesting and parse the exitcode from the output.

However, there might be a better way to do want you want if you
explain the purpose of this job-specific epilog script. Maybe you
can use a job completion plugin or other mechanism with a bit more
ease?

mark

>
> Thanks,
>
> Sarah
>
> From: gugga 4u [mailto:[email protected]]
> Sent: Monday, August 13, 2012 12:06 PM
> To: slurm-dev
> Subject: [slurm-dev] Re: exit code in epilog script?
>
>
> Refer to the section on "Prolog and Epilog Scripts" at 
> http://www.schedmd.com/slurmdocs/slurm.conf.html.
>
>
> From: Sarah Mulholland [mailto:[email protected]]
> Sent: Monday, August 13, 2012 11:37 AM
> To: slurm-dev
> Subject: [slurm-dev] Re: exit code in epilog script?
>
> I should say that I am generating my epilog script on the fly because it 
> communicates back to another process using a process-specific xmlrpc port to 
> report exit status.  Thus a slurmctldepilog that is generically specified in 
> the slurm.conf won’t serve my purpose.  Is there any way for my job-specific 
> epilog to get the exit code?
>
>
> On Mon, Aug 13, 2012 at 1:15 PM, Sarah Mulholland 
> <[email protected]<mailto:[email protected]>> wrote:
> When I print the environment from my job epilog script, I don’t see either 
> SLURM_JOB_DERIVED_EC or SLURM_JOB_EXIT_CODE.  There are about a dozen 
> environment variables set, but nothing that suggests the exit code.  Any 
> suggestions for how I can grab this value?  I am running slurm-2.3.5
>
> My test (foo.py):
>
> #!/usr/bin/env python
> import sys
> print ‘running a test’
> sys.exit(1)
>
> My epilog script (bar.py):
>
> #!/usr/bin/env python
> from os import environ as env
> for k,v in env.iteritems():
>     print k, ‘:’, v
>
> My command line:
> srun –n 1 –epilog=bar.py foo.py | grep SLURM
>
> From: Lyn Gerner 
> [mailto:[email protected]<mailto:[email protected]>]
> Sent: Wednesday, June 27, 2012 12:03 PM
> To: slurm-dev
> Subject: [slurm-dev] Re: exit code in epilog script?
>
> Hi Sarah,
>
> You can get this thru $SLURM_JOB_DERIVED_EC (highest exit code from the job; 
> sorry, can't locate it in the docs right now).
>
> Regards,
> Lyn
>
> On Wed, Jun 27, 2012 at 10:46 AM, Sarah Mulholland 
> <[email protected]<mailto:[email protected]>> wrote:
> I’m a newbie setting up slurm.  I found the example epilog script, and I 
> grabbed the user id and job number in my epilog script.  I hunted through the 
> documentation and source code, but I don’t see if it is possible to get the 
> exit code of the job in the epilog script? Is it?
>
> Thanks in advance,
>
> Sarah
> Error! Filename not specified.
>
>
> Error! Filename not specified.

Reply via email to