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

Adding run_once functionality #57

Merged
merged 2 commits into from
Jul 16, 2015
Merged

Adding run_once functionality #57

merged 2 commits into from
Jul 16, 2015

Conversation

hdahme
Copy link
Contributor

@hdahme hdahme commented Jul 14, 2015

Adds the ability to lock a command to the calling process - with the optional limit that the command can only be run once an interval

Usage

To run the echo command once, across a cluster of servers, and to ensure that it's only run once every 60 seconds

consulate run_once -i 60 echo_hello 'echo hello'
>>> hello
consulate run_once -i 60 echo_hello 'echo hello'
>>> Last run happened fewer than 60 second ago. Exiting

This relies on using consulate's existing acquire_lock function as well as setting a lock with a unique name, such that subsequent executions can reference the last time the command was run

@hdahme
Copy link
Contributor Author

hdahme commented Jul 14, 2015

Closing #43 in favour of this

gmr added a commit that referenced this pull request Jul 16, 2015
Adding run_once functionality
@gmr gmr merged commit ce8efc6 into gmr:master Jul 16, 2015
@gmr
Copy link
Owner

gmr commented Jul 16, 2015

Looks good, I'll start prepping a new version soon so we can get this released.

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

Successfully merging this pull request may close these issues.

2 participants