Skip to content

Commit

Permalink
update cleanup function
Browse files Browse the repository at this point in the history
Signed-off-by: helenxie-bit <[email protected]>
  • Loading branch information
helenxie-bit committed Aug 30, 2024
1 parent d29a85d commit 82ea9be
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sdk/python/test/e2e/test_e2e_pytorchjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,15 @@ def clean_up_resources():

# Prune all unused Docker images
try:
# Remove all stopped containers
subprocess.run(["docker", "container", "prune", "-f"], check=True)
# Remove all unused images
subprocess.run(["docker", "image", "prune", "-a", "-f"], check=True)
# Remove all unused volumes
subprocess.run(["docker", "volume", "prune", "-f"], check=True)
# Remove all unused networks
subprocess.run(["docker", "network", "prune", "-f"], check=True)
# Show Docker disk usage
subprocess.run(["docker", "system", "df"], check=True)
subprocess.run(["df", "-hT"], check=True)
except subprocess.CalledProcessError as e:
print(f"Error during cleanup: {e}")
print(f"Error during Docker cleanup: {e}")

0 comments on commit 82ea9be

Please sign in to comment.