Re: [slurm-users] LAST TASK ID

2018-02-06 Thread Michael Gutteridge
Hi

The environment variable SLURM_ARRAY_TASK_MAX might be used for this as
well, e.g.:

if [ $SLURM_ARRAY_TASK_ID -eq $SLURM_ARRAY_TASK_MAX ]
then
   # last task
fi

Though I'd caution that if you need this to run after all the jobs in the
array are _complete_, you should use a job dependency.  Not sure how your
scheduling is set up, but in our setup there's no guarantee that task 10
will complete before task 11.

HTH

Michael



On Tue, Feb 6, 2018 at 7:40 AM, david martin  wrote:

> Hi,
>
> I´m running a batch array script and would like to execute a command after
> the last task
>
>
> #SBATCH --array 1-10%10:1
>
> sh myscript.R inputdir/file.${SLURM_ARRAY_TASK_ID}
>
> # Would like to run a command after the last task
>
> For exemple when i was using SGE there was something like this
>  if($SGE_TASK_ID == $SGE_TASK_LAST ) then
>   # do last-task stuff here
> endif
>
>
> Can i do that with slurm ?
>
>
>


[slurm-users] LAST TASK ID

2018-02-06 Thread david martin

Hi,

I´m running a batch array script and would like to execute a command 
after the last task



#SBATCH --array 1-10%10:1

sh myscript.R inputdir/file.${SLURM_ARRAY_TASK_ID}

# Would like to run a command after the last task

For exemple when i was using SGE there was something like this

| if($SGE_TASK_ID == $SGE_TASK_LAST ) then|
|||#||do||last-task stuff here|
|endif|


Can i do that with slurm ?