@@ -11,8 +11,8 @@ err_invalid_packages(skip, env) = ArgumentError(
11
11
" \" $env \" . "
12
12
)
13
13
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 ..."
16
16
17
17
18
18
# # HELPERS
28
28
# develop MLJModelRegistryTools into the specifified `registry` project:
29
29
function setup (registry)
30
30
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" )
34
33
end
35
34
future = GenericRegistry. run ([], ex; environment= registry)
36
35
fetch (future)
@@ -66,9 +65,8 @@ function metadata(pkg; registry="", check_traits=true)
66
65
setup= ()
67
66
else
68
67
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" )
72
70
end
73
71
end
74
72
program = quote
@@ -194,18 +192,23 @@ function update(
194
192
issubset (skip, allpkgs) || throw (err_invalid_packages (skip, registry))
195
193
@suppress setup (registry)
196
194
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
+
200
198
@info " Processing up to $nworkers packages at a time. "
201
199
@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 ]
206
204
@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
+ ]
209
212
try
210
213
for (i, f) in enumerate (futures)
211
214
GenericRegistry. put (batch[i], fetch (f), registry_path ())
@@ -217,7 +220,6 @@ function update(
217
220
end
218
221
debug || GenericRegistry. close .(futures)
219
222
end
220
- N -= n
221
223
end
222
224
isempty (registry) || @suppress cleanup (registry)
223
225
gc ()
0 commit comments