Skip to content

Commit

Permalink
Fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris committed Jan 26, 2024
1 parent 36f7925 commit 1390674
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ RUN /kb/deployment/bin/install_python_dependencies.sh

ENTRYPOINT [ "/usr/bin/docker-init" ]
CMD ["/kb/deployment/bin/docker-init.sh"]
WORKDIR /kb/deployment/jettybase
WORKDIR /kb/deployment
12 changes: 8 additions & 4 deletions deployment/bin/cron/delete_exited_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ def send_slack_message(message: str):
hostname = socket.gethostname()
dc = docker.from_env()
ec = dc.containers.list(filters={"status": "exited"})
container_image_names = [c.attrs["Config"]["Image"] for c in ec]
if container_image_names:
dc.containers.prune()
send_slack_message(f"Deleted {len(ec)} `exited` containers on {hostname} {container_image_names}")
kbase_containers = [c for c in ec if "kbase" in c.attrs["Config"]["Image"]]
container_image_names = [c.attrs["Config"]["Image"] for c in kbase_containers]
if kbase_containers:
for container in kbase_containers:
container.remove()
if bool(os.environ.get('DEBUG', "False").lower()):
send_slack_message(
f"Deleted {len(kbase_containers)} `exited` containers with 'kbase' in image name on {hostname} {container_image_names}")
2 changes: 1 addition & 1 deletion deployment/conf/.templates/cronjobs.config.templ
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ STARTD_CRON_ManageVarLibDocker_PERIOD = 336h
STARTD_CRON_ManageVarLibDocker_MODE = Periodic
STARTD_CRON_ManageVarLibDocker_RECONFIG_RERUN = True

STARTD_CRON_JOBLIST = NodeHealth ContainerReaper ManageVarLibDocker ManageCondorSubmitWorkdir
STARTD_CRON_JOBLIST = NodeHealth ContainerReaper ManageVarLibDocker ManageCondorSubmitWorkdir DeleteExitedContainers
# STARTD_CRON_AUTOPUBLISH = If_Changed

0 comments on commit 1390674

Please sign in to comment.