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

Bot initialization errors when a 3rd party package emits a warning message #237

Open
mwakaba2 opened this issue Dec 21, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@mwakaba2
Copy link

Description

I noticed bot initialization exits when logging or a 3rd party package emits a warning message. Is this expected?

Reproduce

import logging

def initialize():
    logging.warning("Start loading sentiment model")

The bot ends with the following error message:

$ npm run tx 0x4989fa9d76a0f1a54236e6fb59823827ce98e063047b909308ed7552a739fef0

> text-message-sentiment-analysis@1.0.0 tx
> forta-agent run --tx 0x4989fa9d76a0f1a54236e6fb59823827ce98e063047b909308ed7552a739fef0

initializing agent...
WARNING:root:Start loading sentiment model
ERROR: Error: error initializing agent: python: WARNING:root:Start loading sentiment model

This also happens with a 3rd party package I'm using called transformers to load a deep learning model. While loading, the library logs some warning messages and the process exits.

To prevent the initialize method from exiting, I updated the logging settings to only emit errors.

logging.getLogger("transformers").setLevel(logging.ERROR)

Expected behavior

I'm hoping the bot initialization to complete and only exit if the message has a level >= ERROR.

Additional context

Language: python
SDK Version: 0.1.15

@mwakaba2 mwakaba2 added the bug Something isn't working label Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant