Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mmcv/fileio/file_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class PetrelBackend(BaseStorageBackend):
path_mapping (dict, optional): Path mapping dict from local path to
Petrel path. When ``path_mapping={'src': 'dst'}``, ``src`` in
``filepath`` will be replaced by ``dst``. Default: None.
conf_path (str, optional): Petrel client config path. Default: None.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
conf_path (str, optional): Petrel client config path. Default: None.
conf_path (str, optional): Config path of Petrel client. Default: None.
`New in version 1.7.1`.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this line to the end.

enable_mc (bool, optional): Whether to enable memcached support.
Default: True.

Expand All @@ -108,14 +109,15 @@ class PetrelBackend(BaseStorageBackend):

def __init__(self,
path_mapping: Optional[dict] = None,
conf_path: str = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a new parameter in the middle position may cause a bc issue. Suggest moving it to the end.

enable_mc: bool = True):
try:
from petrel_client import client
except ImportError:
raise ImportError('Please install petrel_client to enable '
'PetrelBackend.')

self._client = client.Client(enable_mc=enable_mc)
self._client = client.Client(conf_path=conf_path, enable_mc=enable_mc)
assert isinstance(path_mapping, dict) or path_mapping is None
self.path_mapping = path_mapping

Expand Down
6 changes: 5 additions & 1 deletion tests/test_fileclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ def Get(self, filepath):

class MockPetrelClient:

def __init__(self, enable_mc=True, enable_multi_cluster=False):
def __init__(self,
conf_path=None,
enable_mc=True,
enable_multi_cluster=False):
self.conf_path = conf_path
self.enable_mc = enable_mc
self.enable_multi_cluster = enable_multi_cluster

Expand Down