Skip to content

Commit

Permalink
[python] Sets rolloing batch threads as daemon thread
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu committed Dec 9, 2023
1 parent 9cd5a7e commit b8f37da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ class RollingBatch implements Runnable {
private static final Logger logger = LoggerFactory.getLogger(RollingBatch.class);
private static final Logger SERVER_METRIC = LoggerFactory.getLogger("server_metric");

private static ExecutorService threadPool = Executors.newCachedThreadPool();
private static ExecutorService threadPool =
Executors.newCachedThreadPool(
r -> {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
});

private PyProcess process;
private int maxRollingBatchSize;
Expand Down
8 changes: 7 additions & 1 deletion wlm/src/main/java/ai/djl/serving/wlm/WorkLoadManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ public class WorkLoadManager {

/** Constructs a {@link WorkLoadManager} instance. */
public WorkLoadManager() {
threadPool = Executors.newCachedThreadPool();
threadPool =
Executors.newCachedThreadPool(
r -> {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
});
workerPools = new ConcurrentHashMap<>();
}

Expand Down

0 comments on commit b8f37da

Please sign in to comment.