<div dir="ltr"><span style="color:rgb(33,33,33);font-size:13px">Dear Slurm users,</span><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">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:</div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px"> error: _set_job_env_field: job_desc->environment is NULL<br></div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">The documentation on job submission scripts specifically mentions the following [1]:</div><div style="color:rgb(33,33,33);font-size:13px"><div><br></div><div>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:</div><div>if (job_desc.environment.LANGUAGE == "en_US") then</div></div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">Therefore, my approach was to do as follows:</div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px"><div>function slurm_job_submit(job_desc, part_list, submit_uid)</div><div>  if job_desc.partition == "X" or job_desc.partition == "Y" then</div><div>    job_desc.environment.MV2_USE_RDMA_CM = "1"</div><div>    job_desc.environment.MV2_USE_IWARP_MODE = "1"</div><div>  end</div><div>  return slurm.SUCESS</div><div>end</div></div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">Therefore, my two questions are the following:</div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">1) What is it that I'm missing here for being able to access the job's environment?<br></div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">2) Could there be another way of achieving the same thing?  I considered having modulefiles for each partition, but obviously this is less elegant and less transparent and user-friendly.</div><div style="color:rgb(33,33,33);font-size:13px">(Unfortunately, setting these settings on each node's /etc/mvapich2.conf did not work for me, which I also tried to avoid all of this altogether).</div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">Thank you in advance for any help!</div><div style="color:rgb(33,33,33);font-size:13px">Cheers,</div><div style="color:rgb(33,33,33);font-size:13px">Pablo</div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">[1] <a href="https://slurm.schedmd.com/job_submit_plugins.html" target="_blank">https://slurm.schedmd.com/job_submit_plugins.html</a></div></div>