Ticket 5201 - Unable to access job_desc.environment (NULL) from Lua job submission script 
Summary: Unable to access job_desc.environment (NULL) from Lua job submission script 
Status: RESOLVED INVALID
Alias: None
Product: Slurm
Classification: Unclassified
Component: slurmctld (show other tickets)
Version: 17.11.4
Hardware: Linux Linux
: 6 - No support contract
Assignee: Jacob Jenson
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2018-05-22 03:40 MDT by Pablo Llopis
Modified: 2018-05-22 03:40 MDT (History)
0 users

See Also:
Site: -Other-
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: ---


Attachments

Note You need to log in before you can comment on or make changes to this ticket.
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