Skip to content

Commit

Permalink
janitor: don't delete old images
Browse files Browse the repository at this point in the history
This is overly complicated. Just use a cron script:

cd /mnt/store/ && find . -type d -mtime +10 -exec rm -rf {} \;

Signed-off-by: Paul Spooren <mail@aparcar.org>
  • Loading branch information
aparcar committed Sep 30, 2023
1 parent 9fba880 commit a3d8ac9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
2 changes: 0 additions & 2 deletions asu/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ def build(req: dict, job=None):

log.debug("JSON content %s", json_content)

job.connection.sadd(f"builds:{version_code}:{req['target']}", req["request_hash"])

# Increment stats
job.connection.hincrby(
"stats:builds",
Expand Down
16 changes: 0 additions & 16 deletions asu/janitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,6 @@ def update_target_profiles(config, branch: dict, version: str, target: str) -> s

r.hset(f"architecture:{branch['name']}", target, metadata["arch_packages"])

queue = Queue(connection=r)
registry = FinishedJobRegistry(queue=queue)
version_code = r.get(f"revision:{version}:{target}")
if version_code:
version_code = version_code.decode()
for request_hash in r.smembers(f"builds:{version_code}:{target}"):
logging.warning(f"{version_code}/{target}: Delete outdated job build")
try:
request_hash = request_hash.decode()
registry.remove(request_hash, delete_job=True)
rmtree(config["STORE_PATH"] / request_hash)

except NoSuchJobError:
logging.warning("Job was already deleted")
r.delete(f"builds:{version_code}:{target}")

r.set(
f"revision:{version}:{target}",
metadata["version_code"],
Expand Down

0 comments on commit a3d8ac9

Please sign in to comment.