Skip to content
Closed
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
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ project adheres to [Semantic Versioning](http://semver.org/).

## v0.6.0 - DATE

### Changed

* Default to a docker.errors.NotFound python exception when the image can't
be found. This is instead of creating biobox.exception.ImageNotFound.

## v0.5.0 - 2017-03-16

### Changed
Expand All @@ -17,7 +22,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

* Enable networking on all biobox docker images by default to solve problem
of occaisonal network outages on stats collection as outlined in
of occasional network outages on stats collection as outlined in
[docker/docker-py#1195][issue-1195].

[issue-1195]: https://github.com/docker/docker-py/issues/1195
Expand Down
5 changes: 0 additions & 5 deletions biobox/exception.py

This file was deleted.

12 changes: 6 additions & 6 deletions biobox/image/availability.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import biobox.util as util
import biobox.exception
import docker.errors
import biobox.util as util

from functools import reduce

def get_image_tags(docker_dict):
Expand Down Expand Up @@ -39,10 +40,9 @@ def is_image_available_locally(name):

def get_image(name):
"""
Fetches the Docker image if it is not present locally.
Fetches the Docker image if it is not present locally. This will raise a
docker.errors.NotFound error if the image does not exist.
"""
if not is_image_available_locally(name):
output = util.client().pull(name)
if "error" in output:
raise biobox.exception.NoImageFound(name)
util.client().pull(name)
return True
7 changes: 0 additions & 7 deletions test/image/test_availability.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
import biobox.image.availability as avail
import biobox.exception

IMAGE_TAGS = [
"alpine",
Expand Down Expand Up @@ -31,9 +30,3 @@ def test_checking_a_locally_non_existent_image():
def test_getting_an_image():
for tag in IMAGE_TAGS:
assert avail.get_image(tag)

@pytest.mark.slow
def test_getting_an_image_that_doesnt_exist():
with pytest.raises(biobox.exception.NoImageFound):
for tag in UNKNOWN_TAGS:
avail.get_image(tag)
4 changes: 3 additions & 1 deletion test/test_cgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def test_collect_metric_with_dead_container():
time.sleep(1)
cgroup.collect_metric(stream)
time.sleep(1)
assert cgroup.collect_metric(stream) == None
metrics = cgroup.collect_metric(stream)
assert 'memory_stats' in metrics
assert metrics['memory_stats'] == {}
hlp.clean_up_container(id_)


Expand Down