Open JosuaKrause opened 7 years ago
The problem here is that the script
parameter was initially supposed to be a file, part of the job. In particular, the server needs to set +x before running it.
I have no way of supporting files and commands both with and without --login
here. Perhaps wrapping in sh -l
should be the expected way to do this? (this is what tej would do anyway)
def login_shell(command):
return '/bin/sh -l -c %s' % tej.submission.shell_escape(command)
queue.submit(None, mydir, login_shell('which conda'))
hmm, why do you need to support without --login
? Also, if you run the command / file via '/bin/sh -l -c %s' % tej.submission.shell_escape(command)
you don't need to set +x for the file.
It actually does need to be +x for your above command to work (it's gonna expand to '/bin/sh -l -c "./script"'
). Not using -c
wouldn't need +x, but then it can only be a bash script.
I see, yes I'm currently doing it without -c
but I see the problem with normal commands. But the +x code is already in place anyway.
The
--login
(-l
) option advisessh
to act like a login shell (which is not the case when normally invoked by ssh) and source/etc/profile
and one of~/.bash_profile
,~/.bash_login
, and~/.profile
. This makes commands run in user specified environments and also enables built-ins like themodule
command. The behavior can currently be achieved by passing"sh -l " + your_command
tosubmit
.