Skip to content

Commit 9575b3c

Browse files
committed
Minor debugging improvements
- Make LocalProcess.bind_port an Int so it doesn't print in hex. - Use @error when launching workers so we can show the full backtrace if it fails.
1 parent 133ebb8 commit 9575b3c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/cluster.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ end
214214
mutable struct LocalProcess
215215
id::Int
216216
bind_addr::String
217-
bind_port::UInt16
217+
bind_port::Int
218218
cookie::String
219219
LocalProcess() = new(1)
220220
end
@@ -258,8 +258,8 @@ function start_worker(out::IO, cookie::AbstractString=readline(stdin); close_std
258258
interface = IPv4(LPROC.bind_addr)
259259
if LPROC.bind_port == 0
260260
port_hint = 9000 + (getpid() % 1000)
261-
(port, sock) = listenany(interface, UInt16(port_hint))
262-
LPROC.bind_port = port
261+
(port, sock) = listenany(interface, port_hint)
262+
LPROC.bind_port = Int(port)
263263
else
264264
sock = listen(interface, LPROC.bind_port)
265265
end
@@ -268,7 +268,7 @@ function start_worker(out::IO, cookie::AbstractString=readline(stdin); close_std
268268
process_messages(client, client, true)
269269
end)
270270
print(out, "julia_worker:") # print header
271-
print(out, "$(string(LPROC.bind_port))#") # print port
271+
print(out, "$(LPROC.bind_port)#") # print port
272272
print(out, LPROC.bind_addr)
273273
print(out, '\n')
274274
flush(out)
@@ -1339,7 +1339,7 @@ function init_bind_addr()
13391339

13401340
global LPROC
13411341
LPROC.bind_addr = bind_addr
1342-
LPROC.bind_port = UInt16(bind_port)
1342+
LPROC.bind_port = bind_port
13431343
end
13441344

13451345
using Random: randstring

src/managers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ function launch(manager::SSHManager, params::Dict, launched::Array, launch_ntfy:
186186
@async try
187187
launch_on_machine(manager, $machine, $cnt, params, launched, launch_ntfy)
188188
catch e
189-
print(stderr, "exception launching on machine $(machine) : $(e)\n")
189+
@error "Exception launching on machine $(machine)" exception=(e, catch_backtrace())
190190
end
191191
end
192192
end

0 commit comments

Comments
 (0)