Skip to content

Commit af79440

Browse files
authored
Merge branch 'master' into fix/cuebot/hardware_tags_update
2 parents 90b3e68 + 55e4c98 commit af79440

File tree

36 files changed

+383
-205
lines changed

36 files changed

+383
-205
lines changed

VERSION.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.15
1+
1.16

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class FrameDetail extends FrameEntity implements FrameInterface {
2727
public int retryCount;
2828
public int exitStatus;
2929
public long maxRss;
30+
public long maxPss;
3031
public int dispatchOrder;
3132
public String lastResource;
3233

cuebot/src/main/java/com/imageworks/spcue/dao/FrameDao.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,13 @@ public interface FrameDao {
326326
* @param f
327327
* @param maxRss
328328
* @param rss
329+
* @param maxPss
330+
* @param pss
329331
* @param lluTime
330332
* @throws FrameReservationException if the frame is locked by another thread.
331333
*/
332-
void updateFrameMemoryUsageAndLluTime(FrameInterface f, long maxRss, long rss, long lluTime);
334+
void updateFrameMemoryUsageAndLluTime(FrameInterface f, long maxRss, long rss, long maxPss,
335+
long pss, long lluTime);
333336

334337
/**
335338
* Attempt to put a exclusive row lock on the given frame. The frame must be in the specified

cuebot/src/main/java/com/imageworks/spcue/dao/JobDao.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,15 @@ public interface JobDao {
365365
*/
366366
void updateMaxRSS(JobInterface job, long maxRss);
367367

368+
/**
369+
* Update jobs max PSS. Only updates if the passed in value is greater than the current value of
370+
* int_max_pss
371+
*
372+
* @param job
373+
* @param maxPss
374+
*/
375+
void updateMaxPSS(JobInterface job, long maxPss);
376+
368377
/**
369378
* Inserts a key/value pair into the jobs env table
370379
*

cuebot/src/main/java/com/imageworks/spcue/dao/LayerDao.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ public interface LayerDao {
195195
*/
196196
void updateLayerMaxRSS(LayerInterface layer, long val, boolean force);
197197

198+
/**
199+
* Updates the layer's maximum PSS value. If force is true, the max RSS is updated no matter
200+
* what the current value is. If force is false, the value is only updated the val is greater
201+
* than than the existing value.
202+
*
203+
* @param layer
204+
* @param val
205+
*/
206+
void updateLayerMaxPSS(LayerInterface layer, long val, boolean force);
207+
198208
/**
199209
* Increases the value of the minimum memory when the supplied value is larger than the current
200210
* value

cuebot/src/main/java/com/imageworks/spcue/dao/ProcDao.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ public interface ProcDao {
133133
* @param usedKb
134134
* @param maxKb
135135
*/
136-
void updateProcMemoryUsage(FrameInterface f, long rss, long maxRss, long vsize, long maxVsize,
137-
long usedGpuMemory, long maxUsedGpuMemory, long usedSwapMemory, byte[] children);
136+
void updateProcMemoryUsage(FrameInterface f, long rss, long maxRss, long pss, long maxPss,
137+
long vsize, long maxVsize, long usedGpuMemory, long maxUsedGpuMemory,
138+
long usedSwapMemory, byte[] children);
138139

139140
/**
140141
* get aq virual proc from its unique id

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ public FrameDetail mapRow(ResultSet rs, int rowNum) throws SQLException {
293293
frame.layerId = rs.getString("pk_layer");
294294
frame.showId = rs.getString("pk_show");
295295
frame.maxRss = rs.getLong("int_mem_max_used");
296+
frame.maxPss = rs.getLong("int_pss_max_used");
296297
frame.name = rs.getString("str_name");
297298
frame.number = rs.getInt("int_number");
298299
frame.dispatchOrder = rs.getInt("int_dispatch_order");
@@ -709,14 +710,15 @@ public ResourceUsage getResourceUsage(FrameInterface f) {
709710
RESOURCE_USAGE_MAPPER, f.getFrameId());
710711
}
711712

712-
private static final String UPDATE_FRAME_MEMORY_USAGE_AND_LLU_TIME = "UPDATE " + "frame "
713-
+ "SET " + "ts_updated = current_timestamp," + "int_mem_max_used = ?,"
714-
+ "int_mem_used = ?," + "ts_llu = ? " + "WHERE " + "pk_frame = ? ";
713+
private static final String UPDATE_FRAME_MEMORY_USAGE_AND_LLU_TIME =
714+
"UPDATE " + "frame " + "SET " + "ts_updated = current_timestamp,"
715+
+ "int_mem_max_used = ?," + "int_mem_used = ?," + "int_pss_max_used = ?,"
716+
+ "int_pss_used = ?," + "ts_llu = ? " + "WHERE " + "pk_frame = ? ";
715717

716718
@Override
717719
public void updateFrameMemoryUsageAndLluTime(FrameInterface f, long maxRss, long rss,
718-
long lluTime) {
719-
getJdbcTemplate().update(UPDATE_FRAME_MEMORY_USAGE_AND_LLU_TIME, maxRss, rss,
720+
long maxPss, long pss, long lluTime) {
721+
getJdbcTemplate().update(UPDATE_FRAME_MEMORY_USAGE_AND_LLU_TIME, maxRss, rss, maxPss, pss,
720722
new Timestamp(lluTime * 1000l), f.getFrameId());
721723
}
722724

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,12 @@ public void updateMaxRSS(JobInterface job, long value) {
361361
job.getJobId(), value);
362362
}
363363

364+
public void updateMaxPSS(JobInterface job, long value) {
365+
getJdbcTemplate().update(
366+
"UPDATE job_mem SET int_max_pss=? WHERE pk_job=? AND int_max_pss < ?", value,
367+
job.getJobId(), value);
368+
}
369+
364370
private static final String UPDATE_JOB_FINISHED = "UPDATE " + "job " + "SET "
365371
+ "str_state = ?, " + "str_visible_name = NULL, " + "ts_stopped = current_timestamp "
366372
+ "WHERE " + "str_state = 'PENDING' " + "AND " + "pk_job = ?";

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,22 @@ public void updateLayerMaxRSS(LayerInterface layer, long val, boolean force) {
357357
getJdbcTemplate().update(sb.toString(), options);
358358
}
359359

360+
private static final String UPDATE_LAYER_MAX_PSS =
361+
"UPDATE " + "layer_mem " + "SET " + "int_max_pss = ? " + "WHERE " + "pk_layer = ?";
362+
363+
@Override
364+
public void updateLayerMaxPSS(LayerInterface layer, long val, boolean force) {
365+
StringBuilder sb = new StringBuilder(UPDATE_LAYER_MAX_PSS);
366+
Object[] options;
367+
if (!force) {
368+
options = new Object[] {val, layer.getLayerId(), val};
369+
sb.append(" AND int_max_pss < ?");
370+
} else {
371+
options = new Object[] {val, layer.getLayerId()};
372+
}
373+
getJdbcTemplate().update(sb.toString(), options);
374+
}
375+
360376
@Override
361377
public void updateLayerTags(LayerInterface layer, Set<String> tags) {
362378
if (tags.size() == 0) {

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ public CachedJobWhiteboardMapper(NestedJobWhiteboardMapper result) {
8686
+ "(job_resource.int_gpus + job_resource.int_local_gpus) AS int_gpus, "
8787
+ "job_resource.int_min_cores, " + "job_resource.int_min_gpus, "
8888
+ "job_resource.int_max_cores, " + "job_resource.int_max_gpus, "
89-
+ "job_mem.int_max_rss " + "FROM " + "show, " + "dept, " + "folder_level, "
90-
+ "folder_resource, " + "folder " + "LEFT JOIN " + "job " + "ON "
89+
+ "job_mem.int_max_rss, " + "job_mem.int_max_pss " + "FROM " + "show, " + "dept, "
90+
+ "folder_level, " + "folder_resource, " + "folder " + "LEFT JOIN " + "job " + "ON "
9191
+ " (folder.pk_folder = job.pk_folder AND job.str_state='PENDING') " + "LEFT JOIN "
9292
+ "facility " + "ON " + "(job.pk_facility = facility.pk_facility) " + "LEFT JOIN "
9393
+ "job_stat " + "ON " + "(job.pk_job = job_stat.pk_job) " + "LEFT JOIN "
@@ -290,6 +290,7 @@ private static final NestedJob mapResultSetToJob(ResultSet rs) throws SQLExcepti
290290
+ "host_stat.int_load, " + "proc.pk_proc, " + "proc.int_cores_reserved AS proc_cores, "
291291
+ "proc.int_gpus_reserved AS proc_gpus, " + "proc.int_mem_reserved AS proc_memory, "
292292
+ "proc.int_mem_used AS used_memory, " + "proc.int_mem_max_used AS max_memory, "
293+
+ "proc.int_pss_used AS used_pss, " + "proc.int_pss_max_used AS max_pss, "
293294
+ "proc.int_gpu_mem_reserved AS proc_gpu_memory, " + "proc.ts_ping, "
294295
+ "proc.ts_booked, " + "proc.ts_dispatched, " + "proc.b_unbooked, "
295296
+ "redirect.str_name AS str_redirect, " + "job.str_name AS job_name, "
@@ -390,6 +391,8 @@ public NestedHost mapRow(ResultSet rs, int row) throws SQLException {
390391
.setReservedMemory(rs.getLong("proc_memory"))
391392
.setReservedGpuMemory(rs.getLong("proc_gpu_memory"))
392393
.setUsedMemory(rs.getLong("used_memory"))
394+
.setUsedPss(rs.getLong("used_pss"))
395+
.setMaxPss(rs.getLong("max_pss"))
393396
.setFrameName(rs.getString("frame_name"))
394397
.setJobName(rs.getString("job_name"))
395398
.setShowName(rs.getString("show_name"))

0 commit comments

Comments
 (0)