Running a remote bash command within the same ssh session as remote Python interpreter

Hi.

I'm using a remote ssh Python interpreter. I need to raise the maximum number of open files available to my program. For that, I'd like to run 'ulimit -Sn 8192'. I'm facing 2 problems in doing so:

1) When I set this up in the "Before launch" part of the configuration, I get something like this:

ssh://user@server:22:ulimit -n 8192
env: ‘ulimit’: No such file or directory

2) Even if the above did work, I suspect it wouldn't help me, as it'd change ulimit in a separate process; and when afterwards my script will be run, it will be run with a separate ssh command, and so ulimit will revert to the default value.

 

I tried working around the problem by setting ulimit in my .bash_profile and .bashrc files, but apparently they are not sourced when the command like "ssh://user@server:22/bin/python3.7 -u script.py" is run.

I also tried running ulimit from inside my script using os.system, but this also doesn't work, because it spawns a new process, sets ulimit there, and exits back to my main process, ulimit of which is not changed.

Now I'm at a loss and would appreciate any assistance

Please sign in to leave a comment.