Skip to content

Commit

Permalink
Output warning if no fs or target_protocol provided
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunxuTang committed Mar 14, 2024
1 parent 444f0e4 commit 2201c27
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions alluxiofs/core.py
Original file line number Diff line number Diff line change
@@ -85,16 +85,18 @@ def __init__(
**kwargs: other parameters for core session.
"""
super().__init__(**kwargs)
if not (fs is None) ^ (target_protocol is None):
self.logger = logger or logging.getLogger("Alluxiofs")
if fs and target_protocol:
raise ValueError(
"Please provide one of filesystem instance (fs) or"
" target_protocol, not both"
)
if fs is None and target_protocol is None:
raise ValueError(
"Please provide filesystem instance(fs) or target_protocol"
self.logger.warning(
"Neither filesystem instance(fs) nor target_protocol is "
"provided. Will not fall back to under file systems when "
"accessed files are not in Alluxiofs"
)
self.logger = logger or logging.getLogger("Alluxiofs")
self.kwargs = target_options or {}
self.fs = None
if fs is not None:

0 comments on commit 2201c27

Please sign in to comment.