Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

general --bind-to solution for vpn/multi-IP systems #2094

Merged
merged 1 commit into from
Jan 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function try_include(f::String)
end

function process_options(args::Array{Any,1})
global ARGS
global ARGS, bind_addr
quiet = false
repl = true
startup = true
Expand All @@ -188,6 +188,9 @@ function process_options(args::Array{Any,1})
elseif args[i]=="--worker"
start_worker()
# doesn't return
elseif args[i]=="--bind-to"
i += 1
bind_addr = args[i]
elseif args[i]=="-e"
# TODO: support long options
repl = false
Expand Down Expand Up @@ -270,6 +273,9 @@ isinteractive() = (is_interactive::Bool)
function _start()
# set up standard streams

# set default local address
global bind_addr = getipaddr()

@windows_only if !has(ENV,"HOME")
ENV["HOME"] = joinpath(ENV["APPDATA"],"julia")
end
Expand Down
10 changes: 5 additions & 5 deletions base/multi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ function start_worker(out::Stream)
(actual_port,sock) = open_any_tcp_port(default_port,(handle,status)->accept_handler(handle,status))
write(out, "julia_worker:") # print header
write(out, "$(dec(actual_port))#") # print port
write(out, "localhost") #TODO: print hostname
write(out, bind_addr) #TODO: print hostname
write(out, '\n')
# close STDIN; workers will not use it
#close(STDIN)
Expand Down Expand Up @@ -974,11 +974,11 @@ function ssh_tunnel(user, host, port)
end

function worker_ssh_cmd(host)
`ssh -n $host "bash -l -c \"cd $JULIA_HOME && ./julia-release-basic --worker remote\""`
`ssh -n $host "bash -l -c \"cd $JULIA_HOME && ./julia-release-basic --worker\""`
end

#function worker_ssh_cmd(host, key)
# `ssh -i $key -n $host "bash -l -c \"cd $JULIA_HOME && ./julia-release-basic --worker remote\""`
# `ssh -i $key -n $host "bash -l -c \"cd $JULIA_HOME && ./julia-release-basic --worker\""`
#end

function addprocs_ssh(machines)
Expand All @@ -1003,7 +1003,7 @@ end
# add_workers(PGRP, start_remote_workers(machines, map(x->worker_ssh_cmd(x[1],x[2]), cmdargs)))
#end

worker_local_cmd() = `$JULIA_HOME/julia-release-basic --worker local`
worker_local_cmd() = `$JULIA_HOME/julia-release-basic --bind-to $bind_addr --worker`

addprocs_local(np::Integer) =
add_workers(PGRP, start_remote_workers({ "localhost" for i=1:np },
Expand All @@ -1015,7 +1015,7 @@ function start_sge_workers(n)
sgedir = "$home/../../SGE"
run(`mkdir -p $sgedir`)
qsub_cmd = `qsub -N JULIA -terse -e $sgedir -o $sgedir -t 1:$n`
`echo $home/julia-release-basic --worker remote` | qsub_cmd
`echo $home/julia-release-basic --worker` | qsub_cmd
out = cmd_stdout_stream(qsub_cmd)
if !success(qsub_cmd)
error("batch queue not available (could not run qsub)")
Expand Down