Skip to content

Commit 9f00b41

Browse files
dw-krollavanbrunt-cb
authored andcommitted
Account for sensor queue depth when scheduling jobs
1 parent c03662c commit 9f00b41

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cbapi/live_response_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,9 @@ def _spawn_new_workers(self):
797797
sensors = [s for s in self._cb.select(Sensor) if s.id in self._unscheduled_jobs
798798
and s.id not in self._job_workers
799799
and s.status == "Online"]
800-
sensors_to_schedule = sorted(sensors, key=lambda x: x.next_checkin_time)[:schedule_max]
800+
sensors_to_schedule = sorted(sensors, key=lambda x: (
801+
int(x.num_storefiles_bytes) + int(x.num_eventlog_bytes), x.next_checkin_time
802+
))[:schedule_max]
801803

802804
log.debug("Spawning new workers to handle these sensors: {0}".format(sensors_to_schedule))
803805
for sensor in sensors_to_schedule:

0 commit comments

Comments
 (0)