Stop logging while polling pod status
This commit is contained in:
parent
62a1566ab0
commit
24b5a123e6
|
@ -2,7 +2,7 @@
|
|||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.9 (podlaunch)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
main.py
6
main.py
|
@ -76,6 +76,10 @@ class PodKeeper:
|
|||
print(f"Starting pod {self.podname} at {self.last_check}", file=sys.stderr, flush=True)
|
||||
shlog.podman.play.kube(self.podyaml, *self.podnet_args)
|
||||
try:
|
||||
shlogger = logging.getLogger("sh.command")
|
||||
oldlevel = shlogger.level
|
||||
shlogger.setLevel(logging.ERROR)
|
||||
|
||||
if 'NOTIFY_SOCKET' in os.environ:
|
||||
sdnotify("--ready", f"--pid={os.getpid()}", "--status=Monitoring pod...")
|
||||
|
||||
|
@ -99,6 +103,8 @@ class PodKeeper:
|
|||
|
||||
if 'NOTIFY_SOCKET' in os.environ:
|
||||
sdnotify("--status=Stopping pod")
|
||||
|
||||
logging.getLogger("sh.command").setLevel(oldlevel)
|
||||
finally:
|
||||
self.stop_pod()
|
||||
|
||||
|
|
Loading…
Reference in a new issue