Skip to content

Commit

Permalink
Merge pull request #1116 from MetPX/issue1115
Browse files Browse the repository at this point in the history
#1115 stopped flows were marked cpuS. fix
  • Loading branch information
petersilva authored Jun 19, 2024
2 parents 6337812 + d7b2de5 commit be1ad27
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions sarracenia/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def _read_state_dir(self):
if pathname[-4:] == '.pid':
i = int(pathname[-6:-4])
if t.isdigit():
#print( "%s/%s instance: %s, pid: %s" % ( c, cfg, i, t ) )
#print( "pid assignment: {c}/{cfg} instance: {i}, pid: {t}" )
self.states[c][cfg]['instance_pids'][i] = int(t)
elif pathname[-6:] == '.qname':
self.states[c][cfg]['queueName'] = t
Expand Down Expand Up @@ -1050,8 +1050,7 @@ def _resolve(self):
resource_usage={ 'uss': 0, 'rss': 0, 'vms':0, 'user_cpu': 0.0, 'system_cpu':0.0 }
nvip=False
for i in self.states[c][cfg]['instance_pids']:
if self.states[c][cfg]['instance_pids'][
i] not in self.procs:
if self.states[c][cfg]['instance_pids'][i] not in self.procs:
self.states[c][cfg]['missing_instances'].append(i)
else:
observed_instances += 1
Expand Down Expand Up @@ -1114,12 +1113,11 @@ def _resolve(self):
flow_status = 'idle'
elif (now-self.states[c][cfg]['metrics']['rxLast']) > self.configs[c][cfg]['options'].runStateThreshold_idle:
flow_status = 'idle'
else:
flow_status = 'running'

if self.states[c][cfg]['metrics']['msgRate'] > 0 and \
elif self.states[c][cfg]['metrics']['msgRate'] > 0 and \
self.states[c][cfg]['metrics']['msgRateCpu'] < self.configs[c][cfg]['options'].runStateThreshold_cpuSlow:
flow_status = 'cpuSlow'
else:
flow_status = 'running'

self.states[c][cfg]['resource_usage'] = copy.deepcopy(resource_usage)
self.configs[c][cfg]['status'] = flow_status
Expand Down

0 comments on commit be1ad27

Please sign in to comment.