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

incorrect success messages with tqdm progress bar tasks #108

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions deepsearch/cps/data_indices/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def process_url_input(
task_ids = []
# submit urls
count_urls = len(urls)

# Check if there are valid targets to iterate over
if count_urls == 0:
raise ValueError("No urls resolved from input")
with tqdm(
total=count_urls,
desc=f"{'Submitting input:': <{progressbar.padding}}",
Expand Down Expand Up @@ -133,6 +137,9 @@ def process_local_file(
# container for task_ids
task_ids = []

# Check if there are valid targets to iterate over
if count_total_files == 0:
raise ValueError("No files resolved from input")
# start loop
with tqdm(
total=count_total_files,
Expand Down
17 changes: 17 additions & 0 deletions deepsearch/documents/core/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ def send_files_for_conversion(
# container for task_ids
task_ids = []

# Check if there are valid targets to iterate over
if len(files_zip) == 0:
raise ValueError("No files resolved from input")

# start loop
with tqdm(
total=len(files_zip),
Expand Down Expand Up @@ -163,6 +167,10 @@ def check_status_running_tasks(
)
statuses = []

# Check if there are valid targets to iterate over
if count_total == 0:
raise ValueError("No task_ids resolved from input")

with tqdm(
total=count_total,
desc=f"{'Converting input:': <{progressbar.padding}}",
Expand Down Expand Up @@ -227,6 +235,10 @@ def download_converted_documents(
shows progress bar if True
"""

# Check if there are valid targets to iterate over
if len(download_urls) == 0:
raise ValueError("No urls resolved from input")

with tqdm(
total=len(download_urls),
desc=f"{'Downloading result:': <{progressbar.padding}}",
Expand Down Expand Up @@ -280,6 +292,11 @@ def send_urls_for_conversion(
"""
count_urls = len(urls)
task_ids = []

# Check if there are valid targets to iterate over
if count_urls == 0:
raise ValueError("No urls resolved from input")

with tqdm(
total=count_urls,
desc=f"{'Submitting input:': <{progressbar.padding}}",
Expand Down
4 changes: 4 additions & 0 deletions deepsearch/documents/core/create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def get_multiple_reports(
writer = csv.writer(csvfile)
writer.writerow(["batch_number", "task_id", "status", "document"])

# Check if there are valid targets to iterate over
if len(task_ids) == 0:
raise ValueError("No task_ids resolved from input")

# start loop
with tqdm(
total=len(task_ids),
Expand Down