Where are batch_connect helper functions defined?

In some of the interactive server apps (RStudio, Jupyter, etc.) which use batch_connect there are several helper functions, such as:

find_port
create_passwd
wait_until_port_used

Can someone tell me where these are defined and loaded from?

I’ve tried searching the code, but cannot find any reference to them, other than their invocations in the template scripts. This page in the docs references a couple of these functions, but doesn’t say where they’re defined.

Thanks,
Nick

You can can also find all these functions in the job_script_content.sh script in a given jobs’ output directory. That’s where they are during runtime.

They’re come from deep in our Ruby libraries. Here’s what there is for the basic batch connect template and here’s additions for vnc templates just for reference.

Those three functions are all bash scripts defined in the ondemand runtime bits in /opt/ood/…, you can find the templates via

egrep -lr ‘(create_passwd|find_port|wait_until_port_used) ()’ /opt/ood

if you’ve installed ood in the default location. On my system, this comes out to

/opt/ood/ondemand/root/usr/share/gems/2.5/ondemand/1.7.14/gems/ood_core-0.11.4/lib/ood_core/batch_connect/template.rb

Do NOT modify that file, It is RPM controlled, and will be replaced in the next update.

Cheers,

Ric

image001.png

image002.png

1 Like