Latency and fault tolerance for distributed systems
Wiliam Souza 9876b39980 Merge pull request #1 from wiliamsouza/feature/metrics | 5 gadi atpakaļ | |
---|---|---|
docs | 9 gadi atpakaļ | |
hystrix | 9 gadi atpakaļ | |
tests | 6 gadi atpakaļ | |
.coveragerc | 9 gadi atpakaļ | |
.gitignore | 9 gadi atpakaļ | |
.travis.yml | 6 gadi atpakaļ | |
AUTHORS | 9 gadi atpakaļ | |
CHANGES.md | 9 gadi atpakaļ | |
LICENSE | 9 gadi atpakaļ | |
MANIFEST.in | 9 gadi atpakaļ | |
Makefile | 9 gadi atpakaļ | |
README.md | 9 gadi atpakaļ | |
repos.sh | 10 gadi atpakaļ | |
setup.cfg | 10 gadi atpakaļ | |
setup.py | 6 gadi atpakaļ | |
tox.ini | 6 gadi atpakaļ |
A Netflix Hystrix port to Python.
This is a work in progress, please feel free to help!
For more information see the Netflix Hystrix Wiki documentation.
To know more see the Netflix Hystrix Wiki How it works section documentation.
It's ALPHA version and only support launching a group of commands inside an executor pool.
It depends on concurrent.futures, new in Python version 3.2 and enum, new in Python version 3.4. It uses futures and enum34 backports to run in Python version 2.7, 3.3 and 3.4.
Create a virtualenv:
mkproject --python=<fullpath_to_python_3.2+> hystrix-py
Get the code:
git clone https://github.com/wiliamsouza/hystrix-py .
Install it:
python setup.py develop
The last command enter your code in "Development Mode" it creates an
egg-link
in your virtualenv's site-packages
making it available
on this environment sys.path
. For more info see setuptools development-mode
setup.py
will handle test dependencies, to install development use:
pip install -e .[dev]
python setup.py test
Code to be isolated is wrapped inside the run()
method of a hystrix.Command
similar to the following:
from hystrix import Command
class HelloWorldCommand(Command):
def run(self):
return 'Hello World'
This command could be used like this:
command = HelloCommand()
# synchronously
print(command.execute())
'Hello World'
# asynchronously
future = command.queue()
print(future.result())
'Hello Wold'
# callback
def print_result(future)
print(future.result())
future = command.observe()
future.add_done_callback(print_result)
Copyright 2015 Hystrix Python Authors.
Licensed 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
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.