Miksus / rocketry

Modern scheduling library for Python
https://rocketry.readthedocs.io
MIT License
3.25k stars 105 forks source link

BUG TaskRunnable is missing __str__ #150

Closed egisxxegis closed 1 year ago

egisxxegis commented 1 year ago

Describe the bug When using Rocketry with FastAPI, I return all tasks using such code: return rocketry_app.session.tasks . But if I dynamically create task (rocketry_app.session.create_task(...)) and set its start_cond to conds.cron(...), then endpoint raises exception on returning tasks: AttributeError: Condition <class 'rocketry.conditions.task.task.TaskRunnable'> is missing __str__.

To Reproduce Create task in session, set its start cond to future date using conds.cron(...), return session.tasks via FastAPI endpoint (found reference example in Rocketry docs)

Expected behavior No 500 internal error (no AttributeError) I expect it to print something, to stringify the condition

Screenshots I am sorry, no screenshots.

Desktop (please complete the following information):

Additional context I am creating a pull request to fix this issue. Link: pull request

egisxxegis commented 1 year ago

Thanks Miksus :)

Miksus commented 1 year ago

No problem! I really appreciate your effort :)

Especially the other bug you reported was a saviour. I was about to release quite a buggy feature (though the release will go till tomorrow or the day after).