Skip to content

Commit

Permalink
rename EngineManagement class to EngineInstall
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Sep 5, 2023
1 parent 72d337b commit aeb64b6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
* Class that manages the dl-modelrunner engines.
* This class checks that the required engines are installed and installs them if they are not.
* There is one required engine per DL framework. It can be either the latest one or the one specified
* in the variable {@link EngineManagement#ENGINES_VERSIONS}.
* in the variable {@link EngineInstall#ENGINES_VERSIONS}.
* This class also contains the methods to install engines on demand.
* @author Carlos Garcia Lopez de Haro, Ivan Estevez Albuja and Caterina Fuster Barcelo
*
*/
public class EngineManagement {
public class EngineInstall {
/**
* Directory where the engines shold be installed
*/
Expand Down Expand Up @@ -161,11 +161,11 @@ public class EngineManagement {
* Regard, that for certain engines, downloading all the OS depending engines
* is necessary, as the dependencies vary from one system to another.
*/
private EngineManagement() {
private EngineInstall() {
}

/**
* Creates an {@link EngineManagement} object to check if the required engines are installed.
* Creates an {@link EngineInstall} object to check if the required engines are installed.
*
* In order to reduce repetition and to reduce the number of deps downloaded
* by the user when deepImageJ is installed, a selection of engines is created.
Expand All @@ -189,14 +189,14 @@ private EngineManagement() {
* is necessary, as the dependencies vary from one system to another.
* @return a manager to handle the installation of basic engines
*/
public static EngineManagement createManager() {
EngineManagement manager = new EngineManagement();
public static EngineInstall createInstaller() {
EngineInstall manager = new EngineInstall();
manager.managersDir = ENGINES_DIR;
return manager;
}

/**
* Creates an {@link EngineManagement} object to check if the required engines are installed.
* Creates an {@link EngineInstall} object to check if the required engines are installed.
*
* In order to reduce repetition and to reduce the number of deps downloaded
* by the user when deepImageJ is installed, a selection of engines is created.
Expand Down Expand Up @@ -224,8 +224,8 @@ public static EngineManagement createManager() {
*
* @return a manager to handle the installation of basic engines
*/
public static EngineManagement createManager(String dir) {
EngineManagement manager = new EngineManagement();
public static EngineInstall createInstaller(String dir) {
EngineInstall manager = new EngineInstall();
manager.managersDir = dir;
return manager;
}
Expand Down Expand Up @@ -291,6 +291,7 @@ private void checkAndSetBasicEngineInstallation() {
* is necessary, as the dependencies vary from one system to another.
*/
public void checkBasicEngineInstallation() {
everythingInstalled = false;
isManagementFinished = false;
readEnginesJSON();
checkEnginesInstalled();
Expand Down Expand Up @@ -1250,10 +1251,10 @@ public static boolean installEngineWithArgsInDir(String framework, String versi
}

/**
* Check whether the management of the engines is finished or not
* Check whether the installation of the engines is finished or not
* @return true if it is finished or false otherwise
*/
public boolean isManagementDone() {
public boolean isInstallationFinished() {
return isManagementFinished;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import io.bioimage.modelrunner.bioimageio.download.DownloadTracker;
import io.bioimage.modelrunner.bioimageio.download.DownloadTracker.TwoParameterConsumer;
import io.bioimage.modelrunner.engine.installation.EngineManagement;
import io.bioimage.modelrunner.engine.installation.EngineInstall;
import io.bioimage.modelrunner.versionmanagement.AvailableEngines;
import io.bioimage.modelrunner.versionmanagement.DeepLearningVersion;

Expand All @@ -43,14 +43,14 @@ public class ExampleDownloadEngine {
* again for a model, but providing either the name, the 'rdf_source' field
* of the rdf.yaml file or a {@link ModelDescriptor} object generated from an rdf.yaml file.
*
* For more details, explore the methods: {@link EngineManagement#installEnginesForModelByNameinDir(String, String)},
* {@link EngineManagement#installEnginesForModelInDir(io.bioimage.modelrunner.bioimageio.description.ModelDescriptor, String)},
* {@link EngineManagement#installEnginesForModelByNameinDir(String, String, TwoParameterConsumer)},
* For more details, explore the methods: {@link EngineInstall#installEnginesForModelByNameinDir(String, String)},
* {@link EngineInstall#installEnginesForModelInDir(io.bioimage.modelrunner.bioimageio.description.ModelDescriptor, String)},
* {@link EngineInstall#installEnginesForModelByNameinDir(String, String, TwoParameterConsumer)},
* or to install the engine without associating it to a model:
* {@link EngineManagement#installEngineWithArgs(String, String, boolean, boolean)},
* {@link EngineManagement#installEngine(DeepLearningVersion)},
* {@link EngineManagement#installEngineByCompleteName(String)},
* {@link EngineManagement#installEngineForWeightsInDir(io.bioimage.modelrunner.bioimageio.description.weights.WeightFormat, String)}
* {@link EngineInstall#installEngineWithArgs(String, String, boolean, boolean)},
* {@link EngineInstall#installEngine(DeepLearningVersion)},
* {@link EngineInstall#installEngineByCompleteName(String)},
* {@link EngineInstall#installEngineForWeightsInDir(io.bioimage.modelrunner.bioimageio.description.weights.WeightFormat, String)}
*/
private static final String MODEL_ID = "10.5281/zenodo.5874741";
/**
Expand Down Expand Up @@ -83,7 +83,7 @@ public static void main(String[] args) throws IOException, InterruptedException
// defined by the model ID.
// This method prints information about the total progress of the download and of the
// particular files being downloaded on the terminal.
EngineManagement.installEnginesForModelByIDInDir(MODEL_ID, ENGINES_DIR, consumer);
EngineInstall.installEnginesForModelByIDInDir(MODEL_ID, ENGINES_DIR, consumer);
// Another option is to launch the download in a separate thread
// and wait for it to end while tracking the progress using the consumer
Thread downloadThread = new Thread(() -> {
Expand All @@ -97,7 +97,7 @@ public static void main(String[] args) throws IOException, InterruptedException
AvailableEngines.getEnginesForOsByParams(engine, version, cpu, gpu);
if (dlv.size() == 0)
throw new IOException("Engine defined is not supported by JDLL.");
EngineManagement.installEngineInDir(dlv.get(0), ENGINES_DIR, consumer);
EngineInstall.installEngineInDir(dlv.get(0), ENGINES_DIR, consumer);
} catch (IOException | InterruptedException e) {
// If one of the files to be downloaded is corrupted or the download thread
// is stopped abruptly
Expand Down

0 comments on commit aeb64b6

Please sign in to comment.