@@ -11,8 +11,8 @@ err_invalid_packages(skip, env) = ArgumentError(
1111 " \" $env \" . "
1212)
1313
14- const INFO_BE_PATIENT1 = " Be patient. This could take a minute or so... "
15- const INFO_BE_PATIENT10 = " Be patient. This could take ten minutes or so..."
14+ const INFO_BE_PATIENT1 = " Be patient. This could take a minute or so ... "
15+ const INFO_BE_PATIENT10 = " Be patient. This could take ten minutes or so ..."
1616
1717
1818# # HELPERS
2828# develop MLJModelRegistryTools into the specifified `registry` project:
2929function setup (registry)
3030 ex = quote
31- # TODO : replace Line 1 with Line 2 after MLJModelRegistry is registered at General:
32- Pkg. develop (path= $ ROOT) # Line 1
33- # Pkg.add(MLJModelRegistryTools) # Line 2
31+ # Pkg.develop(path=$ROOT)
32+ Pkg. add (" MLJModelRegistryTools" )
3433 end
3534 future = GenericRegistry. run ([], ex; environment= registry)
3635 fetch (future)
@@ -66,9 +65,8 @@ function metadata(pkg; registry="", check_traits=true)
6665 setup= ()
6766 else
6867 setup = quote
69- # REMOVE THIS NEXT LINE AFTER TAGGING NEW MLJMODELINTERFACE
70- Pkg. develop (path= " /Users/anthony/MLJ/MLJModelInterface/" )
71- Pkg. develop (path= $ ROOT) # MLJModelRegistryTools
68+ # Pkg.develop(path=$ROOT)
69+ Pkg. add (" MLJModelRegistryTools" )
7270 end
7371 end
7472 program = quote
@@ -194,18 +192,23 @@ function update(
194192 issubset (skip, allpkgs) || throw (err_invalid_packages (skip, registry))
195193 @suppress setup (registry)
196194 end
197- pkgs = setdiff (allpkgs, skip)
198- N = length (pkgs)
199- pos = 1
195+ pkgs = setdiff (allpkgs, skip) |> sort
196+ pkg_set = OrderedSet (pkgs)
197+
200198 @info " Processing up to $nworkers packages at a time. "
201199 @info INFO_BE_PATIENT10
202- while N ≥ 1
203- print (" \r Packages remaining: $N " )
204- n = min (nworkers, N )
205- batch = pkgs[pos : pos + n - 1 ]
200+ while ! isempty (pkg_set)
201+ print (" \r Packages remaining: $( length (pkgs)) " )
202+ n = min (nworkers, length (pkg_set) )
203+ batch = [ pop! (pkg_set) for _ in 1 : n ]
206204 @suppress begin
207- futures =
208- [MLJModelRegistryTools. metadata (pkg; registry, check_traits) for pkg in batch]
205+ futures = [
206+ MLJModelRegistryTools. metadata (
207+ pkg;
208+ registry,
209+ check_traits,
210+ ) for pkg in batch
211+ ]
209212 try
210213 for (i, f) in enumerate (futures)
211214 GenericRegistry. put (batch[i], fetch (f), registry_path ())
@@ -217,7 +220,6 @@ function update(
217220 end
218221 debug || GenericRegistry. close .(futures)
219222 end
220- N -= n
221223 end
222224 isempty (registry) || @suppress cleanup (registry)
223225 gc ()
0 commit comments