feat: retain pending publications (#97)

This commit is contained in:
xavierk
2026-09-28 03:08:00 +05:30
parent 7c21b044ba
commit 0d45f263d2
6 changed files with 519 additions and 77 deletions
+9 -10
View File
@@ -27,7 +27,6 @@ if VENV_DIR.exists():
if site_packages:
sys.path.insert(0, str(site_packages))
from fenris.store import init_store, get_store_path
from fenris.collector import run_collection
@@ -103,14 +102,6 @@ def main() -> None:
config = load_config()
device = config["device"]
# Interrogate the drive
smartctl_data = interrogate_drive(device)
# Find sysfs path
sysfs_path = find_nvme_sysfs()
if sysfs_path is None:
raise RuntimeError("No NVMe controller found in sysfs")
# Inject a simple clock
class SimpleClock:
def utcnow(self):
@@ -118,8 +109,16 @@ def main() -> None:
clock = SimpleClock()
def acquire():
"""Interrogate the drive after pending-work preflight."""
smartctl_data = interrogate_drive(device)
sysfs_path = find_nvme_sysfs()
if sysfs_path is None:
raise RuntimeError("No NVMe controller found in sysfs")
return smartctl_data, sysfs_path
# Run collection
result = run_collection(smartctl_data, sysfs_path, config, clock)
result = run_collection(config=config, clock=clock, acquire=acquire)
if result["ok"]:
print(f"Collection successful: {result['sample_count']} sample(s)")