Code Monkey home page Code Monkey logo

Comments (9)

BlitzKraft avatar BlitzKraft commented on May 22, 2024 1

@Nukesor Hey, I haven't spent as much time as I want to on this. I am still working, but slowly. I will submit a pull request when I am done. Feel free to close the issue. But I will still be working on it.

from pueue.

Nukesor avatar Nukesor commented on May 22, 2024 1

Ok cool! 👍
Just wanted to check if you're still interested :)
Thanks!

from pueue.

bibby avatar bibby commented on May 22, 2024 1

One little idea, hooks.

Along the lines is virtualenvwrapper, allow the configuration and execution of user scripts at various points in the queue lifecycle.

execute scripts on:

  • daemon started / stopped
  • enqueue/dequeue
  • item completed, item completed[success] item completed[failed]
  • queue complete
  • queue reset / cleared

or go full Factorio and signal an event any time anything does anything.

Then you've got a foundation for user contributed scripts. I'd use a solid notify-send completion script, but a server installation could use something else (email, SMS, idk). I'm also big on playing loud noises off my local machine, so hooks allow it to become a personal thing.

Configuration could get the hard part if there were to be a different set of hooks for various contexts/projects. For instance, notify me for every item in my video render queue (slow), but don't for my image resize queue (fast).

from pueue.

Nukesor avatar Nukesor commented on May 22, 2024

Cool idea. Never thought about this as I'm using pueue mainly on my server.
Do you have any experience with this and a nice way to push notifications in python3 for various distributions?
It looks like there are a few different ways to do this, but I've never done something like this before and I would be happy about any advice :).

from pueue.

BlitzKraft avatar BlitzKraft commented on May 22, 2024

There is notify-send available for many distributions. There is simplepush.io for sending notifications to a phone. May be it's possible to make it configurable for the users?? It should be easy to whip up a wrapper that works with both, and other similar services.

For notify send, the command is as simple as

notify-send "Message text here"

For simplepush, the command is:

curl 'https://api.simplepush.io/send/<key>/<subject/<message>'

I can work on this feature and submit PR.

EDIT: I am going through the code now. I am trying to find a way to track a status change. But I don't see a better way than polling the daemon. Is that the best way ? I am open to suggestions.

from pueue.

Nukesor avatar Nukesor commented on May 22, 2024

I think the best way to do this is to launch the notification straight from the daemon.
Maybe in the ProcessHandler: https://github.com/Nukesor/pueue/blob/master/pueue/daemon/process_handler.py#L110

from pueue.

BlitzKraft avatar BlitzKraft commented on May 22, 2024

Ah. That makes sense.

from pueue.

Nukesor avatar Nukesor commented on May 22, 2024

@BlitzKraft: Hi!
Are you still planning to work on this feature?
Otherwise I'll probably drop this feature and close the issue.

from pueue.

Nukesor avatar Nukesor commented on May 22, 2024

This sounds like a plausible solution for this problem.
I would probably just look for existing hook scripts in the pueue config dir and pass interesting data as parameter.

Scripts:

  1. daemon started / stopped (Not sure if this is useful as it's triggered by a user manually)
  2. enqueue/dequeue (See 1.)
  3. item completed, item completed[success] item completed[failed] (A single hook with status as parameter, but yes!)
  4. queue complete (yep!)
  5. queue reset / cleared (See 1.)

I wouldn't distinguish between different kinds of queues, as this becomes too tricky and might be error prone (wrong categorization of task etc.).
If you put 1000 image resizing tasks in pueue, you'll get 1000 hook calls. I think the proper solution for this problem would be to add a script call to pueue which iterates over those small tasks.
In this case you wouldn't have parallel execution, but you could start the scripts with an offset parameter.

Anyway I really like the idea of hooks! I'll give it a look soon :).

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.