Skip to content

Commit

Permalink
fix with PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvaingaudan committed Oct 24, 2024
1 parent abceffe commit 855d8a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions arlas/cli/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def describe(

@indices.command(help="Clone an index and set its name")
def clone(
index: str = typer.Argument(help="index's name"),
name: str = typer.Argument(help="Cloned index's name")
index: str = typer.Argument(help="Source index name"),
name: str = typer.Argument(help="Target cloned index name")
):
config = variables["arlas"]
indices = Service.clone_index(config, index, name)
Expand All @@ -51,9 +51,9 @@ def clone(

@indices.command(help="Migrate an index on another arlas configuration, and set the target index name")
def migrate(
index: str = typer.Argument(help="index's name"),
arlas_target: str = typer.Argument(help="ARLAS Configuration name"),
name: str = typer.Argument(help="Migrated index's name")
index: str = typer.Argument(help="Source index name"),
arlas_target: str = typer.Argument(help="Target ARLAS Configuration name"),
name: str = typer.Argument(help="Target migrated index name")
):
config = variables["arlas"]
indices = Service.migrate_index(config, index, arlas_target, name)
Expand Down
8 changes: 4 additions & 4 deletions arlas/cli/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ def list_collections(arlas: str) -> list[list[str]]:
])
return table

def list_indices(arlas: str, keeponly: str = None) -> list[list[str]]:
def list_indices(arlas: str, keep_only: str = None) -> list[list[str]]:
data = json.loads(Service.__es__(arlas, "_cat/indices?format=json"))
table = [["name", "status", "count", "size"]]
for index in data:
if keeponly is None or keeponly == index.get("index"):
if keep_only is None or keep_only == index.get("index"):
table.append([
index.get("index"),
index.get("status"),
Expand Down Expand Up @@ -232,7 +232,7 @@ def clone_index(arlas: str, index: str, name: str) -> list[list[str]]:
Service.__es__(arlas, "/".join([index, "_block", "write"]), put="")
Service.__es__(arlas, "/".join([index, "_clone", name]), put="")
Service.__es__(arlas, "/".join([index, "_settings"]), put='{"index.blocks.write": false}')
return Service.list_indices(arlas, keeponly=name)
return Service.list_indices(arlas, keep_only=name)

def migrate_index(arlas: str, index: str, target_arlas: str, target_name: str) -> list[list[str]]:
source = Configuration.settings.arlas.get(arlas)
Expand All @@ -255,7 +255,7 @@ def migrate_index(arlas: str, index: str, target_arlas: str, target_name: str) -
Service.__es__(target_arlas, "/".join([target_name]), put=mapping)
print("3/3: copy data ...")
print(Service.__es__(target_arlas, "/".join(["_reindex"]), post=json.dumps(migration)))
return Service.list_indices(target_arlas, keeponly=target_name)
return Service.list_indices(target_arlas, keep_only=target_name)

def sample_collection(arlas: str, collection: str, pretty: bool, size: int) -> dict:
sample = Service.__arlas__(arlas, "/".join(["explore", collection, "_search"]) + "?size={}".format(size))
Expand Down

0 comments on commit 855d8a3

Please sign in to comment.