Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a job to be configured with multiple watches #518

Open
Smithx10 opened this issue Oct 15, 2017 · 2 comments
Open

Allow a job to be configured with multiple watches #518

Smithx10 opened this issue Oct 15, 2017 · 2 comments

Comments

@Smithx10
Copy link

While using Containerpilot I ran into the situation where I wanted 1 job to respond to multiple watches.

This is what I ended up doing:

  jobs: [
    {
      name: "update-haproxy-http",
      exec: "reload",
      when: {
        source: "watch.l7-http",
        each: "changed"
      }
    },
    {
      name: "update-haproxy-https",
      exec: "reload",
      when: {
        source: "watch.l7-http2",
        each: "changed"
      }
    },

This is the type of functionality I wanted:

  jobs: [
    {
      name: "update-haproxy-http",
      exec: "reload",
      when: {
        source: [ "watch.l7-http", "watch.l7-http2" ],
        each: "changed"
      }
    }

While attempting to use the functionality I wanted I received, It said that source required a string. You can see that here:

// WhenConfig determines when a Job runs (dependencies on other Jobs,
// Watches, or frequency timers)
type WhenConfig struct {
	Frequency string `mapstructure:"interval"`
	Source    string `mapstructure:"source"`
	Once      string `mapstructure:"once"`
	Each      string `mapstructure:"each"`
	Timeout   string `mapstructure:"timeout"`
}

https://github.com/joyent/containerpilot/blob/master/jobs/config.go#L61

@jwreagor jwreagor changed the title 1 Job, Multiple Watches Allow a job to be configured with multiple watches Oct 15, 2017
@jwreagor
Copy link
Contributor

Appreciate the feature request Bruce. Off the bat, I'm not sure why this wasn't considered before as it seems to make perfect sense. Nothing comes up when I'm searching through potential issues. It's possible @misterbisson might remember something about configuring multiple watches on a job.

In any case, we're planning to visit watches again with #506. That might be a good time to consider this as well.

@misterbisson
Copy link
Contributor

There was some discussion, though it may not have been captured in the design docs, about the challenges of supporting multiple watches vs also being able to merge config files and have some config settings replace or override those in prior files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants