Skip to content

Commit

Permalink
Refactor daemonize to improve process safety
Browse files Browse the repository at this point in the history
- Removed `ensure_pressed(hmmfile)` from `daemonize()` function.
- Added `ensure_pressed(hmmfile)` to `spawn()` function.
- Incremented version from 0.16.3 to 0.16.4 in `pyproject.toml`.

The `ensure_pressed` step is necessary before `spawn()` to verify the
integrity of `hmmfile`, ensuring robust daemon initialization. Additionally,
this avoids redundancy in the `daemonize()` method. Updated version
number for release tracking and to reflect change.
  • Loading branch information
horta committed Dec 5, 2024
1 parent e753979 commit 834695b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion h3daemon/h3daemon/daemonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def daemonize(
stderr: Optional[Any] = None,
detach: Optional[bool] = None,
):
ensure_pressed(hmmfile)
fin = open(stdin, "r") if stdin else stdin
fout = open(stdout, "w+") if stdout else stdout
ferr = open(stderr, "w+") if stderr else stderr
Expand Down Expand Up @@ -52,6 +51,7 @@ def spawn(
detach: Optional[bool] = None,
force: Optional[bool] = False,
):
ensure_pressed(hmmfile)
pidfile = create_pidfile(hmmfile.path)
if pidfile.is_locked():
if not force:
Expand Down
2 changes: 1 addition & 1 deletion h3daemon/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "h3daemon"
version = "0.16.3"
version = "0.16.4"
description = "HMMER server"
authors = ["Danilo Horta <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 834695b

Please sign in to comment.