Skip to content

Commit

Permalink
detailed wrapper log message
Browse files Browse the repository at this point in the history
  • Loading branch information
dasbd72 committed Oct 16, 2023
1 parent d2414fd commit 37caa04
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
try:
self.etcd_client = etcd3.client(host=self.etcd_host, port=2379)
except Exception as e:
logging.error("Initialize etcd fail: {}".format(e))
logging.error("Connection to etcd fail: {}".format(e))

self.storage_path = os.getenv("STORAGE_PATH", None)
logging.info(f"STORAGE_PATH: {self.storage_path}")
Expand Down Expand Up @@ -84,16 +84,16 @@ def fput_object(

def copy_to_local():
if self.force_remote:
logging.info("force remote")
logging.info("fput copy failed: force remote")
return False

if not self.storage_path:
logging.info("no storage path")
logging.info("fput copy failed: no storage path")
return False

# TODO: use a better way to check whether to copy to local
if psutil.disk_usage(self.storage_path).free < os.path.getsize(file_path) * 2:
logging.info("disk is full")
logging.info("fput copy failed: disk is full")
return False

try:
Expand Down Expand Up @@ -149,17 +149,17 @@ def copy_from_local():
if self.force_remote or remote_download:
return False
if not self.storage_path:
logging.info("no storage path")
logging.info("fget copy failed: no storage path")
return False
if not os.path.exists(local_src):
logging.info("file not exists")
logging.info("fget copy failed: file not exists")
return False

try:
logging.info("fget_object local {}".format(local_src))
shutil.copy(local_src, file_path)
if not verify_hash(file_path, self.get_hash_file_path(local_src)):
logging.info("incorrect hash value, file {} is corrupted.".format(object_name))
logging.info("fget copy failed: incorrect hash value, file {} is corrupted.".format(object_name))
return False
return True
except Exception as e:
Expand Down

0 comments on commit 37caa04

Please sign in to comment.