JuliaParallel / ClusterManagers.jl

Other
242 stars 74 forks source link

improvement and bug fix for condor #184

Closed Moelf closed 1 year ago

Moelf commented 2 years ago

Bug fix:

Improvement:

This is possible because Julia stacks multiple -e command line options

This PR doesn't have impact on any other backend and is backward compatible for Condor

Moelf commented 2 years ago

as an example and for posterity:

julia> using ClusterManagers, Distributed

julia> addprocs(HTCManager(1); exeflags = `-e 'include("/home/jiling/.julia-htc/init.jl")'`)

content of init.jl:

using Sockets
import Sockets: getipaddr
function getipaddr(addr_type::Type{T}) where T<:IPAddr
    addrs = getipaddrs(addr_type)

    if length(addrs) == 0
        error("No networking interface available")
    end

    # Prefer the first IPv4 address, non private
    i = something(findfirst(ip -> ip isa IPv4 && !startswith(string(ip), "192.168")
                            , addrs), 1)
    return addrs[i]
end
Moelf commented 2 years ago

last time I think @tanmaykm looked at Condor related stuff

kescobo commented 1 year ago

I'm OK to merge this and add it to a release with #183