• Stars
    star
    197
  • Rank 197,722 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 10 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python client library for Mesos Marathon's REST API

marathon-python

Build Status

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

Compatibility

  • For Marathon 1.9.x and 1.10.x, use at least 0.13.0
  • For Marathon 1.6.x, use at least 0.10.0
  • For Marathon 1.4.1, use at least 0.8.13
  • For Marathon 1.1.1, use at least 0.8.1
  • For all version changes, please see CHANGELOG.md

If you find a feature that is broken, please submit a PR that adds a test for it so it will be fixed and will continue to stay fixed as Marathon changes over time.

Just because this library is tested against a specific version of Marathon, doesn't necessarily mean that it supports every feature and API Marathon provides.

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

Testing

marathon-python uses Travis to test the code against different versions of Marathon. You can run the tests locally on a Linux machine that has docker on it:

Running The Tests

make itests

Running The Tests Against a Specific Version of Marathon

MARATHONVERSION=v1.6.322 make itests

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

Basic Usage

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

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

>>> # or multiple servers:
>>> c = MarathonClient(['http://host1:8080', 'http://host2:8080'])

Then try calling some methods:

>>> c.list_apps()
[MarathonApp::myapp1, MarathonApp::myapp2]
>>> from marathon.models import MarathonApp
>>> c.create_app('myapp3', MarathonApp(cmd='sleep 100', mem=16, cpus=1))
MarathonApp::myapp3
>>> app = c.get_app('myapp3')
>>> app.ports
[19671]
>>> app.mem = 32
>>> c.update_app('myapp3', app)
{'deploymentId': '83b215a6-4e26-4e44-9333-5c385eda6438', 'version': '2014-08-26T07:37:50.462Z'}
>>> c.get_app('myapp3').mem
32.0
>>> c.get_app('myapp3').instances
1
>>> c.scale_app('myapp3', instances=3)
{'deploymentId': '611b89e3-99f2-4d8a-afe1-ec0b83fdbb88', 'version': '2014-08-26T07:40:20.121Z'}
>>> c.get_app('myapp3').instances
3
>>> c.scale_app('myapp3', delta=-1)
{'deploymentId': '1081a99c-55e8-4404-907b-4a3697059848', 'version': '2014-08-26T07:43:30.232Z'}
>>> 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')
[]

License

Open source under the MIT License. See LICENSE.

More Repositories

1

autoscale-python

Python library to manage autoscaling logic and actions
Python
73
star
2

cloudformation-jenkins

CloudFormation template for a Jenkins stack
Shell
69
star
3

cloudformation-mesos

[Moved] CloudFormation templates for a production-ready Mesos cluster
44
star
4

cloudformation-zookeeper

[Moved] CloudFormation template for an Exhibitor-managed ZooKeeper cluster
43
star
5

cloudformation-docker-registry

[Moved] CloudFormation template for a private Docker Registry (with S3+SSL+auth)
40
star
6

docker-zk-exhibitor

[Moved] Docker definition for an Exhibitor-managed ZooKeeper instance
Shell
20
star
7

Chromecast-Sharp

Hold all the Chromecast C# wrappers and example code.
C#
20
star
8

cloudformation-graphite

CloudFormation template for a persistent, self-healing Graphite+Grafana stack
Python
18
star
9

marathon-logger

Event logging service for Mesos Marathon
Python
15
star
10

AFNetworking-Sharp

Xamarin AFNetworking binding
C#
10
star
11

docker-jenkins-mesos

Docker definition for a Jenkins instance with the Mesos plugin installed
Shell
8
star
12

SocketRocket-Sharp

Xamarin SocketRocket binding
C#
8
star
13

docker-marathon

Docker definition for a Mesos Marathon instance
6
star
14

datastore

C#
6
star
15

libpd-sharp

Xamarin/iOS bindings for libpd
C#
6
star
16

docker-kestrel

Docker definition for a kestrel server
Shell
5
star
17

cloudformation-bamboo

CloudFormation template for a Bamboo stack (for use with Mesos+Marathon)
5
star
18

TheFactory.Snappy

A Snappy encoder/decoder for Xamarin / C#
C#
4
star
19

machine-images

[Moved] Packer definitions for various machine images
4
star
20

docker-java

Base Docker image with Java installed
Shell
2
star
21

docker-mesos

Base Docker image with Mesos installed
2
star
22

FBAudienceNetwork-Sharp

C#
1
star
23

TheFactory.FileSystem

PCL FileSystem abstraction
C#
1
star
24

docker-base

Base Debian docker image
Shell
1
star
25

docker-mesos-slave

Docker definition for a Mesos Slave instance
1
star
26

docker-bamboo

[Moved] Docker definition for a (Mesos/Marathon) Bamboo server
1
star
27

AndroidAsync-Sharp

Xamarin wrapper for https://github.com/koush/AndroidAsync
C#
1
star
28

docker-mesos-master

Docker definition for a Mesos Master instance
1
star
29

docker-nagios-plugins

Docker definition for a Nagios plugin executor
Shell
1
star
30

docker-statsd

Docker definition for a statsd server
Shell
1
star
31

cloudformation-kestrel

CloudFormation template for a Kestrel stack
1
star
32

docker-python

Base Docker image for Python apps
1
star