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

Scheduling job with a dependency on another job #545

Open
jason-riddle opened this issue Dec 8, 2015 · 15 comments
Open

Scheduling job with a dependency on another job #545

jason-riddle opened this issue Dec 8, 2015 · 15 comments

Comments

@jason-riddle
Copy link

Is it possible to schedule a job only after another job is successful scheduled? A use case for example, would be to use one docker container to provide a REST API (https://github.com/begriffs/postgrest) for another docker container (postgres), but the REST API docker container should only come up once the database container is up and passed it's health check.

@dadgar
Copy link
Contributor

dadgar commented Dec 8, 2015

Hey! Nomad currently does not have a way to express job dependencies but it is something on our roadmap. From your description it sounds like you need dependencies between tasks/task groups not jobs. A job would only be finished once all the task groups are dead. If you look at issue #419 I think it captures this issue, so I am going to mark as closed.

@dadgar dadgar closed this as completed Dec 8, 2015
@zapman449
Copy link

I believe this should be re-opened.

Here's a use-case: I want to run hashicorp vault and docker-registry from within nomad. The other containers will need these to be available before they can start, but #419 argues for pushing all my apps into a single job.

Granted, this is less obvious for vault, but our private registry is foundational for everything.

@suslovsergey
Copy link

Any news?

@aaronhurt
Copy link

Similar use case here. We would like to be sure that things like our OAuth service, auditing service, etc.. are started and listed as dependencies before other backend applications start.

@DhashS
Copy link

DhashS commented Apr 15, 2019

Different use case here!

I'd like to have some control around precendence order in which my networking, services, and templates fire off. The suggestion of job-dependencies is limiting, unless there's some funky n-pass evaluation stuff, and execution in the same container.

My use case provisions container environment variables and config files based on the services running and registered with consul. Without a strict happens-before ordering, i get a non-deterministic template.

@scalp42
Copy link
Contributor

scalp42 commented Feb 8, 2020

See #419 for the same kind of issue.

@pznamensky
Copy link

It's quite obvious feature for the orchestrator, and at the moment, it's one of the most desired functionality for us.
I still hope it would be implemented in Nomad.

@hashicorp hashicorp locked as spam and limited conversation to collaborators Aug 1, 2022
@hashicorp hashicorp deleted a comment from idenkov Aug 1, 2022
@hashicorp hashicorp deleted a comment from olgeni Aug 1, 2022
@hashicorp hashicorp deleted a comment from kirill-shtrykov Aug 1, 2022
@hashicorp hashicorp deleted a comment from RootMePLS Aug 1, 2022
@hashicorp hashicorp unlocked this conversation Jun 28, 2023
@116davinder
Copy link

I believe, dependencies can be defined like this in nomad job spec.

# job spec example
dependency 1 {
  provider = consul/nomad/etc.
  check = wait for consul/nomad service / nomad-status to become health
    pattern = nomad/job/group/task [ if nomad service, here i want to see, if nomad can check if nomad service is up or not]
    pattern = name-of-consul-service [ if consul service, here i want to see, if nomad can check if consul service is up or not ]
    pattern = nomad/job/group/task-name [ if nomad-status, here, I want to see, what nomad know about the task, whether its up or not]

  interval = 10s
  retry = 100
  delay = 15s
}
dependency 2 {
  provider = consul/nomad/etc.
  check = wait for consul/nomad service / nomad-status to become health
    pattern = nomad/job/group/task [ if nomad service, here i want to see, if nomad can check if nomad service is up or not]
    pattern = name-of-consul-service [ if consul service, here i want to see, if nomad can check if consul service is up or not ]
    pattern = nomad/job/group/task-name [ if nomad-status, here, I want to see, what nomad know about the task/group/job, whether its up or not]

  interval = 10s
  retry = 100
  delay = 15s
}

@richard-tns
Copy link

I believe, dependencies can be defined like this in nomad job spec.

# job spec example
dependency 1 {
  provider = consul/nomad/etc.
  check = wait for consul/nomad service / nomad-status to become health
    pattern = nomad/job/group/task [ if nomad service, here i want to see, if nomad can check if nomad service is up or not]
    pattern = name-of-consul-service [ if consul service, here i want to see, if nomad can check if consul service is up or not ]
    pattern = nomad/job/group/task-name [ if nomad-status, here, I want to see, what nomad know about the task, whether its up or not]

  interval = 10s
  retry = 100
  delay = 15s
}
dependency 2 {
  provider = consul/nomad/etc.
  check = wait for consul/nomad service / nomad-status to become health
    pattern = nomad/job/group/task [ if nomad service, here i want to see, if nomad can check if nomad service is up or not]
    pattern = name-of-consul-service [ if consul service, here i want to see, if nomad can check if consul service is up or not ]
    pattern = nomad/job/group/task-name [ if nomad-status, here, I want to see, what nomad know about the task/group/job, whether its up or not]

  interval = 10s
  retry = 100
  delay = 15s
}

This is incorrect and is just the proposal in #19291

There is still no method to schedule dependencies between jobs

@DhashS
Copy link

DhashS commented Jul 22, 2024

I ended up using terraform for this. nomad_job and consul_health_check’s work together as a pair to make a job node that can be depended on for separate dependency nodes

@Material-Scientist
Copy link

Still nothing?

@HeinXavierSwart
Copy link

This issue has been open for nearly 10 years.

@jrasell
Copy link
Member

jrasell commented Feb 13, 2025

Hi @Material-Scientist and @HeinXavierSwart, unfortunately you're both right in that this has not been assigned to an engineer for research. When this happens, the issue will become assigned and an update posted here but I cannot provide any timeline on that currently.

@idenkov
Copy link

idenkov commented Feb 13, 2025

This issue has been open for nearly 10 years.

I do not think anything will happen on that front, especially after IBM trying to acquire them, but even before that seems to me they have shifted their focus on other areas and not in the development of software.

So unless someone implement that feature and makes PR, we can't and shouldn't expect Hashicorp to implement it.
But given what they were doing past 1-2 years best course of action will be to do what everyone else is doing - move away from their products.

@jrasell
Copy link
Member

jrasell commented Feb 13, 2025

Hi @idenkov; please keep comments related to the issue as described with details of expected user experience that might help any future development effort.

shifted their focus on other areas and not in the development of software

I'd invite you to take a look at the Nomad changelog, commit history, or similar to see that this is incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Roadmapping
Development

No branches or pull requests