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

named locks #249

Closed
BrianHicks opened this issue Sep 13, 2016 · 7 comments · Fixed by #392
Closed

named locks #249

BrianHicks opened this issue Sep 13, 2016 · 7 comments · Fixed by #392
Assignees
Milestone

Comments

@BrianHicks
Copy link
Contributor

A named lock would be nice for doing things that affect the whole system, but which Converge currently does in parallel. (Like package management using apk on Alpine)

@BrianHicks
Copy link
Contributor Author

Maybe syntax:

task "x" {
  check = "..."
  apply = "..."
  lock = ["name1", "name2"]
}

Or should the lock be a global node of some kind?

@ryane
Copy link
Contributor

ryane commented Sep 13, 2016

for certain tasks (package installs like you mentioned), should it be implicit based on the resource type? we might be able to also speed things up by batching into a single transaction.

I kind of asked about this over on the wiki: https://github.com/asteris-llc/converge/wiki/Sample-Elasticsearch-Filebeat-Kibana. Repeating here:

# yum / rpm shell tasks are vulnerable to conflicts (due to yum locks). You will
# see a lot of this in the output:

# ...
# Existing lock /var/run/yum.pid: another copy is running as pid 11771.
# Another app is currently holding the yum lock; waiting for it to exit...
# ...

# yum is smart enough to wait for each individual install to complete and
# converge (so far) eventually is able to install all packages without
# erroring out. But, when we build a package module, we'll probably want to
# handle this so it is more efficient (batch up yum installs in a single
# transaction?). should this (module-specific implicit dependencies/batching) be
# part of the core graph engine?

@BrianHicks
Copy link
Contributor Author

I think yes, in the long term we can batch things like that. Package
management especially is prone to some rather simple graph
transformations to make things much nicer at execution time. I’m
suggesting locks as a solution for tasks, our “escape hatch” (but
both might work!)

On 13 Sep 2016, at 18:33, Ryan Eschinger wrote:

for certain tasks (package installs like you mentioned), should it be
implicit based on the resource type? we might be able to also speed
things up by batching into a single transaction.

I kind of asked about this over on the wiki:
https://github.com/asteris-llc/converge/wiki/Sample-Elasticsearch-Filebeat-Kibana.
Repeating here:

# yum / rpm shell tasks are vulnerable to conflicts (due to yum 
locks). You will
# see a lot of this in the output:

# ...
# Existing lock /var/run/yum.pid: another copy is running as pid 
11771.
# Another app is currently holding the yum lock; waiting for it to 
exit...
# ...

# yum is smart enough to wait for each individual install to complete 
and
# converge (so far) eventually is able to install all packages without
# erroring out. But, when we build a package module, we'll probably 
want to
# handle this so it is more efficient (batch up yum installs in a 
single
# transaction?). should this (module-specific implicit 
dependencies/batching) be
# part of the core graph engine?

You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#249 (comment)

@BrianHicks BrianHicks added this to the 0.3 milestone Sep 19, 2016
@BrianHicks
Copy link
Contributor Author

Let's let the implementor worry about exactly how to implement this and change the issues tags around to reflect it's ready. I'd like whoever does this to prefer to store the data in the graph somehow (generated dependencies) if possible. Otherwise, a named mutex probably will work just fine.

@sehqlr
Copy link
Contributor

sehqlr commented Sep 27, 2016

Could we have the lock be a resource type?

lock "yum" {
  // config on lock
}

task "install nginx" {
  check = ".."
  apply = ".."
  depends = ["lock.yum"]
}

@BrianHicks
Copy link
Contributor Author

It would probably have to be inside the task, since the goal is to synchronize across multiple modules.

@ryane ryane self-assigned this Oct 6, 2016
This was referenced Oct 14, 2016
@ryane
Copy link
Contributor

ryane commented Oct 18, 2016

now known as "group" - see #392

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

Successfully merging a pull request may close this issue.

3 participants