Skip to content

Instantly share code, notes, and snippets.

@felipenoris
Last active January 25, 2022 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipenoris/32e066360bafcc944a87dd926233da9f to your computer and use it in GitHub Desktop.
Save felipenoris/32e066360bafcc944a87dd926233da9f to your computer and use it in GitHub Desktop.
using Distributed
function machines_vector(user::String, ips::Vector{String}, ports::Vector{I}) where {I<:Integer}
machines = Vector()
for ip in ips, port in ports
push!(machines, "$user@$ip 0.0.0.0:$port")
end
return machines
end
function launch_machines()
user = "centos"
ips = ["3.93.36.225", "18.234.97.122"] # IPs for two machine workers
ports = [34000]
pem_file = joinpath(homedir(), ".ssh", "my-ssh-key.pem")
@assert isfile(pem_file)
flags = `-i $pem_file`
addprocs(machines_vector(user, ips, ports), sshflags=flags, dir="/home/$user", exename="/home/$user/julia-1.1.0/bin/julia")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment