@@ -261,7 +261,7 @@ def read_job_state(self):
261
261
format_template (self .batch_query_cmd , ** subvars )))
262
262
self .log .debug ('Spawner querying job: ' + cmd )
263
263
try :
264
- out = yield self .run_command (cmd )
264
+ out = yield self .run_command (cmd , env = self . get_env () )
265
265
self .job_status = out
266
266
except Exception as e :
267
267
self .log .error ('Error querying job ' + self .job_id )
@@ -280,7 +280,7 @@ def cancel_batch_job(self):
280
280
cmd = ' ' .join ((format_template (self .exec_prefix , ** subvars ),
281
281
format_template (self .batch_cancel_cmd , ** subvars )))
282
282
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 () )
284
284
285
285
def load_state (self , state ):
286
286
"""load job_id from state"""
@@ -512,7 +512,12 @@ def user_env(self, env):
512
512
return env
513
513
514
514
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
+ """
516
521
env = super ().get_env ()
517
522
env = self .user_env (env )
518
523
return env
0 commit comments