Skip to content

Instantly share code, notes, and snippets.

@tamirko
Last active August 11, 2016 09:35
Show Gist options
  • Save tamirko/68bbff63cf39cd80a3e0a047e67e2780 to your computer and use it in GitHub Desktop.
Save tamirko/68bbff63cf39cd80a3e0a047e67e2780 to your computer and use it in GitHub Desktop.
Kill deployment's executions
#!/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