Skip to content

Commit 129d1c5

Browse files
authored
test: ensure consistent Julia environments in live job tests (#47)
1 parent 28e105c commit 129d1c5

File tree

7 files changed

+132
-52
lines changed

7 files changed

+132
-52
lines changed

test/jobenvs/job-dist/Manifest.toml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
julia_version = "1.9.4"
4+
manifest_format = "2.0"
5+
project_hash = "15b8400de0ed6d0aa5f96c6341a036f45951aee0"
6+
7+
[[deps.Dates]]
8+
deps = ["Printf"]
9+
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
10+
11+
[[deps.Distributed]]
12+
deps = ["Random", "Serialization", "Sockets"]
13+
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
14+
15+
[[deps.JSON]]
16+
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
17+
git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a"
18+
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
19+
version = "0.21.4"
20+
21+
[[deps.Mmap]]
22+
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
23+
24+
[[deps.Parsers]]
25+
deps = ["Dates", "PrecompileTools", "UUIDs"]
26+
git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821"
27+
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
28+
version = "2.8.1"
29+
30+
[[deps.PrecompileTools]]
31+
deps = ["Preferences"]
32+
git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f"
33+
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
34+
version = "1.2.0"
35+
36+
[[deps.Preferences]]
37+
deps = ["TOML"]
38+
git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e"
39+
uuid = "21216c6a-2e73-6563-6e65-726566657250"
40+
version = "1.4.1"
41+
42+
[[deps.Printf]]
43+
deps = ["Unicode"]
44+
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
45+
46+
[[deps.Random]]
47+
deps = ["SHA", "Serialization"]
48+
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
49+
50+
[[deps.SHA]]
51+
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
52+
version = "0.7.0"
53+
54+
[[deps.Serialization]]
55+
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
56+
57+
[[deps.Sockets]]
58+
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
59+
60+
[[deps.TOML]]
61+
deps = ["Dates"]
62+
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
63+
version = "1.0.3"
64+
65+
[[deps.UUIDs]]
66+
deps = ["Random", "SHA"]
67+
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
68+
69+
[[deps.Unicode]]
70+
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

test/jobenvs/job-dist/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[deps]
2+
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
3+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"

test/jobenvs/job-dist/script.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Distributed, JSON
2+
@everywhere using Distributed
3+
@everywhere fn() = (myid(), strip(read(`hostname`, String)))
4+
fs = [i => remotecall(fn, i) for i in workers()]
5+
vs = map(fs) do (i, future)
6+
myid, hostname = fetch(future)
7+
@info "$i: $myid, $hostname"
8+
(; myid, hostname)
9+
end
10+
ENV["RESULTS"] = JSON.json((; vs))

test/jobenvs/job1/Manifest.toml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is machine-generated - editing it directly is not advised
22

3-
julia_version = "1.8.5"
3+
julia_version = "1.9.4"
44
manifest_format = "2.0"
55
project_hash = "19ff69f495991858cf34afc4927fe003524460ea"
66

@@ -23,9 +23,9 @@ uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
2323

2424
[[deps.JSON]]
2525
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
26-
git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e"
26+
git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a"
2727
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
28-
version = "0.21.3"
28+
version = "0.21.4"
2929

3030
[[deps.Markdown]]
3131
deps = ["Base64"]
@@ -35,36 +35,51 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
3535
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
3636

3737
[[deps.OrderedCollections]]
38-
git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"
38+
git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5"
3939
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
40-
version = "1.4.1"
40+
version = "1.6.3"
4141

4242
[[deps.Parsers]]
43-
deps = ["Dates", "SnoopPrecompile"]
44-
git-tree-sha1 = "478ac6c952fddd4399e71d4779797c538d0ff2bf"
43+
deps = ["Dates", "PrecompileTools", "UUIDs"]
44+
git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821"
4545
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
46-
version = "2.5.8"
46+
version = "2.8.1"
47+
48+
[[deps.PrecompileTools]]
49+
deps = ["Preferences"]
50+
git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f"
51+
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
52+
version = "1.2.0"
4753

4854
[[deps.Preferences]]
4955
deps = ["TOML"]
50-
git-tree-sha1 = "47e5f437cc0e7ef2ce8406ce1e7e24d44915f88d"
56+
git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e"
5157
uuid = "21216c6a-2e73-6563-6e65-726566657250"
52-
version = "1.3.0"
58+
version = "1.4.1"
5359

5460
[[deps.Printf]]
5561
deps = ["Unicode"]
5662
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
5763

58-
[[deps.SnoopPrecompile]]
59-
deps = ["Preferences"]
60-
git-tree-sha1 = "e760a70afdcd461cf01a575947738d359234665c"
61-
uuid = "66db9d55-30c0-4569-8b51-7e840670fc0c"
62-
version = "1.0.3"
64+
[[deps.Random]]
65+
deps = ["SHA", "Serialization"]
66+
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
67+
68+
[[deps.SHA]]
69+
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
70+
version = "0.7.0"
71+
72+
[[deps.Serialization]]
73+
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
6374

6475
[[deps.TOML]]
6576
deps = ["Dates"]
6677
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
67-
version = "1.0.0"
78+
version = "1.0.3"
79+
80+
[[deps.UUIDs]]
81+
deps = ["Random", "SHA"]
82+
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
6883

6984
[[deps.Unicode]]
7085
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

test/jobenvs/job1/Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
33
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
44

55
[compat]
6-
DataStructures = "0.17"
6+
# Note: this should be resolved to exactly 0.17.0 in Manifest.toml
7+
# for the tests to pass.
8+
DataStructures = "0.17.0"
79
JSON = "0.21"

test/jobs-live.jl

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ end
116116

117117
@testset "[LIVE] JuliaHub.submit_job / simple" begin
118118
job, _ = submit_test_job(
119-
JuliaHub.script"@info 1+1; sleep(200)";
119+
JuliaHub.script"@info 1+1; sleep(200)"noenv;
120120
ncpu=2, memory=8,
121121
auth, alias="script-simple"
122122
)
@@ -186,7 +186,7 @@ end
186186
JuliaHub.script"""
187187
ENV["RESULTS"] = "{\\"x\\":42}"
188188
error("fail")
189-
""";
189+
"""noenv;
190190
auth, alias="script-fail", timelimit=JuliaHub.Unlimited(),
191191
)
192192
@test job._json["limit_type"] == "unlimited"
@@ -203,18 +203,7 @@ end
203203

204204
@testset "[LIVE] JuliaHub.submit_job / distributed" begin
205205
job, _ = submit_test_job(
206-
JuliaHub.script"""
207-
using Distributed, JSON
208-
@everywhere using Distributed
209-
@everywhere fn() = (myid(), strip(read(`hostname`, String)))
210-
fs = [i => remotecall(fn, i) for i in workers()]
211-
vs = map(fs) do (i, future)
212-
myid, hostname = fetch(future)
213-
@info "$i: $myid, $hostname"
214-
(; myid, hostname)
215-
end
216-
ENV["RESULTS"] = JSON.json((; vs))
217-
""";
206+
JuliaHub.appbundle(joinpath(@__DIR__, "jobenvs", "job-dist"), "script.jl");
218207
nnodes=3,
219208
auth, alias="distributed",
220209
)
@@ -231,18 +220,7 @@ end
231220

232221
@testset "[LIVE] JuliaHub.submit_job / distributed-per-core" begin
233222
job, full_alias = submit_test_job(
234-
JuliaHub.script"""
235-
using Distributed, JSON
236-
@everywhere using Distributed
237-
@everywhere fn() = (myid(), strip(read(`hostname`, String)))
238-
fs = [i => remotecall(fn, i) for i in workers()]
239-
vs = map(fs) do (i, future)
240-
myid, hostname = fetch(future)
241-
@info "$i: $myid, $hostname"
242-
(; myid, hostname)
243-
end
244-
ENV["RESULTS"] = JSON.json((; vs))
245-
""";
223+
JuliaHub.appbundle(joinpath(@__DIR__, "jobenvs", "job-dist"), "script.jl");
246224
ncpu=2, nnodes=3, process_per_node=false,
247225
env=Dict("FOO" => "bar"),
248226
auth, alias="distributed-percore",
@@ -315,6 +293,11 @@ end
315293
)
316294
job = JuliaHub.wait_job(job)
317295
@test job.status == "Completed"
296+
# Check input and output files
297+
@test length(JuliaHub.job_files(job, :input)) >= 2
298+
@test JuliaHub.job_file(job, :input, "code.jl") isa JuliaHub.JobFile
299+
@test JuliaHub.job_file(job, :input, "appbundle.tar") isa JuliaHub.JobFile
300+
# Test the results values
318301
@test !isempty(job.results)
319302
let results = JSON.parse(job.results)
320303
@test results isa AbstractDict
@@ -332,21 +315,18 @@ end
332315
ENV["RESULTS_FILE"] = joinpath(@__DIR__, "output.txt")
333316
n = write(ENV["RESULTS_FILE"], "output-txt-content")
334317
@info "Wrote $(n) bytes"
335-
"""; alias="output-file",
318+
"""noenv; alias="output-file",
336319
)
337320
job = JuliaHub.wait_job(job)
338321
@test job.status == "Completed"
339322
# Project.toml, Manifest.toml, code.jl
340-
@test length(JuliaHub.job_files(job, :input)) >= 3
341-
@test JuliaHub.job_file(job, :input, "Project.toml") isa JuliaHub.JobFile
342-
@test JuliaHub.job_file(job, :input, "Manifest.toml") isa JuliaHub.JobFile
323+
@test length(JuliaHub.job_files(job, :input)) >= 1
343324
@test JuliaHub.job_file(job, :input, "code.jl") isa JuliaHub.JobFile
344325
# code.jl
345326
@test length(JuliaHub.job_files(job, :source)) >= 1
346327
@test JuliaHub.job_file(job, :source, "code.jl") isa JuliaHub.JobFile
347328
# Project.toml, Manifest.toml
348-
@test length(JuliaHub.job_files(job, :project)) >= 2
349-
@test JuliaHub.job_file(job, :project, "Project.toml") isa JuliaHub.JobFile
329+
@test length(JuliaHub.job_files(job, :project)) >= 1
350330
@test JuliaHub.job_file(job, :project, "Manifest.toml") isa JuliaHub.JobFile
351331
# output.txt
352332
@test length(JuliaHub.job_files(job, :result)) == 1
@@ -365,11 +345,11 @@ end
365345
write(joinpath(odir, "bar.txt"), "output-txt-content-2")
366346
@info "Wrote: odir"
367347
ENV["RESULTS_FILE"] = odir
368-
"""; alias="output-file-tarball",
348+
"""noenv; alias="output-file-tarball",
369349
)
370350
job = JuliaHub.wait_job(job)
371351
@test job.status == "Completed"
372-
@test length(JuliaHub.job_files(job, :project)) >= 2
352+
@test length(JuliaHub.job_files(job, :project)) >= 1
373353
result_tarball = only(JuliaHub.job_files(job, :result))
374354
buf = IOBuffer()
375355
JuliaHub.download_job_file(result_tarball, buf)

test/jobs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ end
9696
@test isfile(bundle.environment.tarball_path)
9797
@test bundle.code == "test()"
9898
@test bundle.sysimage === true
99-
@test JuliaHub._sysimage_manifest_sha(bundle.environment) == "e066dbebe85bb0a0ed79356a81ddc2223974f784cea3f512cea615a2d5731b0e"
99+
@test JuliaHub._sysimage_manifest_sha(bundle.environment) == "631fc619c1d04e525872df2779fa95a0dc47edd9558af629af88c493daa6300d"
100100

101101
mktempdir() do path
102102
bigfile_path = joinpath(path, "bigfile")

0 commit comments

Comments
 (0)