diff --git a/base/client.jl b/base/client.jl index 62143e5a7643d..602468cd172bf 100644 --- a/base/client.jl +++ b/base/client.jl @@ -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 @@ -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 @@ -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 diff --git a/base/multi.jl b/base/multi.jl index 1aca76069d395..0361e7ea02e4a 100644 --- a/base/multi.jl +++ b/base/multi.jl @@ -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) @@ -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) @@ -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 }, @@ -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)")