You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Revert changes which broke reuse of workers (#105)
* Revert "Remove useless `workers` variable (#103)"
This reverts commit 7f27702.
* Revert "Slightly improve inferred types in `runtests` (#100)"
This reverts commit 16f47d4.
* Add a test to ensure workers are reused correctly
Copy file name to clipboardExpand all lines: src/ParallelTestRunner.jl
+15-13Lines changed: 15 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -787,20 +787,21 @@ function runtests(mod::Module, args::ParsedArgs;
787
787
sort!(tests, by = x ->-get(historical_durations, x, Inf))
788
788
789
789
# determine parallelism
790
-
_jobs=something(args.jobs, default_njobs())
791
-
jobs::Int=clamp(_jobs, 1, length(tests))
790
+
jobs=something(args.jobs, default_njobs())
791
+
jobs =clamp(jobs, 1, length(tests))
792
792
println(stdout, "Running $jobs tests in parallel. If this is too many, specify the `--jobs=N` argument to the tests, or set the `JULIA_CPU_THREADS` environment variable.")
793
793
nworkers =min(jobs, length(tests))
794
+
workers =fill(nothing, nworkers)
794
795
795
796
t0 =time()
796
797
results = []
797
798
running_tests =Dict{String, Float64}() # test => start_time
798
799
test_lock =ReentrantLock() # to protect crucial access to tests and running_tests
799
800
800
-
done =Ref(false)
801
+
done =false
801
802
functionstop_work()
802
-
if!done[]
803
-
done[]=true
803
+
if!done
804
+
done =true
804
805
for task in worker_tasks
805
806
task ==current_task() &&continue
806
807
Base.istaskdone(task) &&continue
@@ -949,7 +950,7 @@ function runtests(mod::Module, args::ParsedArgs;
0 commit comments