Skip to content

Commit

Permalink
Add OpenSearch refresh CLI command
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottKasoar committed Mar 13, 2024
1 parent 63a49b6 commit b119b3c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion abcd/backends/atoms_opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def info(self):
else:
host, port = None, None

self.client.indices.refresh(index=self.index_name)
self.refresh()
return {
"host": host,
"port": port,
Expand Down
6 changes: 6 additions & 0 deletions abcd/frontends/commandline/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ def server(*, abcd_url, url, api_only, **kwargs):
app.run(host=o.hostname, port=o.port)


@init_config
@init_db
def refresh(*, db, **kwargs):
db.refresh()


class Formater(object):
partialBlocks = ["▏", "▎", "▍", "▌", "▋", "▊", "▉", "█"] # char=pb

Expand Down
2 changes: 2 additions & 0 deletions abcd/frontends/commandline/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@
"-u", "--url", help="Url to run the server.", default="http://localhost:5000"
)

refresh_parser = subparsers.add_parser("refresh", help="refresh database")
refresh_parser.set_defaults(callback_func=commands.refresh)

def main(args=None):
kwargs = parser.parse_args(args).__dict__
Expand Down

0 comments on commit b119b3c

Please sign in to comment.