Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3827 #3822 #3820 #124

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
11 changes: 9 additions & 2 deletions deepsearch/cps/cli/data_indices_typer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def list(
for index in indices
]
except ValueError as e:
print(f"Error occurred: {e}")
typer.echo(f"Error occurred: {e}")
raise typer.Abort()

cli_output(results, output, headers="keys")
return
Expand Down Expand Up @@ -157,14 +158,20 @@ def upload_files(
raise typer.Abort()

coords = ElasticProjectDataCollectionSource(proj_key=proj_key, index_key=index_key)
utils.upload_files(
statuses = utils.upload_files(
api=api,
coords=coords,
url=urls,
local_file=local_file,
s3_coordinates=cos_coordinates,
)

if all([status == "SUCCESS" for status in statuses]):
typer.echo("File upload completed successfully")
else:
# TODO
typer.echo("Some files did not upload successfully")


@app.command(
name="add-attachment", help="Add attachment to a index item", no_args_is_help=True
Expand Down
4 changes: 2 additions & 2 deletions deepsearch/cps/cli/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def assign_user(
role=role,
)
else:
print("Project not found")
typer.echo("Project not found")
raise typer.Exit(code=1)


Expand All @@ -63,7 +63,7 @@ def remove(
if project is not None:
api.projects.remove(project=project)
else:
print("Project not found")
typer.echo("Project not found")
raise typer.Exit(code=1)


Expand Down
13 changes: 6 additions & 7 deletions deepsearch/cps/data_indices/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from deepsearch.cps.client.components.data_indices import S3Coordinates
from deepsearch.cps.client.components.elastic import ElasticProjectDataCollectionSource
from deepsearch.documents.core import convert, input_process
from deepsearch.documents.core.common_routines import progressbar, success_message
from deepsearch.documents.core.common_routines import progressbar
from deepsearch.documents.core.utils import cleanup, create_root_dir

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -92,9 +92,8 @@ def process_url_input(
statuses = convert.check_cps_status_running_tasks(
api=api, cps_proj_key=coords.proj_key, task_ids=task_ids
)
print(success_message)

return
return statuses


def process_local_file(
Expand Down Expand Up @@ -158,9 +157,9 @@ def process_local_file(
statuses = convert.check_cps_status_running_tasks(
api=api, cps_proj_key=coords.proj_key, task_ids=task_ids
)
print(success_message)

cleanup(root_dir=root_dir)
return
return statuses


def process_external_cos(
Expand Down Expand Up @@ -196,5 +195,5 @@ def process_external_cos(
statuses = convert.check_cps_status_running_tasks(
api=api, cps_proj_key=coords.proj_key, task_ids=task_ids
)
print(success_message)
return

return statuses
1 change: 0 additions & 1 deletion deepsearch/documents/core/common_routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ class ProgressBarParameters:


progressbar = ProgressBarParameters()
success_message = "Completed successfully"