Skip to content

cli: add snapshot commmand line interfaces#4

Merged
jma merged 1 commit intorero:stagingfrom
jma:maj-es-snap
Jun 21, 2022
Merged

cli: add snapshot commmand line interfaces#4
jma merged 1 commit intorero:stagingfrom
jma:maj-es-snap

Conversation

@jma
Copy link
Contributor

@jma jma commented May 23, 2022

  • Uses v3 of setup-python for github action.
  • Adds a custom docker-services to configure a snapshot volume for
    tests.
  • Adds a shared code for all the cli commands.
  • Adds fixtures tests elasticsearch indexes.

Co-Authored-by: Johnny Mariéthoz Johnny.Mariethoz@rero.ch

@jma jma force-pushed the maj-es-snap branch 4 times, most recently from 12aa1aa to e11df99 Compare June 2, 2022 11:22
@jma jma marked this pull request as ready for review June 2, 2022 11:23
@jma jma requested review from BadrAly, lauren-d, rerowep and vgranata June 2, 2022 11:24
Copy link
Contributor

@zannkukai zannkukai left a comment

Choose a reason for hiding this comment

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

all my remarks are cosmetic and don't need any changes to works as expected.

from flask.cli import with_appcontext
from invenio_search import current_search, current_search_client

from ...shared import abort_if_false
Copy link
Contributor

Choose a reason for hiding this comment

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

cosmtetic : up to ".." I prefer to use absolute import

Comment on lines +40 to +44
@snapshot.command('list')
@with_appcontext
@click.option('-n', '--name', help="default=_all", default='_all')
@click.argument('repository')
def list_snapshot(repository, name):
Copy link
Contributor

Choose a reason for hiding this comment

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

cosmetic : Personnaly, I don't like to put logical code into "init.py" when it's not necessary. Could be better to put these methods into a cli.py fil, import methods and use __all__ buildin variable ?

Comment on lines +50 to +59
infos = []
for snapshot in snapshots['snapshots']:
infos.append({
'snapshot': snapshot['snapshot'],
'start_time': snapshot['start_time'],
'duration': snapshot['duration_in_millis'] / 1000,
'shards': snapshot['shards'],
'state': snapshot['state'],
'uuid': snapshot['uuid']
})
Copy link
Contributor

Choose a reason for hiding this comment

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

cosmetic : Sourcery plugin would suggest a list comprehension for this.

infos = [{
        'snapshot': snapshot['snapshot'],
        'start_time': snapshot['start_time'],
        'duration': snapshot['duration_in_millis'] / 1000,
        'shards': snapshot['shards'],
        'state': snapshot['state'],
        'uuid': snapshot['uuid']
    }
    for snapshot in snapshots['snapshots']
]

* Uses v3 of setup-python for github action.
* Adds a custom docker-services to configure a snapshot volume for
  tests.
* Adds a shared code for all the cli commands.
* Adds fixtures tests elasticsearch indexes.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
@jma jma merged commit f17dd2b into rero:staging Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants