Last active
August 11, 2016 09:35
-
-
Save tamirko/68bbff63cf39cd80a3e0a047e67e2780 to your computer and use it in GitHub Desktop.
Kill deployment's executions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Run this first source /opt/mgmtworker/env/bin/activate | |
import sys | |
from cloudify_rest_client import CloudifyClient | |
from cloudify_rest_client.executions import Execution | |
client = CloudifyClient('localhost') | |
deployment_id = sys.argv[1] | |
print 'Canceling bad executions for deployment {0}'.format(deployment_id) | |
for execution in client.executions.list(deployment_id=deployment_id): | |
if execution.status not in Execution.END_STATES: | |
print 'Updating execution {0} to state {1}'.format(execution.id, Execution.CANCELLED) | |
client.executions.update(execution.id, Execution.CANCELLED) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment