Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions scripts/node_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ def main():
teuthology.log.setLevel(logging.DEBUG)
else:
teuthology.log.setLevel(100)
# regardless of verbosity we do not want to log console stuff
logging.getLogger("teuthology.orchestra.console").setLevel(logging.WARNING)
logger = logging.getLogger()
for handler in logger.handlers:
handler.setFormatter(
logging.Formatter('%(message)s')
logging.Formatter("%(asctime)s %(message)s", datefmt="%Y-%m-%dT%H:%M:%S")
)
try:
stale = query.find_stale_locks(
Expand All @@ -28,8 +30,8 @@ def main():
except Exception:
log.exception(f"Error while check for stale locks held by {args.owner}")
return
log.debug(f"Stale nodes: {len(stale)}")
if not stale:
log.debug("No stale nodes found.")
return
by_owner = {}
for node in stale:
Expand All @@ -50,7 +52,7 @@ def main():
else:
for owner, nodes in by_owner.items():
ops.unlock_safe([node["name"] for node in nodes], owner)
log.info(f"unlocked {len(stale)} nodes")
log.info(f"Unlocked {len(stale)} nodes")

def parse_args(argv):
parser = argparse.ArgumentParser(
Expand Down
9 changes: 9 additions & 0 deletions systemd/teuthology-node-cleanup@.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Teuthology Node Cleanup

[Service]
Type=simple
User=teuthworker
Environment=REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
ExecSearchPath=/home/teuthworker/src/teuthology_main/.venv/bin
ExecStart=uv run teuthology-node-cleanup --machine-type %i
8 changes: 8 additions & 0 deletions systemd/teuthology-node-cleanup@.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=Run Teuthology Node Cleanup

[Timer]
OnUnitActiveSec=15m

[Install]
WantedBy=timers.target
Loading