Skip to content

Commit e9b9023

Browse files
Backports for Julia 1.11.x (#141)
* Merge pull request #137 from JuliaLang/dpa/dont-use-link-local Worker: Bind to the first non-link-local IPv4 address (cherry picked from commit 3679026) * Bump actions/cache from 1 to 4 (#98) Bumps [actions/cache](https://github.com/actions/cache) from 1 to 4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v1...v4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> (cherry picked from commit cde4078) * `release-julia-1.11`: Run CI on Julia 1.11.x (#142) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 6c7cdb5 commit e9b9023

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
version:
25-
- 'nightly'
25+
- '1.11' # This is the `release-julia-1.11` branch, so we run CI on Julia 1.11.x
2626
os:
2727
- ubuntu-latest
2828
- macOS-latest
@@ -39,7 +39,7 @@ jobs:
3939
with:
4040
version: ${{ matrix.version }}
4141
arch: ${{ matrix.arch }}
42-
- uses: actions/cache@v1
42+
- uses: actions/cache@v4
4343
env:
4444
cache-name: cache-artifacts
4545
with:
@@ -64,7 +64,7 @@ jobs:
6464
- uses: julia-actions/setup-julia@latest
6565
with:
6666
# version: '1.6'
67-
version: 'nightly'
67+
version: '1.11' # This is the `release-julia-1.11` branch, so we run CI on Julia 1.11.x
6868
- name: Generate docs
6969
run: |
7070
julia --color=yes -e 'write("Project.toml", replace(read("Project.toml", String), r"uuid = .*?\n" =>"uuid = \"47e2e46d-f89d-539d-b4ee-838fcccc9c8e\"\n"));'

src/cluster.jl

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,28 @@ function terminate_all_workers()
12621262
end
12631263
end
12641264

1265+
function choose_bind_addr()
1266+
# We prefer IPv4 over IPv6.
1267+
#
1268+
# We also prefer non-link-local over link-local.
1269+
# (This is because on HPC clusters, link-local addresses are usually not
1270+
# usable for communication between compute nodes.
1271+
#
1272+
# Therefore, our order of preference is:
1273+
# 1. Non-link-local IPv4
1274+
# 2. Non-link-local IPv6
1275+
# 3. Link-local IPv4
1276+
# 4. Link-local IPv6
1277+
addrs = getipaddrs()
1278+
i = something(
1279+
findfirst(ip -> !islinklocaladdr(ip) && ip isa IPv4, addrs), # first non-link-local IPv4
1280+
findfirst(ip -> !islinklocaladdr(ip) && ip isa IPv6, addrs), # first non-link-local IPv6
1281+
findfirst(ip -> ip isa IPv4, addrs), # first IPv4
1282+
findfirst(ip -> ip isa IPv6, addrs), # first IPv6
1283+
)
1284+
return addrs[i]
1285+
end
1286+
12651287
# initialize the local proc network address / port
12661288
function init_bind_addr()
12671289
opts = JLOptions()
@@ -1276,7 +1298,7 @@ function init_bind_addr()
12761298
else
12771299
bind_port = 0
12781300
try
1279-
bind_addr = string(getipaddr())
1301+
bind_addr = string(choose_bind_addr())
12801302
catch
12811303
# All networking is unavailable, initialize bind_addr to the loopback address
12821304
# Will cause an exception to be raised only when used.

0 commit comments

Comments
 (0)