Code Monkey home page Code Monkey logo

Comments (13)

theothertomelliott avatar theothertomelliott commented on September 2, 2024 3

Deployed version 1.8.19 with the configurable timeout.

from edward.

steveoc64 avatar steveoc64 commented on September 2, 2024 1

@shousper - while you are there, do you have a suggestion for the syntax to add to the config ?

Im thinking something simple like this on the service definition

{
  "name": "my-awesome-service",
  "commands": {
     "launch": "my-awesome-service"
  },
  "terminate": { 
    "signal": "11",  // UNIX signal ID. Default = syscall.SIGINT
    "wait": "30s"   // use time.Parse() syntax. Default = 5s
  }
}

with the ability to add "terminate" to the group definition as well, and inherit that at each service level.

Thoughts ?

Another way to achieve the same thing - use the service::stop directive, and wrap it in a shell script that does what you need ?

from edward.

theothertomelliott avatar theothertomelliott commented on September 2, 2024 1

My pleasure! Glad the changes fill the need.

I'm going to do a little cleanup on the test, but should be able to get that merged and drop out a minor release over the next few days.

from edward.

shousper avatar shousper commented on September 2, 2024 1

Regarding:

If the runner receives an interrupt, it will attempt to stop the service as appropriate to the backend being used.

I'd say what you've done is sufficient. Once the "backends" feature reaches maturity and you find you need to move this timeout value to a command line backend specific property, I'd say that'd be fine too. Can always deprecate and move these things over time 😃.

As far as Docker, it has a Dockerfile command for the stop signal and you already support overriding config for this. So I'd say that one is already solid 👌

from edward.

theothertomelliott avatar theothertomelliott commented on September 2, 2024

Thanks for raising this issue, really appreciate the detail and recommendation!

Do you see it being more useful for your use case to have the grace period configurable in the service configuration, a command-line flag, or both?

from edward.

shousper avatar shousper commented on September 2, 2024

No worries mate, thanks for building and maintaining such a useful tool for us!

I think both could be most helpful. We don't tend to use command line flags for edward at all, everything is configured via an edward.json for convenience and sharing. I'd say in priority order:

  1. Service level override minimum would sort us out for a good while.
  2. Top-level config override would be nice to have, but not absolutely required.
  3. Command line flag for the top-level override might be handy, but also probably a nice to have.

from edward.

theothertomelliott avatar theothertomelliott commented on September 2, 2024

Sounds good!

Let's focus on getting (1) done first. I can probably get some time to work on this over the next week, unless you or someone you know would be interested in putting together a PR.

from edward.

shousper avatar shousper commented on September 2, 2024

That would be fantastic! We're all pretty flat out over here, but I'll ask around 👍

from edward.

theothertomelliott avatar theothertomelliott commented on September 2, 2024

Would the "signal" here be referring to the initial signal sent, or the one sent after the "wait" period?

from edward.

shousper avatar shousper commented on September 2, 2024

Initial signal 👍

from edward.

theothertomelliott avatar theothertomelliott commented on September 2, 2024

One snag with setting the initial signal sent is that the runner is signaled rather than the service itself.

Edward starts a separate runner process that maintains the service process as a child. If the runner receives an interrupt, it will attempt to stop the service as appropriate to the backend being used.

For the command-line backend, this is currently SIGINT. For the Docker backend, this is a call to the Docker API to stop the container.

The wait period is applicable to all backends, the signal itself is not, so they'd need to be separate in the config.

I'm working on a change that will add a "terminationTimeout" option (default 30s) to service config and set the default signal for stopping command-line services to SIGTERM. Will upload as a PR and link here.

from edward.

theothertomelliott avatar theothertomelliott commented on September 2, 2024

I've uploaded a PR with a proposed implementation (see link above). I think the test might need some re-working, but it demonstrates the idea.

from edward.

shousper avatar shousper commented on September 2, 2024

Hi @theothertomelliott, I just checked out your branch now for some testing and this looks great 👍 Very happy with the new defaults and configuration field 🎉 Stoked with how fast you did this! Thanks

from edward.

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.