Skip to content

Commit

Permalink
Apply feedback from PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
ramirezfranciscof committed Feb 23, 2022
1 parent 4e76e51 commit c98fb5c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
5 changes: 3 additions & 2 deletions aiida/cmdline/commands/cmd_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,13 @@ def storage_info(statistics):
help=
'Run the maintenance in dry-run mode which will print actions that would be taken without actually executing them.'
)
def storage_maintain(full, dry_run):
@click.pass_context
def storage_maintain(ctx, full, dry_run):
"""Performs maintenance tasks on the repository."""
from aiida.manage.manager import get_manager

manager = get_manager()
profile = manager.get_profile()
profile = ctx.obj.profile
storage = manager.get_profile_storage()

if full:
Expand Down
12 changes: 10 additions & 2 deletions aiida/orm/implementation/storage_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def get_global_variable(self, key: str) -> Union[None, str, int, float]:

@abc.abstractmethod
def maintain(self, full: bool = False, dry_run: bool = False, **kwargs) -> None:
"""Performs maintenance tasks on the storage.
"""Perform maintenance tasks on the storage.
If `full == True`, then this method may attempt to block the profile associated with the
storage to guarantee the safety of its procedures. This will not only prevent any other
Expand All @@ -265,4 +265,12 @@ def maintain(self, full: bool = False, dry_run: bool = False, **kwargs) -> None:

@abc.abstractmethod
def get_info(self, statistics: bool = False) -> dict:
"""Returns general information on the storage."""
"""Return general information on the storage.
:param statistics:
flag to request more detailed information about the content of the storage.
:returns:
a nested dict with the relevant information.
"""
4 changes: 0 additions & 4 deletions tests/cmdline/commands/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ def mock_maintain(*args, **kwargs):
with caplog.at_level(logging.INFO):
_ = run_cli_command(cmd_storage.storage_maintain, user_input='Y')

for record in caplog.records:
print(record.msg.splitlines())
print('-----')

message_list = caplog.records[0].msg.splitlines()
assert ' > full: False' in message_list
assert ' > dry_run: False' in message_list
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/psql_dos/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_get_unreferenced_keyset():
assert 'aborting' in str(exc.value).lower()


#yapf: disable
# yapf: disable
@pytest.mark.parametrize(
(
'kwargs',
Expand Down

0 comments on commit c98fb5c

Please sign in to comment.