Navigation

Meta

Maintainers

[![Build Status](http://drone.lensa.com:8000/api/badges/lensacom/satyr/status.svg)](http://drone.lensa.com:8000/lensacom/satyr)[![Join the chat at https://gitter.im/lensacom/satyr](https://badges.gitter.im/lensacom/satyr.svg)](https://gitter.im/lensacom/satyr?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

You can make your own scheduler built on QueueScheduler or for more complexneeds there's a [Scheduler](satyr/interface.py) interface which you can useto create one from scratch. (However in this case you'll have to implementsome of the functionalities already in [QueueScheduler](satyr/scheduler.py))

def on_update(self, driver, status): """You can hook on the events defined in the Scheduler interface.

They're just more conveniantly named methods for the basic mesos.interface functions but this is how you can add some custom logic to your framework in an easy manner. """ logging.info( "Status update received for task {}".format(status.task_id)) super(CustomScheduler, self).on_update(driver, status)

Also this way you can easily implement your own resource offer handling logic byoverriding the `on_offers(self, driver, offers)` method in which we give you ahelping hand with comparable Offers and TaskInfos (basic arithmetic operatorsare also overloaded).

The benefits of using bin-packing has been proven by[Netflix/Fenzo](https://github.com/Netflix/Fenzo) in[Heterogeneous Resource Scheduling Using Apache Mesos](http://events.linuxfoundation.org/sites/events/files/slides/Prezo-at-MesosCon2015-Final.pdf)

## Built in Task Types

### Command

The most basic task executes a simple command, Mesos will run CommandInfo'svalue with `/bin/sh -c`. Also, if you want to run your task in a Dockercontainer you can provide some additional information for the task.

[PythonTask](/satyr/messages.py) is capable of running arbitrary python code onyour cluster. It sends [cloudpickled](https://github.com/cloudpipe/cloudpickle)methods and arguments to the matched mesos-slave for execution.Note that python tasks run in [lensa/satyr](https://hub.docker.com/r/lensa/satyr/)Docker container by default.

```pythonfrom satyr.messages import PythonTask

# You can pass a function or a lambda in place of sum for fn.task = PythonTask(name='python-task', fn=sum, args=[range(5)])```

## Custom Task

Customs tasks can be written by extending [TaskInfo](/satyr/proxies/messages.py)or any existing descendants.If you're walking down the former path you'll most likely have to deal withprotobuf in your code; worry not, we have some magic wrappers for you to providecustomizable messages.