Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up docker containers #55

Merged
merged 4 commits into from
Jan 11, 2024
Merged
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion buildstockbatch/gcp/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,10 @@ def start_batch_job(self, batch_info):

runnable.container.commands = ["-c", "python3 -m buildstockbatch.gcp.gcp"]

prune = batch_v1.Runnable()
prune.script = batch_v1.Runnable.Script()
prune.script.text = "docker system prune --volumes -f"

gcp_cfg = self.cfg["gcp"]
job_env_cfg = gcp_cfg.get("job_environment", {})
resources = batch_v1.ComputeResource(
Expand All @@ -577,7 +581,7 @@ def start_batch_job(self, batch_info):
# Give three minutes per simulation, plus ten minutes for job overhead
task_duration_secs = 60 * (10 + batch_info.n_sims_per_job * 3)
task = batch_v1.TaskSpec(
runnables=[runnable],
runnables=[runnable, prune],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that there are two runnables, can we rename runnable to something like bsb_runnable?

And maybe a better name than prune might be cleanup_runnable (hide the implementation detail) or docker_prune_runnable (qualify what's being pruned). I lean towards the former, fwiw.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - this was a quick version to start testing with, but I'll clean it up before merging.

compute_resource=resources,
# Allow retries, but only when the machine is preempted.
max_retry_count=3,
Expand Down
Loading