Comments (3)
Hey @Miksus, can I take up this issue?
Based on your approach, I have changed the session module's remove_task() method.
def remove_task(self, task: Union['Task', str]):
if isinstance(task, str):
task = self[task]
self.tasks.remove(task)
Is this correct? I also tried running test cases (in test/ folder) on this method and it works fine. Here's the result
from rocketry.
@rohansh-tty, ye, go ahead! I think there was a PR but it had a bit more (tests failed due to that) I suppose it got inactive. What you have there is correct I think.
I think if you do the above and add a test for this it's fine for me to approve the PR. But you can do the PR with the above changes and I can advise/sketch a test to add to with the PR. I think this bug probably would have been exposed in the tests if they tested the removing in the app level (like these: https://github.com/Miksus/rocketry/tree/master/rocketry/test/app).
But I can help with coming up with the proper unit test if you open the PR π
from rocketry.
Thanks for reporting this!
The method does not make much sense:
class Session(RedBase):
...
def remove_task(self, task: Union['Task', str]):
if isinstance(task, str):
task = self[task]
self.session.tasks.remove(task)
We are already in the session, there is no need to go to another session. The back story of this is that I used to think the "session" object is something that's an attribute everywhere. I later thought to make the internals pass this when needed to reduce coupling. It's most likely a typo that the session is there. This feature is tested but the test passed most likely because it uses the "default" session (the session default is deprecated).
The nice thing is that the tasks are stored in a simple set, the tasks are hashable (the name should be unique anyways). Quick fix is simply remove the task manually:
app.session.tasks.remove(app.session['foo'])
Thanks again for reporting. The fix is simple (just take the extra session off from the method) but would be nice to do a test to the app level in which this bug would have been caught. A good easy issue if someone is interested but I can also fix it in the upcoming days.
A bit embarrassed about this bug.
from rocketry.
Related Issues (20)
- Task is only run once, but it should run every 10s HOT 1
- Scheduler stops after one task is erroring out HOT 1
- BUG - Retry within one hour if task is missed but the task is new
- Scheduler donΒ΄t run after_success(fuc) after some time. HOT 2
- @app.task('daily.at("21:00") before Friday') HOT 1
- @app.task(daily.between("08:00", "20:00") & every("10 minutes")) HOT 3
- Passing a mongoclient to MongoRepo does not work. Rocketry.run() fails. HOT 1
- ENH - API for viewing the task queue HOT 1
- Add tasks during runtime HOT 1
- TypeError: issubclass() arg 1 must be a class HOT 2
- ENH - Downtime recovery (persistance, crash recovery, process restart)
- ENH - Change task schedule on fly
- Warning error HOT 1
- @app.task(minutely & (time_of_week.between('Mon', 'Sat') & time_of_day.between('3:00', '10:00'))) HOT 1
- Pydantic v2 support HOT 25
- flask support
- Adding task on fly is not working in all scenarios HOT 1
- Optimization: Short circuit evaluation
- BUG: Hourly tasks are being run on server restarts HOT 1
- BUG HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rocketry.