Skip to content

Commit 06f19e5

Browse files
authored
Merge pull request #22 from IBM/v6.1
trace cherrypy server pid
2 parents 32a7faf + dead10c commit 06f19e5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source/zimonGrafanaIntf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def main(argv):
610610
return
611611
except (Exception, IOError) as e:
612612
logger.details('%s', MSG['IntError'].format(str(e)))
613-
logger.errort(MSG['CollectorErr'])
613+
logger.error(MSG['CollectorErr'])
614614
return
615615
except (OSError) as e:
616616
logger.details('%s', MSG['IntError'].format(str(e)))
@@ -664,7 +664,11 @@ def main(argv):
664664
try:
665665
cherrypy.engine.start()
666666
logger.info("server started")
667-
logger.debug("Server started PID: {}".format(os.getpid()))
667+
with open("/proc/{}/stat".format(os.getpid())) as f:
668+
data = f.read()
669+
foreground_pid_of_group = data.rsplit(" ", 45)[1]
670+
is_in_foreground = str(os.getpid()) == foreground_pid_of_group
671+
logger.debug("Server PID: {}. Process started in the foreground: {}".format(os.getpid(), is_in_foreground))
668672
cherrypy.engine.block()
669673
except TypeError as e:
670674
logger.error("Server request could not be proceed. Reason: {}".format(e))

0 commit comments

Comments
 (0)