Skip to content

Commit

Permalink
imporve the tracking to aoid race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 15, 2024
1 parent 420ed8b commit f65f65d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ private DownloadTracker(String folder, TwoParameterConsumer<String, Double> cons
this.consumer = consumer;
this.remainingFiles = sizeFiles.keySet().stream().map(i -> new File(i)).collect(Collectors.toList());
this.downloadThread = thread;
this.consumer.accept(TOTAL_PROGRESS_KEY, 0.0);
}


Expand Down Expand Up @@ -526,6 +527,8 @@ public static void printProgress(Thread downloadThread,
continue;
}
for (String kk : new String[] {select, DownloadTracker.TOTAL_PROGRESS_KEY}) {
if (kk.endsWith(EngineInstall.NBYTES_SUFFIX))
continue;
int nProgressBar = (int) (consumer.get().get(kk) * n);
String progressStr = new File(kk).getName() + ": ["
+ ogProgressStr.substring(0, nProgressBar) + ogRemainingStr.substring(nProgressBar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ public class DeepLearningVersion
* and implies that the user has manipulated wrongly the engines
*/
public static DeepLearningVersion fromFile(File engineDir) throws IOException, IllegalStateException {
if (!engineDir.isDirectory())
throw new IOException("The file '" + engineDir.getAbsolutePath() + "' does not correspond "
+ "to an existing directory.");
DeepLearningVersion dlVersion = new DeepLearningVersion();
dlVersion.engineName = engineDir.getName();
dlVersion.allEnginesDir = engineDir.getParentFile().getAbsolutePath();
Expand Down

0 comments on commit f65f65d

Please sign in to comment.