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

[Bug]: Handling Errors in RemoteBulkWriter.commit() – Try-Except Not Catching Errors #2628

Open
1 task done
Basir-mahmood opened this issue Feb 10, 2025 · 0 comments
Open
1 task done
Labels
kind/bug Something isn't working

Comments

@Basir-mahmood
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I am using RemoteBulkWriter.commit() in Milvus, but when an error occurs, it is not getting caught in the try-except block. However, the internal bulk_writer._throw() method logs the error.
How can I catch this error inside my own code? Is there a callback method available to handle errors from writer.commit()?

writer = RemoteBulkWriter(
    schema=schema, 
    remote_path=bulk_writer_pth,
    connect_param=conn, 
    chunk_size=2*1024*1024*1024,
    file_type=BulkFileType.PARQUET
)

try:
    for df_record in df_records: 
        writer.append_row(df_record) 
    writer.commit()
except Exception as e:
    logger.error(f"Some error occurred. Error: {e}")

The code executes successfully, but when an error occurs inside writer.commit(), it does not get caught in the try-except block.
The error is instead logged by Milvus via bulk_writer._throw().
I want to ask that How can I catch error in my routine with writer.commit() within my try-except block? Is there a callback method available for handling errors during commit()?

Expected Behavior

No response

Steps/Code To Reproduce behavior

Environment details

Anything else?

No response

@Basir-mahmood Basir-mahmood added the kind/bug Something isn't working label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant