Hi Kent, Responses in-line below.
Quoting Kent Engström <[email protected]>: > > SLURM developers, > > I've run into a problem. In the job_submit.lua script, I want to set > partition (and/or in the future perhaps reservation and other > parameters) based on the account of the user submitting the job. > > This works well if the partition has been explicitly given > (using -A ACCOUNT or $SBATCH_ACCOUNT), but if the user has not specified > the account, it seems that job_desc.account will be nil > (and the account will be set to the sacctmgr-set Default Account further > down after running the plugin. > > I tried to work around this by setting SBATCH_ACCOUNT on login > to the Default Account from the database. It seemed to work OK, > as job_desc.account was now set to that value, or the one provided > with -A on the command line. > > What I had not though about was that users may very well expect to use > "#SBATCH -A DIFFERENTACCOUNT" in their batch files, but that will not > take effect as $SBATCH_ACCOUNT wins over that. > > So I guess my questions/wishes are: > > - Can I get hold of the default account in the job_submit.lua in some > way so I can use that to set partition etc. if job_desc.account is nil? That information does not seem to be available today to the lua script, but the src/job_submit/lua/job_submit_lua.c could be modified to make that information available in a new variable. It would need to execute the assoc_mgr_fill_in_assoc() function to get the information then pass it in a new variable. > - Can I access environment variables (so I can set some other > environment variable instead of SBATCH_ACCOUNT and peek at it in > job_submit.lua)? That information does not seem to be available today to the lua script, but the src/job_submit/lua/job_submit_lua.c could be modified to make that information available in a new variable. > - More general: would it be worthwhile to have another layer of > environment variables, so that the order of precedence could be > > 1) -A on the command line > 2) Environment variable SBATCH_ACCOUNT > 3) -A in the batch file > 4) Environment variable SBATCH_ACCOUNT_DEFAULT (or some other name) Perhaps. I'll let others respond to this. > - Any other work-around suggestions? > > Regards, > -- > Kent Engström, National Supercomputer Centre, Sweden > [email protected], +46 13 28 4444
