Skip to content

Commit 091a98b

Browse files
committed
Add runningSlots tracking to Host and display available slots in GUI
- Add runningSlots field to Host protobuf and HostEntity - Update Whiteboard DAO queries to include runningSlots - Show available slots (concurrentSlotsLimit - runningSlots) in CueGUI host monitor tree
1 parent 38bdeda commit 091a98b

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

cuebot/src/main/java/com/imageworks/spcue/HostEntity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public HostEntity(Host grpcHost) {
6464
this.gpuMemory = grpcHost.getGpuMemory();
6565
this.idleGpuMemory = grpcHost.getIdleGpuMemory();
6666
this.concurrentSlotsLimit = grpcHost.getConcurrentSlotsLimit();
67+
this.runningSlots = grpcHost.getRunningSlots();
6768
}
6869

6970
public String getHostId() {

cuebot/src/main/java/com/imageworks/spcue/dao/postgres/NestedWhiteboardDaoJdbc.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ private static final NestedJob mapResultSetToJob(ResultSet rs) throws SQLExcepti
283283
+ "host.int_gpus, " + "host.int_gpus_idle, " + "host.int_gpu_mem, "
284284
+ "host.int_gpu_mem_idle, " + "host.int_mem, " + "host.int_mem_idle, "
285285
+ "host.str_lock_state, " + "host.str_tags, " + "host.b_comment, "
286-
+ "host.int_thread_mode, " + "host_stat.str_os, " + "host_stat.int_mem_total, "
286+
+ "host.int_thread_mode, " + "host_stat.int_running_slots, " + "host_stat.str_os, "
287+
+ "host_stat.int_mem_total, "
287288
+ "host_stat.int_mem_free, " + "host_stat.int_swap_total, "
288289
+ "host_stat.int_swap_free, " + "host_stat.int_mcp_total, " + "host_stat.int_mcp_free, "
289290
+ "host_stat.int_gpu_mem_total, " + "host_stat.int_gpu_mem_free, "

cuebot/src/main/java/com/imageworks/spcue/dao/postgres/WhiteboardDaoJdbc.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ public static NestedHost.Builder mapNestedHostBuilder(ResultSet rs) throws SQLEx
962962
.setHasComment(rs.getBoolean("b_comment"))
963963
.setThreadMode(ThreadMode.values()[rs.getInt("int_thread_mode")])
964964
.setConcurrentSlotsLimit(rs.getInt("int_concurrent_slots_limit"))
965+
.setRunningSlots(rs.getInt("int_running_slots"))
965966
.setOs(SqlUtil.getString(rs, "str_os"));
966967

967968
String tags = SqlUtil.getString(rs, "str_tags");
@@ -1000,6 +1001,7 @@ public static Host.Builder mapHostBuilder(ResultSet rs) throws SQLException {
10001001
builder.setHasComment(rs.getBoolean("b_comment"));
10011002
builder.setThreadMode(ThreadMode.values()[rs.getInt("int_thread_mode")]);
10021003
builder.setConcurrentSlotsLimit(rs.getInt("int_concurrent_slots_limit"));
1004+
builder.setRunningSlots(rs.getInt("int_running_slots"));
10031005
builder.setOs(SqlUtil.getString(rs, "str_os"));
10041006

10051007
String tags = SqlUtil.getString(rs, "str_tags");
@@ -1723,7 +1725,8 @@ public Show mapRow(ResultSet rs, int rowNum) throws SQLException {
17231725
+ "host_stat.int_mem_total," + "host_stat.int_mem_free," + "host_stat.int_swap_total,"
17241726
+ "host_stat.int_swap_free," + "host_stat.int_mcp_total," + "host_stat.int_mcp_free,"
17251727
+ "host_stat.int_gpu_mem_total," + "host_stat.int_gpu_mem_free,"
1726-
+ "host_stat.int_load, " + "alloc.str_name AS alloc_name " + "FROM " + "alloc,"
1728+
+ "host_stat.int_load, " + "host_stat.int_running_slots, "
1729+
+ "alloc.str_name AS alloc_name " + "FROM " + "alloc,"
17271730
+ "facility, " + "host_stat," + "host " + "WHERE " + "host.pk_alloc = alloc.pk_alloc "
17281731
+ "AND " + "facility.pk_facility = alloc.pk_facility " + "AND "
17291732
+ "host.pk_host = host_stat.pk_host ";

cuegui/cuegui/HostMonitorTree.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ def __init__(self, parent):
168168
"The host can only run this amount of slots at the same time "
169169
"(Usually: 1 frame = 1 slot)\n\n"
170170
"This host will only run layers with a slots_required field configured.")
171+
self.addColumn("Available Slots", 50, id=24,
172+
data=lambda host: (
173+
host.data.concurrent_slots_limit - host.data.running_slots
174+
) if host.data.concurrent_slots_limit >= 0 else "-",
175+
tip="The number of slots still available on the host.\n"
176+
"Computed as Concurrent Slots minus currently running slots.")
171177

172178
self.hostSearch = opencue.search.HostSearch()
173179

proto/src/host.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ message Host {
282282
// 0: slot-based booking is disabled (default behavior using cores/memory/gpu)
283283
// >0: slot-based booking is enabled with specified limit (only layers with slots_required > 0)
284284
int32 concurrent_slots_limit = 30;
285+
int32 running_slots = 31;
285286
}
286287

287288
message HostSearchCriteria {
@@ -330,6 +331,7 @@ message NestedHost {
330331
float gpus = 29;
331332
float idle_gpus = 30;
332333
int32 concurrent_slots_limit = 31;
334+
int32 running_slots = 32;
333335
}
334336

335337
message NestedHostSeq {

0 commit comments

Comments
 (0)