Created
August 29, 2012 03:42
-
-
Save michelp/3506585 to your computer and use it in GitHub Desktop.
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
| import logging | |
| import zmq.green as zmq | |
| from cliff.lister import Command | |
| from cPickle import loads, dumps | |
| class Kill(Command): | |
| log = logging.getLogger(__name__) | |
| def get_parser(self, prog_name): | |
| parser = Command.get_parser(self, prog_name) | |
| parser.add_argument('uuids', nargs='+') | |
| return parser | |
| def run(self, parsed_args): | |
| context = zmq.Context(1) | |
| socket = context.socket(zmq.REQ) | |
| socket.connect(self.app_args.control) | |
| socket.send_multipart(['kill', dumps(parsed_args.uuids)]) | |
| result = socket.recv() | |
| return loads(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment