Browse Source

code formatting (black)

master
adam j hartz 1 month ago
parent
commit
aa7d606d32
2 changed files with 19 additions and 6 deletions
  1. 4
    2
      catsoop/scripts/checker.py
  2. 15
    4
      catsoop/scripts/start_catsoop.py

+ 4
- 2
catsoop/scripts/checker.py View File

@@ -329,8 +329,10 @@ while True:
try:
row = cslog.unprep(f.read())
except Exception as err:
LOGGER.error("[checker] failed to read queue log file %s, error=%s, traceback=%s" %
(qfn, err, traceback.format_exc()))
LOGGER.error(
"[checker] failed to read queue log file %s, error=%s, traceback=%s"
% (qfn, err, traceback.format_exc())
)
continue
_, magic = first.split("_")
row["magic"] = magic

+ 15
- 4
catsoop/scripts/start_catsoop.py View File

@@ -150,14 +150,25 @@ def main():
atexit.register(_kill_children)

while True:
for idx, (procinfo, proc) in enumerate(zip(procs, running)): # restart running process if it has died
for idx, (procinfo, proc) in enumerate(
zip(procs, running)
): # restart running process if it has died
if proc.poll() is not None:
(wd, cmd, slp, name) = procinfo
LOGGER.error('[start_catsoop] %s (pid=%s) was killed, restarting it' % (name, proc.pid))
running[idx] = subprocess.Popen(cmd, cwd=wd, preexec_fn=set_pdeathsig(signal.SIGTERM))
LOGGER.error("[start_catsoop] Starting %s (cmd=%s, wd=%s) as pid=%s" % (name, cmd, wd, running[idx].pid))
LOGGER.error(
"[start_catsoop] %s (pid=%s) was killed, restarting it"
% (name, proc.pid)
)
running[idx] = subprocess.Popen(
cmd, cwd=wd, preexec_fn=set_pdeathsig(signal.SIGTERM)
)
LOGGER.error(
"[start_catsoop] Starting %s (cmd=%s, wd=%s) as pid=%s"
% (name, cmd, wd, running[idx].pid)
)
time.sleep(1)


def startup_catsoop(config_loc=None):
print(cs_logo)
print("Using base_dir=%s" % base_dir)

Loading…
Cancel
Save