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

Parameterized job running periodically - multiple running jobs #2382

Closed
wintergren opened this issue Mar 1, 2017 · 3 comments
Closed

Parameterized job running periodically - multiple running jobs #2382

wintergren opened this issue Mar 1, 2017 · 3 comments

Comments

@wintergren
Copy link

Nomad version

0.5.4

Issue

Not sure if it could be classified as an issue or works as by design. If by design how should we handle these situations?

I've created a parameterized job that will run periodically. The job takes backups of different backends, hence why I want it parameterized. This all works and I get a dispatched parameterized periodic job which does its job. However, I also get a separate periodic job which will always fail since it lacks the parameters expected by my script. How can we have the combination of parameterized and periodic but in these cases prevent the separate periodic job?

Here's part of nomad status output showing the issue:

consul-snapshot                                                   batch    50        dead
consul-snapshot/dispatch-1488361764-c786ed02                      batch    50        dead
consul-snapshot/dispatch-1488361764-c786ed02/periodic-1488361800  batch    50        dead
consul-snapshot/dispatch-1488361764-c786ed02/periodic-1488362400  batch    50        dead
consul-snapshot/dispatch-1488361764-c786ed02/periodic-1488363000  batch    50        dead
consul-snapshot/dispatch-1488373847-42a7fb74                      batch    50        dead
consul-snapshot/dispatch-1488373847-42a7fb74/periodic-1488374400  batch    50        dead
consul-snapshot/dispatch-1488373847-42a7fb74/periodic-1488375000  batch    50        dead
consul-snapshot/periodic-1488361800                               batch    50        dead
consul-snapshot/periodic-1488362400                               batch    50        dead
consul-snapshot/periodic-1488363000                               batch    50        dead
consul-snapshot/periodic-1488363600                               batch    50        dead
consul-snapshot/periodic-1488364200                               batch    50        dead
consul-snapshot/periodic-1488364800                               batch    50        dead
consul-snapshot/periodic-1488365400                               batch    50        dead

As you see these ones are ok consul-snapshot/dispatch-1488361764-c786ed02/periodic-1488361800
but then we get this consul-snapshot/periodic-1488361800 which we don't want. To be fair, we could do without the dispatched parameterized but not periodic job also: consul-snapshot/dispatch-1488361764-c786ed02

A side issue which I think has already been reported(?) is that all these batch jobs end up in dead state when completed.

Reproduction steps

  • Create a job file with both Parameterized and Periodic stanzas. (see example job file below)
  • nomad run jobfile
  • nomad job dispatch <-meta "">

Job file

job "consul-snapshot" {
        ...
        type = "batch"
        ...
        meta {
                <meta1> = ""
                <meta2> = ""
                <meta3> = ""
        }
        parameterized {
                payload = "optional"
                meta_required = ["meta1", "meta2"]
                meta_optional = ["meta3"]
        }
        periodic {
                // Run every 10 minutes
                cron = "*/10 * * * * *"
                prohibit_overlap = true
        }
        group "periodic_jobs" {
                count = 1
                restart {...}

                task "job" {
                        driver = "docker"
                        config {
                                image = ".."
                        }
                        env {
                                ...
                        }
                }
        }
}
@dadgar
Copy link
Contributor

dadgar commented Mar 1, 2017

Hey,

Gonna get this fix in 0.5.5 RC2. Have to say, this was a use case I never imagined when building this feature! So hats off on being creative!

-Alex Dadgar

@wintergren
Copy link
Author

Cheers @dadgar ! Hats off for fixing it so quick!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants