File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -985,9 +985,21 @@ def _spawn_new_workers(self):
985985
986986 schedule_max = self ._max_workers - len (self ._job_workers )
987987
988- sensors = [s for s in self ._cb .select (Sensor ) if s .id in self ._unscheduled_jobs
989- and s .id not in self ._job_workers
990- and s .status == "Online" ]
988+ sensors = []
989+
990+ for sensor_id in self ._unscheduled_jobs :
991+ sensor = self ._cb .select (Sensor , sensor_id )
992+ if sensor_id in self ._job_workers :
993+ log .debug ("Skipping sensor {} already has a worker created" .format (sensor_id ))
994+ elif sensor .status == "Online" :
995+ sensors .append ()
996+ else :
997+ log .warn ("Sensor {} could not be found or is not Online" .format (sensor_id ))
998+
999+ # Non performant original code
1000+ # sensors = [s for s in self._cb.select(Sensor) if s.id in self._unscheduled_jobs
1001+ # and s.id not in self._job_workers
1002+ # and s.status == "Online"]
9911003 sensors_to_schedule = sorted (sensors , key = lambda x : (
9921004 int (x .num_storefiles_bytes ) + int (x .num_eventlog_bytes ), x .next_checkin_time
9931005 ))[:schedule_max ]
You can’t perform that action at this time.
0 commit comments