Repository: JuliaAI/MLJBase.jl (julia)

Issue:
Remove initialisation of remote channels.
In MLJBase the `__init__` function initialises a remote channel called MACHINE_CHANNEL, which is only used for (important) testing purposes. However, this is an obstacle for certain kinds of scaling; see [this discourse thread](https://discourse.julialang.org/t/mlj-and-clustermanagers/51540).

Pull request description:
Resolves #496

Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cdd39517..85c43219 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,6 +9,8 @@ on:
       - master
       - dev
     tags: '*'
+env:
+  TEST_MLJBASE: "true"
 jobs:
   test:
     name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -41,6 +43,8 @@ jobs:
             ${{ runner.os }}-
       - uses: julia-actions/julia-buildpkg@v1
       - uses: julia-actions/julia-runtest@v1
+        env:
+          JULIA_NUM_THREADS: 2
       - uses: julia-actions/julia-processcoverage@v1
       - uses: codecov/codecov-action@v1
         with:
diff --git a/src/init.jl b/src/init.jl
index 9078a927..e1ae287c 100644
--- a/src/init.jl
+++ b/src/init.jl
@@ -1,9 +1,12 @@
 function __init__()
     global DEFAULT_RESOURCE = Ref{AbstractResource}(CPU1())
 
-    # for testing asynchronous training of learing networks:
-    global MACHINE_CHANNEL =
-        RemoteChannel(() -> Channel(100), myid())
+    # for testing asynchronous training of learning networks:
+    global TESTING = parse(Bool, get(ENV, "TEST_MLJBASE", "false"))
+    if TESTING
+        global MACHINE_CHANNEL =
+            RemoteChannel(() -> Channel(100), myid())
+    end
 
     TRAIT_FUNCTION_GIVEN_NAME[:measure]      = is_measure
     TRAIT_FUNCTION_GIVEN_NAME[:measure_type] = is_measure_type


Test patch:
diff --git a/test/runtests.jl b/test/runtests.jl
index 4e0e57f7..ad3aa3a2 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -1,6 +1,13 @@
 using Distributed
 addprocs()
 
+using MLJBase
+if !MLJBase.TESTING
+    error("To test MLJBase, the environment variable "*
+          "`TEST_MLJBASE` must be set to `\"true\"`\n"*
+          "You can do this in the REPL with `ENV[TEST_MLJBASE]=\"true\"")
+end
+
 @info "nprocs() = $(nprocs())"
 @static if VERSION >= v"1.3.0-DEV.573"
     import .Threads