Ticket 5201

Summary: Unable to access job_desc.environment (NULL) from Lua job submission script 
Product: Slurm Reporter: Pablo Llopis <pablo.llopis>
Component: slurmctldAssignee: Jacob Jenson <jacob>
Status: RESOLVED INVALID QA Contact:
Severity: 6 - No support contract    
Priority: ---    
Version: 17.11.4   
Hardware: Linux   
OS: Linux   
Site: -Other- Alineos Sites: ---
Atos/Eviden Sites: --- Confidential Site: ---
Coreweave sites: --- Cray Sites: ---
DS9 clusters: --- HPCnow Sites: ---
HPE Sites: --- IBM Sites: ---
NOAA SIte: --- OCF Sites: ---
Recursion Pharma Sites: --- SFW Sites: ---
SNIC sites: --- Linux Distro: ---
Machine Name: CLE Version:
Version Fixed: Target Release: ---
DevPrio: --- Emory-Cloud Sites: ---

Description Pablo Llopis 2018-05-22 03:40:49 MDT
Dear SLURM developers,

I am trying to write a lua job submission script that sets certain environment variables depending on the partition where the job is being submitted to.  When I try to set the environment, I get the following error in the slurmctld log:

 error: _set_job_env_field: job_desc->environment is NULL

The documentation on job submission scripts specifically mentions the following [1]:


Reading and writing of job environment variables using Lua is possible by referencing the environment variables as a data structure containing named elements. For example:
if (job_desc.environment.LANGUAGE == "en_US") then


Therefore, my approach was to do as follows:

function slurm_job_submit(job_desc, part_list, submit_uid)
  if job_desc.partition == "X" or job_desc.partition == "Y" then
    job_desc.environment.MV2_USE_RDMA_CM = "1"
    job_desc.environment.MV2_USE_IWARP_MODE = "1"
  end
  return slurm.SUCESS
end

Unless I missed something, it seems that either this is not working, or there is something missing in the documentation that explains existing limitations or requirements to read and write environment variables.

As you can see, I'm just trying to pass some environment variables to the MPI program depending on the job's partition. Maybe there is a workaround for this?

I'm running SLURM 17.11.4 on CentOS 7.4 and lua-5.1.4-15.el7 on regular x86_64 hardware. Slurm was built on machine with the same config and lua-devel-5.1.4-15.el7.  Let me know if there is any other information you would need to debug this issue.

Thank you in advance for any help!

Cheers,
Pablo

[1] https://slurm.schedmd.com/job_submit_plugins.html