From 01062770055c1cdf136b58f8db42bee91733cb9f Mon Sep 17 00:00:00 2001 From: John Readey Date: Mon, 2 Dec 2024 19:52:18 -0800 Subject: [PATCH] version bump (#403) * version bump * handle zero-byte json as not found error --------- Co-authored-by: John Readey --- .travis.yml | 32 -------------------------------- hsds/basenode.py | 2 +- hsds/util/storUtil.py | 9 ++++++++- pyproject.toml | 2 +- requirements.txt | 2 +- 5 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 479f0efb..00000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: python - -python: - - '3.8' - -env: - - ADMIN_USERNAME=admin ; - ADMIN_PASSWORD=admin ; - ROOT_DIR=${HOME}/buckets ; - HSDS_ENDPOINT=http+unix://%2Ftmp%2Fsn_1.sock ; - BUCKET_NAME=hsds.test - -install: - - sudo apt-get update -qq - - echo "pip freeze" - - pip freeze - - python setup.py install - - echo "pip freeze" - - pip freeze - - pip install pyflakes - - pyflakes hsds/*.py - - pyflakes hsds/util/*.py - - cp admin/config/passwd.default admin/config/passwd.txt - - cp admin/config/groups.default admin/config/groups.txt -script: - - echo "ROOT_DIR:" $ROOT_DIR - - echo "HSDS_ENDPOINT:" $HSDS_ENDPOINT - - mkdir $ROOT_DIR - - mkdir ${ROOT_DIR}/hsds.test - - hsds --root_dir=${ROOT_DIR} --password_file=admin/config/passwd.txt --use_socket --count=1 --s3_sync_interval=20 & - - sleep 10 - - python testall.py diff --git a/hsds/basenode.py b/hsds/basenode.py index 6cb6c7be..4702335f 100644 --- a/hsds/basenode.py +++ b/hsds/basenode.py @@ -33,7 +33,7 @@ from .util.k8sClient import getDnLabelSelector, getPodIps from . import hsds_logger as log -HSDS_VERSION = "0.9.0.beta1" +HSDS_VERSION = "0.9.1" def getVersion(): diff --git a/hsds/util/storUtil.py b/hsds/util/storUtil.py index 47e62170..3bbb073c 100644 --- a/hsds/util/storUtil.py +++ b/hsds/util/storUtil.py @@ -21,7 +21,7 @@ import numcodecs as codecs import bitshuffle from json import JSONDecodeError -from aiohttp.web_exceptions import HTTPInternalServerError +from aiohttp.web_exceptions import HTTPInternalServerError, HTTPNotFound from .. import hsds_logger as log from .s3Client import S3Client @@ -425,6 +425,13 @@ async def getStorJSONObj(app, key, bucket=None): data = await client.get_object(key, bucket=bucket) + if len(data) == 0: + # treat a zero-byte file as not found for JSON + # seems with posix drivers we can sometimes get a file result + # before any data gets written to it + log.warn(f"zero bytes returned for key: {key} bucket:{bucket}") + raise HTTPNotFound() + try: json_dict = json.loads(data.decode("utf8")) except UnicodeDecodeError: diff --git a/pyproject.toml b/pyproject.toml index e2e89484..238b28ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", ] requires-python = ">=3.8" -version = "0.8.5" +version = "0.9.1" dependencies = [ "aiohttp == 3.9.4", diff --git a/requirements.txt b/requirements.txt index af65e96e..5aa9d39b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ azure-storage-blob cryptography h5py>=3.6.0 numcodecs -numpy +numpy>=2.0.0rc1 psutil pyjwt pytz