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

Warning error #206

Open
LecoOliveira opened this issue Jun 15, 2023 · 1 comment
Open

Warning error #206

LecoOliveira opened this issue Jun 15, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@LecoOliveira
Copy link

Very nice project man!! It's a pleasure to use it im my own project.
But i have a little problem. When I run the tasks shows that message on the console:

UserWarning: Logger rocketry.task cannot be read. Logging is set to memory. To supress this warning, please set a handler that can be read (redbird.logging.RepoHandler)
  warnings.warn(
/home/alex/Documentos/Estudos/Palmeiras_News/.venv/lib/python3.10/site-packages/rocketry/session.py:364: UserWarning: Logger rocketry.task has too low level (WARNING). Level is set to INFO to make sure the task logs get logged.

My code:

repo = CSVFileRepo(filename='app/task.csv', model=MinimalRecord)

task_logger = logging.getLogger('rocketry.task')
handler = RepoHandler(repo=repo)
task_logger.addHandler(handler)

I already added the 'repo', am I doing something wrong?

OS: Linux Ubuntu 22.04 LTS
Python version 3.10
Additional context

rocketry 2.5.1

@LecoOliveira LecoOliveira added the bug Something isn't working label Jun 15, 2023
@oppenheimertoy
Copy link

Hello, @LecoOliveira! Facing same issue with rocketry version 2.5.1. Killed about an hour to understand what i'm doing wrong. Here my code snippet

@app.setup()
def set_repo(logger=TaskLogger()):
    repo = SQLRepo(engine=create_engine(config.SQLALCHEMY_DATABASE_URI), 
                   table="tasks_logs", model=MinimalRecord, 
                   id_field="created",
                   if_missing="create")
    handler = RepoHandler(repo=repo)
    handler.setLevel(logging.DEBUG)
    logger = logging.getLogger("rocketry.task")
    logger.addHandler(handler)

I am using rocketry alongside with FastAPI application factory and my repo has been configured under @app.setup decorator.

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

2 participants