[slurm-users] Executing slurm command from Lua job_submit script?

Marcus Wagner wagner at itc.rwth-aachen.de
Tue Apr 14 18:54:03 UTC 2020


Hi Chansup,

os.execute just returns the EXIT code of the command.

You will need to do a little more, to catch the output of your program, e.g.

function shellExecute(cmd, Output)
    if (Output == nil) then Output = true end
    local file = assert(io.popen(cmd, 'r'))
    if (Output == true) then
       local cOutput = file:read('*all')
       file:close()
       return cOutput
    else
       file:close()
       return
    end
end


Sorry for the delay, I`m on easter holidays and did not follow the list.

Best
Marcus

Am 03.04.2020 um 14:56 schrieb CB:
> Hi Marcus,
>
> the essence of the code looks like
>
> in job_submitl.lua script, it execute an external script
>
> os.execute("/etc/slutm/test.sh".." "..job_desc.partition)
>
> and the external test.sh executes the following command to get the 
> partition summary for further processing.
>
> sinfo -h -p $1 -s
>
> But, this sinfo command returned no result.
>
> Regards,
> Chansup
>
> On Fri, Apr 3, 2020 at 1:28 AM Marcus Wagner 
> <wagner at itc.rwth-aachen.de <mailto:wagner at itc.rwth-aachen.de>> wrote:
>
>     Hi Chansup,
>
>     could you provde a code snippet?
>
>     Best
>     Marcus
>
>     Am 02.04.2020 um 19:43 schrieb CB:
>     > Hi,
>     >
>     > I'm running Slurm 19.05.
>     >
>     > I'm trying to execute some Slurm commands from the Lua
>     job_submit script
>     > for a certain condition.
>     > But, I found that it's not executed and return nothing.
>     > For example, I tried to execute a "sinfo" command from an
>     external shell
>     > script but it didn't work.
>     >
>     > Does Slurm prohibit to execute any Slurm command from the Lua
>     job_submit
>     > command?
>     >
>     > Thanks,
>     > - Chansup
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20200414/5c6590c9/attachment.htm>


More information about the slurm-users mailing list