I’m trying to setup Spark to work with Jupyter notebooks at our site. I have several issues I’m working through, but one is that I keep seeing these error messages in the output.log file (full job path replaced with “…”):
.../script.sh: line 5: port_used_nc: command not found
.../script.sh: line 5: port_used_lsof: command not found
.../script.sh: line 5: port_used_bash: command not found
.../script.sh: line 5: port_used_python: command not found
.../script.sh: line 5: port_used_python3: command not found
.../script.sh: line 5: port_used_nc: command not found
.../script.sh: line 5: port_used_lsof: command not found
.../script.sh: line 5: port_used_bash: command not found
.../script.sh: line 5: port_used_python: command not found
.../script.sh: line 5: port_used_python3: command not found
I see that these are all defined in job_script_content.sh. Is there any reason these functions shouldn’t be visible to my before.sh and script.sh?
Just a quick update: Manually running source_helpers at the beginning of each script and inside the Spark worker script seems to have solved this problem.
Although, I see that this is already being run in job_script_content.sh. On further inspection, it looks like some functions within source_helpers are exported in their own right, while the port_used_* commands are not. For example, port_used is exported:
port_used () {
local port="${1#*:}"
local host=$((expr "${1}" : '\(.*\):' || echo "localhost") | awk 'END{print $NF}')
local port_strategies=(port_used_nc port_used_lsof port_used_bash port_used_python port_used_python3)
for strategy in ${port_strategies[@]};
do
$strategy $host $port
status=$?
if [[ "$status" == "0" ]] || [[ "$status" == "1" ]]; then
return $status
fi
done
return 127
}
export -f port_used