Skip to content

dockerera/marathon-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marathon-python

This is a Python library for interfacing with Marathon servers via Marathon's REST API.

Compatibility

Installation

From PyPi (recommended)

pip install marathon

From GitHub

pip install -e [email protected]:thefactory/marathon-python.git#egg=marathon

From source

git clone [email protected]:thefactory/marathon-python
python marathon-python/setup.py install

Basic Usage

Create a MarathonClient() instance pointing at your Marathon server:

>>> from marathon import MarathonClient
>>> c = MarathonClient("http://localhost:8080")

Then try calling some methods:

>>> c.list_apps()
[MarathonApp::myapp1, MarathonApp::myapp2]
>>> c.create_app(id='myapp3', cmd='sleep 100', mem=16, cpus=1)
True
>>> app = c.get_app('myapp3')
>>> app.ports
[19671]
>>> c.update_app('myapp3', app, mem=32)
True
>>> c.get_app('myapp3').mem
32.0
>>> c.get_app('myapp3').instances
1
>>> c.scale_app('myapp3', 2)
True
>>> c.get_app('myapp3').instances
3
>>> c.scale_app('myapp3', delta=-1)
True
>>> c.get_app('myapp3').instances
2
>>> c.list_tasks('myapp1')
[MarathonTask:myapp1-1398201790254]
>>> c.kill_tasks('myapp1', scale=True)
[MarathonTask:myapp1-1398201790254]
>>> c.list_tasks('myapp1')
[]

Documentation

API documentation is here.

Or you can build the documentation yourself:

pip install sphinx
pip install sphinx_rtd_theme
cd docs/
make html

The documentation will be in <project-root>/gh-pages/html:

open gh-pages/html/index.html

License

Open source under the MIT License. See LICENSE.

About

Python client library for Mesos Marathon's REST API

Resources

License

Stars

Watchers

Forks

Packages

No packages published