This file contains 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
jon-mbp:~ jon$ curl -I http://python-distribute.org/distribute_setup.py | |
curl: (6) Could not resolve host: python-distribute.org; nodename nor servname provided, or not known | |
jon-mbp:~ jon$ nslookup python-distribute.org | |
Server: 4.2.2.2 | |
Address: 4.2.2.2#53 | |
** server can't find python-distribute.org: NXDOMAIN | |
This file contains 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
$ wget http://storage.core-os.net/coreos/amd64-generic/dev-channel/coreos_production_vagrant.box | |
--2013-09-17 21:13:08-- http://storage.core-os.net/coreos/amd64-generic/dev-channel/coreos_production_vagrant.box | |
Resolving storage.core-os.net... 74.125.29.128, 2607:f8b0:400d:c04::80 | |
Connecting to storage.core-os.net|74.125.29.128|:80... connected. | |
HTTP request sent, awaiting response... 200 OK | |
Length: 196079648 (187M) [application/vnd.previewsystems.box] | |
Saving to: ‘coreos_production_vagrant.box’ | |
0% [ ] 1,048,576 --.-K/s in 60s |
This file contains 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
# Show the information for the installed package, within the virtualenv. | |
(test)jon-mbp:tmp jon$ pip show --files diamond | |
--- | |
Name: diamond | |
Version: 3.3.437 | |
Location: /private/tmp/test/lib/python2.7/site-packages | |
Requires: ConfigObj, psutil | |
Files: | |
... snip ... |
This file contains 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
# | |
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you under the Apache License, Version 2.0 (the | |
# "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains 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 signal | |
def set_alarm(server): | |
def clean_shutdown(signum, frame): | |
for worker in server.workers: | |
logging.error("Terminating worker: {0}".format(worker)) | |
worker.terminate() | |
logging.error("Requesting server to stop()") | |
try: | |
server.stop() | |
except (KeyboardInterrupt, SystemExit): |
This file contains 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
server = TProcessPoolServer(processor, transport, tfactory, pfactory) | |
try: | |
server.serve() | |
finally: | |
server.stop() |
This file contains 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 signal | |
def set_signal_handlers(server): | |
def clean_shutdown(signum, frame): | |
logging.info("Signal received: {0}".format(signum)) | |
server.stop() | |
signal.signal(signal.SIGTERM, clean_shutdown) | |
signal.signal(signal.SIGINT, clean_shutdown) | |
server = TProcessPoolServer(processor, transport, tfactory, pfactory) |