Ticket 19634

Summary: job_desc->environment empty in salloc job_submit (C plugin) but populated for sbatch
Product: Slurm Reporter: Ryan Cox <ryan_cox>
Component: slurmctldAssignee: Marcin Stolarek <cinek>
Status: RESOLVED INFOGIVEN QA Contact:
Severity: 4 - Minor Issue    
Priority: --- CC: cinek, lloyd_brown
Version: 23.11.5   
Hardware: Linux   
OS: Linux   
See Also: https://bugs.schedmd.com/show_bug.cgi?id=12111
Site: BYU - Brigham Young University Slinky Site: ---
Alineos Sites: --- Atos/Eviden Sites: ---
Confidential Site: --- Coreweave sites: ---
Cray Sites: --- DS9 clusters: ---
Google sites: --- HPCnow Sites: ---
HPE Sites: --- IBM Sites: ---
NOAA SIte: --- NoveTech Sites: ---
Nvidia HWinf-CS Sites: --- OCF Sites: ---
Recursion Pharma Sites: --- SFW Sites: ---
SNIC sites: --- Tzag Elita Sites: ---
Linux Distro: --- Machine Name:
CLE Version: Version Fixed:
Target Release: --- DevPrio: ---
Emory-Cloud Sites: ---

Description Ryan Cox 2024-04-18 11:37:14 MDT
In the job submit plugin, job_submit() has job_desc->environment set to NULL if a job is submitted through salloc but it is populated correctly if submitted through sbatch.  Is this intentional? If so, is there some other way to access the job's environment from job_submit()?  The environment variables do make it through to the job launch for both sbatch and salloc.
Comment 2 Marcin Stolarek 2024-04-19 01:23:42 MDT
Ryan,

That's in fact expected and documented behavior, take a look at[1]:

>NOTE: Only sbatch sends the environment to slurmctld. salloc and srun do not send 
>the environment to slurmctld, so job_desc.environment is not available in the 
>job_submit plugin for these jobs.

When job is run by salloc/srun task lanuch request is send from the client to slurmd, not from slurmctld.

Let me know if that's more clear for you or if you have additional questions on that.

cheers,
Marcin
[1]https://slurm.schedmd.com/job_submit_plugins.html#lua
Comment 3 Marcin Stolarek 2024-04-29 03:59:31 MDT
I'll go ahead and close the case as information given.
Should you have any question spelase reopen.

cheers,
Marcin