Populate user email address in the forms from REMOTE_USER

Is there a way I can pull the current user’s email address to automatically populate a field in the form.yml and submit.yml files for an interactive vnc submit?

Ultimately, I would like to add the option to my form which will enable slurm to email the user when the current session is at 50,80,90, and 100% time limit. You have implemented a similar option with the “bc_email_on_started” option, and I would like to just pull the user’s email to add it into the submit.yml automatically based on the current user.


I’m not entirely sure to be honest. There is a previous thread around some questions about how the emailing works, with a suggestion of how to set headers with this information in the cluster config here:

Which is a bit older and was linked form another conversation around getting emails for jobs here:

In short, I’m not sure of a way to pull this to populate the form and submit unless you can glean something from those posts.

Hi everyone, we do this in submit.yml.erb:

emailcmd = '/uufs/chpc.utah.edu/sys/bin/CHPCEmailLookup.sh ’ + ENV[“USER”]
emailaddr = %x[ #{emailcmd}]

template: vnc
email: <%= emailaddr %>

The /uufs/chpc.utah.edu/sys/bin/CHPCEmailLookup.sh is a script that matches the Linux user name with the e-mail address in our database. That is more robust than the previous setting we had:
email: <%= ENV[“USER”] %>@utah.edu
because some users use other e-mail addresses than our domain.

You could do the same thing in the form.yml.erb to display the e-mail address in the submission form.



Thanks guys for the feedback. I ended up using a text input widget for the email address within the form, then calling that variable in the submit.yml like this:

… “–mail-user”, “#{email}”, “–mail-type”, “TIME_LIMIT_50,TIME_LIMIT_80,TIME_LIMIT_90,TIME_LIMIT”]

I didn’t realize how easy this was to implement, so I am happy with the result =)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.