Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve permanent pending status #11

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies {
implementation "ai.djl:api:$djlVersion"

testImplementation libs.junit
testRuntimeOnly libs.junit.engine
// testRuntimeOnly libs.junit.engine

}

Expand Down Expand Up @@ -148,4 +148,4 @@ publishing {
}
}
}
}
}
10 changes: 4 additions & 6 deletions src/main/java/qupath/ext/djl/DjlTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ public static Engine getEngine(String name, boolean downloadIfNeeded) throws Ill
if (!hasEngine(name)) {
throw new IllegalArgumentException("Requested engine " + name + " is not available!");
}

synchronized (lock) {
var offlineStatus = System.getProperty("offline");
try {
Expand All @@ -264,20 +263,19 @@ public static Engine getEngine(String name, boolean downloadIfNeeded) throws Ill
logger.error("Unable to reset JavaCPP platform properties: " + e.getLocalizedMessage(), e);
}
}

var engine = Engine.getEngine(name);
if (engine != null)
loadedEngines.add(name);
return engine;
} catch (Exception e) {
} catch (Throwable t) {
if (downloadIfNeeded)
logger.error("Unable to get engine " + name + ": " + e.getLocalizedMessage(), e);
logger.error("Unable to get engine " + name + ": " + t.getLocalizedMessage(), t);
else {
var msg = e.getLocalizedMessage();
var msg = t.getLocalizedMessage();
if (msg == null)
logger.warn("Unable to get engine {}", name);
else
logger.warn("Unable to get engine {} ({})", name, e.getLocalizedMessage());
logger.warn("Unable to get engine {} ({})", name, msg);
}
return null;
} finally {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/qupath/ext/djl/ui/DjlEngineCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ private void init() {
stage.setTitle(TITLE);
stage.initOwner(QuPathGUI.getInstance().getStage());
stage.initModality(Modality.APPLICATION_MODAL);
stage.setMinWidth(500);
stage.setMinHeight(375);
stage.setScene(new Scene(pane));
}

Expand Down Expand Up @@ -329,7 +331,6 @@ private static String getCudaString() {
}
}


private void checkEngineStatus(String name, ObjectProperty<EngineStatus> status, long timeoutMillis, boolean doQuietly) {
// Request the engine in a background thread, triggering download if necessary
var pool = Executors.newSingleThreadExecutor(ThreadTools.createThreadFactory("djl-engine-request", true));
Expand Down