Code Monkey home page Code Monkey logo

Comments (15)

Nukesor avatar Nukesor commented on June 18, 2024 2

ping @dmgolembiowski

Do you still plan to work on this :)? I intend to do a release in the upcoming weeks and this is something I would like to see in that release^^. In case you're no longer interested, I'll probably continue working on this :)

from pueue.

Nukesor avatar Nukesor commented on June 18, 2024 1

I don't see any problems with this :)

If we track the created_at time, I would even go ahead and track the enqueued_at time as well.
The enqueue_at time is currently only saved in the task's state and not persistant. Once the task is automatically enqueued, this information is lost.

  • created_at: Datetime should be fairly straight forward. Just set the field in the Task constructor.
  • enqueued_at: Option<Datetime> however has a few places where it needs to be set (all inside the daemon)
    • When handling a task enqueue
    • When adding a task without --stashed
    • When restarting a task
    • When stashing a task (reset it to None)
    • Probably somewhere I'm currently not thinking of

from pueue.

Nukesor avatar Nukesor commented on June 18, 2024 1

Thanks for taking care of this issue :)

That test is rather important as it ensures backward compatibility for states of old versions.
If we introduce incompatibilities, users will loose their current state when restarting the daemon after updating.

The proper way around it would be to define default deserialization values for the missing fields.
Check out serde defaults.

That way, old states might have incorrect values, but at least they can be parsed and used as expected.

from pueue.

dmgolembiowski avatar dmgolembiowski commented on June 18, 2024 1

Thanks for taking care of this issue :)
You're welcome; I see a ton of potential for pueue.

The proper way around it would be to define default deserialization values for the missing fields. Check out serde defaults.

That way, old states might have incorrect values, but at least they can be parsed and used as expected.

Sweet, I'll go ahead and work that out later tonight

from pueue.

Nukesor avatar Nukesor commented on June 18, 2024 1

@dmgolembiowski I added a few comments directly on your commits, since the repository referenced in the PR no longer exists.

Regarding tests, I would be ok with adding a few statements in the tests that check enqueing and adding tasks :)

I.e.

  • test_normal_add for created_at.
  • test_enqueued_tasks and test_delayed_tasks for enqueue_at

Since we cannot check for exact times, we'll have to make do with a appropriate time range (~500ms-1000ms)

from pueue.

mjpieters avatar mjpieters commented on June 18, 2024 1

Should editing a task's command/path update the created_at field?

Nope. It’s the same task still as far as I am concerned. If I need it to have a new created time I’ll create a new task…

from pueue.

Nukesor avatar Nukesor commented on June 18, 2024 1

Ping @dmgolembiowski

How is it going :)? In case you are no longer working on this, I'll continue to work on this :)
This should definitely be in the next release. I'm going on holiday next week and I'll try to polish everything for a 3.0 release during that time.

from pueue.

Nukesor avatar Nukesor commented on June 18, 2024 1

Implemented in #386

from pueue.

dmgolembiowski avatar dmgolembiowski commented on June 18, 2024

@mjpieters + @Nukesor, I'll give this a shot tonight.

@Nukesor I suspect you were right that there was somewhere else you weren't thinking of originally. After implementing the tweaks in a few spots, running cargo test shows an error restoring from an old state.

File "/home/david/pueue/tests/state_backward_compatibility.rs", line 19, in state_backward_compatibility::test_restore_from_old_state::{{closure}}
    fn test_restore_from_old_state() -> Result<()> { 

which has:

        // ...
        let old_state = include_str!("data/v2.0.0_state.json");
        let temp_dir = TempDir::new()?;
        let temp_path = temp_dir.path();

       // Open v0.12.2 file and write old state to it.
       let temp_state_path = temp_dir.path().join("state.json");
       let mut file = File::create(&temp_state_path)?;
       file.write_all(old_state.as_bytes())?;
        // ...
    }

Does it seem okay if this test can be updated so that the comparison against the old JSON state file check only for required keys being a match?

from pueue.

Nukesor avatar Nukesor commented on June 18, 2024

We can also make these optional columns that can be included once the query/filter syntax lands :)

Could be an interesting thing for some users.

from pueue.

dmgolembiowski avatar dmgolembiowski commented on June 18, 2024

ping @dmgolembiowski

Do you still plan to work on this :)? I intend to do a release in the upcoming weeks and this is something I would like to see in that release^^. In case you're no longer interested, I'll probably continue working on this :)

Whoops! Sorry I, I've been busy with other things and forgot about this.

from pueue.

dmgolembiowski avatar dmgolembiowski commented on June 18, 2024

Apologies if we're briefly losing commits due to an error I recently encountered:

╭─david at david-laptop in /home/david
╰─λ git clone https://github.com/dmgolembiowski/pueue/
Cloning into 'pueue'...
remote: fatal: bad tree object e0f56fb8b0421f874b4edd5c227912d219b669d9
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

from pueue.

dmgolembiowski avatar dmgolembiowski commented on June 18, 2024

Pardon, @Nukesor , could you peek at github.com/dmgolembiowski/pueue/ and let me know what kinds of tests you'd like to integrate. As it's currently implemented, all tests are passing on nightly. (woo)

from pueue.

Nukesor avatar Nukesor commented on June 18, 2024

One more thing we should probably test:

Restarting tests without the --in-place option will also create a new (cloned) task.

One other thing I'm not sure about:
Should editing a task's command/path update the created_at field?

@mjpieters I would like to get your opinion on this as well :).

from pueue.

dmgolembiowski avatar dmgolembiowski commented on June 18, 2024

Ping @dmgolembiowski

How is it going :)? In case you are no longer working on this, I'll continue to work on this :)
This should definitely be in the next release. I'm going on holiday next week and I'll try to polish everything for a 3.0 release during that time.

Awesome, sounds good to me.

from pueue.

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.