Skip to content

Commit

Permalink
dealt with flake8 issues
Browse files Browse the repository at this point in the history
also the order of the parameters for the --stdout / --no-logfile were
causing the daemon to not be able to start up with any commands as the
stdout kwarg was being passed to the function when it was expecting
no_logfile.
  • Loading branch information
mcgillij committed Jul 30, 2024
1 parent 1dde77d commit 0a2c791
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions amdfan/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ class FileDescriptorOpt(click.ParamType):
"-p",
type=click.Path(),
default=os.path.join(PIDFILE_DIR, "amdfan.pid"),
help=f"Pidfile path",
help="Pidfile path",
show_default=True,
)
@click.option(
"--no-pidfile",
is_flag=True,
help=f"Disable pidfile",
help="Disable pidfile",
)
@click.option(
"-l",
Expand All @@ -95,8 +95,8 @@ class FileDescriptorOpt(click.ParamType):
show_default=True,
)
@click.option(
"--stdout",
"--no-logfile",
"--stdout",
is_flag=True,
help="Disable logging file (prints to stdout instead)",
)
Expand Down
7 changes: 3 additions & 4 deletions amdfan/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import signal
import sys
import threading
import time
from typing import Any, Callable, Dict, List, Optional, Self
from typing import Any, Callable, Dict, List, Optional

import numpy as np
import yaml
Expand Down Expand Up @@ -41,7 +40,7 @@ def daemonize(stdin="/dev/null", stdout="/dev/null", stderr="/dev/null") -> None
if pid > 0:
os._exit(0)
except OSError as e:
raise Exception("Unable to background amdfan")
raise Exception("Unable to background amdfan: %s" % e)

os.chdir("/")
os.setsid()
Expand All @@ -52,7 +51,7 @@ def daemonize(stdin="/dev/null", stdout="/dev/null", stderr="/dev/null") -> None
if pid > 0:
os._exit(0)
except OSError as e:
raise Exception("Unable to daemonize amdfan")
raise Exception("Unable to daemonize amdfan: %s" % e)

redirect_fd(stdin, stdout, stderr)

Expand Down

0 comments on commit 0a2c791

Please sign in to comment.