File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ This documents notable changes in DistributedNext.jl. The format is based on
1111
1212### Fixed
1313- Fixed a cause of potential hangs when exiting the process ([ #16 ] ).
14+ - Fixed cases like ` addprocs([("machine 10.1.1.1:9000", 2)]) ` where the bind
15+ port is specified. Previously this would cause errors when the workers all
16+ tried to bind to the same port, now all additional workers will treat the bind
17+ port as a port hint ([ #19 ] ).
1418
1519### Added
1620- A watcher mechanism has been added to detect when both the Distributed stdlib
Original file line number Diff line number Diff line change @@ -733,8 +733,31 @@ function launch_additional(np::Integer, cmd::Cmd)
733733 io_objs = Vector {Any} (undef, np)
734734 addresses = Vector {Any} (undef, np)
735735
736+ bind_idx = findfirst (== (" --bind-to" ), cmd)
737+ if ! isnothing (bind_idx)
738+ # The actual bind spec will be the next argument
739+ bind_idx += 1
740+ end
741+
736742 for i in 1 : np
737- io = open (detach (cmd), " r+" )
743+ worker_cmd = Cmd (cmd)
744+ if ! isnothing (bind_idx)
745+ bind_addr = worker_cmd[bind_idx]
746+ parts = split (bind_addr, ' :' )
747+ if length (parts) == 2
748+ port_str = parts[2 ]
749+
750+ # If the port is not specified as a port hint then we convert it
751+ # to a hint, otherwise the workers will try to bind to the same
752+ # port and error.
753+ if ! startswith (port_str, ' [' )
754+ new_bind_addr = " $(parts[1 ]) :[$(port_str) ]"
755+ worker_cmd. exec[bind_idx] = new_bind_addr
756+ end
757+ end
758+ end
759+
760+ io = open (detach (worker_cmd), " r+" )
738761 write_cookie (io)
739762 io_objs[i] = io. out
740763 end
Original file line number Diff line number Diff line change 6464 @test 8000 >= worker. config. port < 9000
6565 test_n_remove_pids (new_pids)
6666
67+ print (" \n ssh addprocs with multiple workers and port specified\n " )
68+ new_pids = addprocs_with_testenv ([(" localhost 127.0.0.1:8000" , 2 )]; sshflags= sshflags)
69+ @test length (new_pids) == 2
70+ test_n_remove_pids (new_pids)
71+
6772 print (" \n ssh addprocs with tunnel\n " )
6873 new_pids = addprocs_with_testenv ([(" localhost" , num_workers)]; tunnel= true , sshflags= sshflags)
6974 @test length (new_pids) == num_workers
You can’t perform that action at this time.
0 commit comments