@@ -261,7 +261,7 @@ def read_job_state(self):
261261 format_template (self .batch_query_cmd , ** subvars )))
262262 self .log .debug ('Spawner querying job: ' + cmd )
263263 try :
264- out = yield self .run_command (cmd )
264+ out = yield self .run_command (cmd , env = self . get_env () )
265265 self .job_status = out
266266 except Exception as e :
267267 self .log .error ('Error querying job ' + self .job_id )
@@ -280,7 +280,7 @@ def cancel_batch_job(self):
280280 cmd = ' ' .join ((format_template (self .exec_prefix , ** subvars ),
281281 format_template (self .batch_cancel_cmd , ** subvars )))
282282 self .log .info ('Cancelling job ' + self .job_id + ': ' + cmd )
283- yield self .run_command (cmd )
283+ yield self .run_command (cmd , env = self . get_env () )
284284
285285 def load_state (self , state ):
286286 """load job_id from state"""
@@ -512,7 +512,12 @@ def user_env(self, env):
512512 return env
513513
514514 def get_env (self ):
515- """Add user environment variables"""
515+ """Add user environment variables.
516+
517+ Everything here should be passed to the user's job. If it is
518+ used to authenticate to the batch system commands as an admin,
519+ beware that the user will get them too.
520+ """
516521 env = super ().get_env ()
517522 env = self .user_env (env )
518523 return env
0 commit comments