Giter Site home page Giter Site logo

BUG Error while deleting a task about rocketry HOT 3 OPEN

miksus avatar miksus commented on May 18, 2024
BUG Error while deleting a task

from rocketry.

Comments (3)

rohansh-tty avatar rohansh-tty commented on May 18, 2024 1

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.

Miksus avatar Miksus commented on May 18, 2024 1

@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.

Miksus avatar Miksus commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.