Skip to content

Commit

Permalink
Merge branch 'release-v0.2.22'
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgee committed Jul 25, 2020
2 parents d4557f5 + 9540f7a commit 1086335
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Changelog
=========

0.2.22 - 2020-07-25
-------------------

Changed
^^^^^^^

* Changed `dir` to `directory` in disk space check. (#226)
* Pass the git folder to the build context when making local docker images. (#226)

0.2.21 - 2020-07-05
-------------------

Expand Down
4 changes: 2 additions & 2 deletions docker/setup-local-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ docker build \
"${PANOPTES_UTILS}"

# In the local develop we need to pass git to the docker build context.
sed -i s'/^\.git$/\!\.git/' .dockerignore
#sed -i s'/^\.git$/\!\.git/' .dockerignore

echo "Building local panoptes-utils:develop"
docker build \
Expand All @@ -23,7 +23,7 @@ docker build \
"${PANOPTES_UTILS}"

# Revert our .dockerignore changes.
sed -i s'/^!\.git$/\.git/' .dockerignore
#sed -i s'/^!\.git$/\.git/' .dockerignore

cat <<EOF
Done building the local images.
Expand Down
15 changes: 7 additions & 8 deletions src/panoptes/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from .time import current_time


PATH_MATCHER = re.compile(r'''
.*?
(?P<unit_id>PAN\d{3})[/_]{1}
Expand Down Expand Up @@ -70,27 +69,27 @@ def listify(obj):
return [obj]


def get_free_space(dir=None):
"""Return the amoung of freespace in gigabytes for given dir.
def get_free_space(directory=None):
"""Return the amoung of freespace in gigabytes for given directory.
>>> from panoptes.utils import get_free_space
>>> get_free_space()
<Quantity ... Gbyte>
>>> get_free_space(dir='/')
>>> get_free_space(directory='/')
<Quantity ... Gbyte>
Args:
dir (str, optional): Path to directory. If None defaults to $PANDIR.
directory (str, optional): Path to directory. If None defaults to $PANDIR.
Returns:
astropy.units.Quantity: The number of gigabytes avialable in folder.
"""
if dir is None:
dir = os.getenv('PANDIR')
if directory is None:
directory = os.getenv('PANDIR')

_, _, free_space = shutil.disk_usage(dir)
_, _, free_space = shutil.disk_usage(directory)
free_space = (free_space * u.byte).to(u.gigabyte)
return free_space

Expand Down

0 comments on commit 1086335

Please sign in to comment.