Skip to content

Commit f91084d

Browse files
neumanndDaniel Heydebreck
andauthored
improved logging (#55)
* updated logging in core * updated infrastructure * updated changelog for version 0.0.5 * fixed un-declared variable in core * updated maintainer email * incremented queue delay from 2 to 5 --------- Co-authored-by: Daniel Heydebreck <heydebreck@dkry.de>
1 parent a3308d3 commit f91084d

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ report.xml
3333

3434
# IDEs
3535
.idea
36-

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.0.5
4+
- a few new debugging logging messages
5+
- improved way to set logging level for ``slkspec``
6+
37
## v0.0.4
48
- incremented dependency on ``pyslk`` to ``2.3.0`` => improved workflows + new required functions
59
- internal ``list`` of files needed to be retrieved was changed to type ``set`` => remove duplicate files

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version"]
88
description = "fsspec implementation for StrongLink tape archive"
99
readme = "README.md"
1010
license = {text = "MIT License"}
11-
authors = [{name = "Hauke Schulz", email = "haschulz@uw.edu"}]
11+
authors = [{name = "Hauke Schulz", email = "has@dmi.dk"}]
1212
classifiers = [
1313
"Programming Language :: Python :: 3",
1414
"License :: OSI Approved :: MIT License",

slkspec/core.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
from fsspec.spec import AbstractFileSystem
3131

3232
logger = logging.getLogger("slkspec")
33-
logger.setLevel(logging.INFO)
33+
if logger.level == 0:
34+
if logging.root.level == 0:
35+
logger.setLevel(logging.INFO)
36+
else:
37+
logger.setLevel(logging.root.level)
3438

3539
MAX_RETRIES = 2
3640
MAX_PARALLEL_RECALLS = 3
@@ -114,7 +118,7 @@ def __init__(
114118
touch: bool = False,
115119
file_permissions: int = 0o644,
116120
dir_permissions: int = 0o3775,
117-
delay: int = 2,
121+
delay: int = 5,
118122
_lock: threading.Lock = _retrieval_lock,
119123
_file_queue: Queue[Tuple[str, str]] = FileQueue,
120124
**kwargs: Any,
@@ -915,7 +919,7 @@ def _recall_split_files_not_needed(self, file_id: int) -> None:
915919
def _check_tapes_of_split_file_available(
916920
self, file_id: int, tmp_tapes: list[str]
917921
) -> list[bool]:
918-
tmp_tapes_available: List[bool]
922+
tmp_tapes_available: List[bool] = list()
919923
msg: str
920924
for tape in tmp_tapes:
921925
# go through tape list and start new recalls
@@ -1230,6 +1234,14 @@ def _write_file_lists(
12301234
and file_path not in slk_retrieval.files_retrieval_failed.keys()
12311235
]
12321236
tmp_str: str
1237+
logger.debug(
1238+
"Start writing file lists if one of these values is larger than 0: "
1239+
+ "#'files retrieval reasonable' is "
1240+
+ f"{len(slk_retrieval.files_retrieval_reasonable)}; #'files recall "
1241+
+ f"failed' is {len(slk_recall.files_recall_failed.keys())}; #'files "
1242+
+ "retrieval failed' is "
1243+
+ f"{len(slk_retrieval.files_retrieval_failed.keys())}"
1244+
)
12331245
if (
12341246
len(slk_retrieval.files_retrieval_reasonable) > 0
12351247
or len(slk_recall.files_recall_failed.keys()) > 0
@@ -1246,12 +1258,20 @@ def _write_file_lists(
12461258
+ f"in directory '{str(slk_cache)}'."
12471259
)
12481260
if len(slk_recall.files_recall_failed) > 0:
1261+
logger.debug(
1262+
"Write list of files which recall failed into "
1263+
+ f"{os.path.join(slk_cache, file_failed_recall)}"
1264+
)
12491265
tmp_str = "\n ".join(slk_recall.files_recall_failed)
12501266
logger.error(f"files, recall failed:\n {tmp_str}")
12511267
with open(os.path.join(slk_cache, file_failed_recall), "w") as f:
12521268
for file_path, reason in slk_recall.files_recall_failed.items():
12531269
f.write(f"{file_path}: {reason}\n")
12541270
if len(slk_retrieval.files_retrieval_failed) > 0:
1271+
logger.debug(
1272+
"Write list of files which retrieval failed into "
1273+
+ f"{os.path.join(slk_cache, file_failed_retrieve)}"
1274+
)
12551275
tmp_str = "\n ".join(slk_retrieval.files_retrieval_failed)
12561276
logger.error(f"files, retrieval failed (recall successful):\n {tmp_str}")
12571277
with open(os.path.join(slk_cache, file_failed_retrieve), "w") as f:
@@ -1261,6 +1281,10 @@ def _write_file_lists(
12611281
) in slk_retrieval.files_retrieval_failed.items():
12621282
f.write(f"{file_path}: {reason}\n")
12631283
if len(missing_files) > 0:
1284+
logger.debug(
1285+
"Write list of files which were not retrieved for other "
1286+
+ f"reasons to {os.path.join(slk_cache, file_failed_other)}"
1287+
)
12641288
tmp_str = "\n ".join(missing_files)
12651289
logger.error(f"files, missing for other reasons:\n {tmp_str}")
12661290
with open(os.path.join(slk_cache, file_failed_other), "w") as f:

versioneer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# mypy: ignore-errors
2+
# flake8: noqa
23
# Version: 0.21
34

45
"""The Versioneer - like a rocketeer, but for versions.

0 commit comments

Comments
 (0)