Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mentos integration #54

Merged
merged 29 commits into from
Mar 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
34b3725
Added support for unified containerizer; updated drone configuration
kszucs Sep 7, 2016
d73b896
Removed garbage test file
kszucs Sep 8, 2016
dec6e91
Small refactoring
kszucs Sep 12, 2016
9937f61
Changed SerializableMixin in Queue to use __reduce__
kszucs Sep 12, 2016
8aff59d
Changed logging level to error in drone service containers
kszucs Sep 12, 2016
63c8f27
Docker-registry log level to error
kszucs Sep 12, 2016
98e0296
Increased resources for mesos-slave-1
kszucs Sep 12, 2016
c23672b
Increased timeout for a futures test
kszucs Sep 12, 2016
fbac88f
Increased timeout for a multiprocessing test
kszucs Sep 12, 2016
6bee8da
New drone signed yml
kszucs Sep 12, 2016
99ee0ae
PythonExecutor is now a standalone message
kszucs Sep 13, 2016
2958e11
CI fixes
kszucs Sep 13, 2016
621c397
Fixed imports in satyr.__init__
kszucs Sep 13, 2016
eb1356e
Changed dockerfile to deban+miniconda+mesos
kszucs Sep 15, 2016
a2eb166
Avoid whiteout files in dockerfile
kszucs Sep 15, 2016
e338787
Honor slave attributes as contrsaints, fixes #47
kszucs Sep 16, 2016
0c9dcd4
Fixed QueueScheduler arguments
kszucs Sep 19, 2016
c945fe5
using malefico as driver
Dec 31, 2016
d4ad986
Magic
Jan 18, 2017
dda7260
temp
Jan 26, 2017
9024366
Ehm base passing
Feb 1, 2017
5a312a9
added json test
Feb 1, 2017
f2ae217
refactor #1
Feb 2, 2017
4d236f9
test suite passes
Feb 3, 2017
5f9faac
added ports defaults
Feb 3, 2017
b1045a2
preparing for pull request
Feb 6, 2017
e8a9fa1
some more progress
Feb 8, 2017
3d5e9eb
need a redo
Feb 28, 2017
67de2be
Merge branch 'master' into mentos
kszucs Mar 10, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .drone.sec

This file was deleted.

97 changes: 0 additions & 97 deletions .drone.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
__pycache__/
*.py[cod]
*$py.class

.idea/
.vscode/
# C extensions
*.so

Expand Down
28 changes: 0 additions & 28 deletions .pre-commit-config.yaml

This file was deleted.

61 changes: 61 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
language: python
dist: trusty
sudo: required
notifications:
email: false
services:
- docker
matrix:
include:
- python: '2.7'
env: OS=ubuntu-14.04
- python: '3.5'
env: OS=ubuntu-14.04
- python: '3.6'
env: OS=ubuntu-14.04
env:
global:
- DOCKER_COMPOSE_VERSION=1.6.2
before_install:
- pwd
- bash ci/scripts/travis_docker_setup.sh
- docker version
- docker-compose version
- export DOCKER_IP=127.0.0.1
- docker-compose up -d
- docker ps -a
- docker images
- sudo apt-get install pandoc
- pip install pypandoc
install:
- which python
script:
- python setup.py test
after_success:
- pip install coveralls
- coveralls
before_deploy:
- pip install pypandoc
deploy:
- provider: pypi
distributions: "sdist bdist_wheel"
server: https://testpypi.python.org/pypi
user: daskos
password:
secure: K7Ic/pSDVhqY63iSatOpXig77WnMhIiRgU+zZKhAJHxwGFAbq4b4QfIxD8xKR4GwLm/vGpX285cKp1nuleAwLRj4GpOmVU2o1exZHO0HNFTpSsb9fb+lYWQIFB9WFdueiv/V0WmxR6sR2+iDGCy2itTg5pNuu2POr0olJga3ixsoS1EaxRQW4DOXciblTHBRZIPNQVMi823iacq7ovvJ/ZmSBDf6KOEbouqGSMYsbgywFRpqnTKDMYgU60Mov/ATkXNMkUye6ffIKJbr/UhhVgpnkhcRBAa0Hx2/BfA23CokiBFAusH3p8Ko8BMfUCnkZ8pJw2SJ/kXqeMn+SLMX6YqsAIYQSRE33mDtDJkK5XHP/MY3/soO3M+fPGtz3vIUmPB6ycH8INw+R0FUKnblGgRoNbmGF+MbrfnRXe5Qo09dUil859ySbIYfkYkadBbtn7MNEtbp6anaAJgYnBAQkWimT+uslEKM1AVqKQ/MvW+xBzmOkz3oZIFQsqkQS4O0vT/SlH2V1GMDfXG/R8heozMYNWSCLZM4PfocZY0GZIL1qEJV+z0Q3DwwqghHZ/2v+MR35r7iTPPd0Wf+LfK762IplM4/Va+nQ8DCbI5ZF7fO5OUUCgpZpaEGKLb8yHJqfiwZ42qzVtkJkobeyBkzyQmBzxe/zBE9US8cD7R0O6E=
on:
branch: master
tags: false
condition: $TRAVIS_PYTHON_VERSION = "2.7"
- provider: pypi
distributions: "sdist bdist_wheel"
user: daskos
password:
secure: K7Ic/pSDVhqY63iSatOpXig77WnMhIiRgU+zZKhAJHxwGFAbq4b4QfIxD8xKR4GwLm/vGpX285cKp1nuleAwLRj4GpOmVU2o1exZHO0HNFTpSsb9fb+lYWQIFB9WFdueiv/V0WmxR6sR2+iDGCy2itTg5pNuu2POr0olJga3ixsoS1EaxRQW4DOXciblTHBRZIPNQVMi823iacq7ovvJ/ZmSBDf6KOEbouqGSMYsbgywFRpqnTKDMYgU60Mov/ATkXNMkUye6ffIKJbr/UhhVgpnkhcRBAa0Hx2/BfA23CokiBFAusH3p8Ko8BMfUCnkZ8pJw2SJ/kXqeMn+SLMX6YqsAIYQSRE33mDtDJkK5XHP/MY3/soO3M+fPGtz3vIUmPB6ycH8INw+R0FUKnblGgRoNbmGF+MbrfnRXe5Qo09dUil859ySbIYfkYkadBbtn7MNEtbp6anaAJgYnBAQkWimT+uslEKM1AVqKQ/MvW+xBzmOkz3oZIFQsqkQS4O0vT/SlH2V1GMDfXG/R8heozMYNWSCLZM4PfocZY0GZIL1qEJV+z0Q3DwwqghHZ/2v+MR35r7iTPPd0Wf+LfK762IplM4/Va+nQ8DCbI5ZF7fO5OUUCgpZpaEGKLb8yHJqfiwZ42qzVtkJkobeyBkzyQmBzxe/zBE9US8cD7R0O6E=
on:
tags: true
repo: daskos/mentor
condition: $TRAVIS_PYTHON_VERSION = "2.7"



8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM lensa/mesos-python:0.27.0-py2.7-python-2.7
FROM python:3.5.2-alpine

ADD . /satyr
WORKDIR /satyr
RUN pip install .
ADD . /mentor
WORKDIR /mentor
RUN pip install .
17 changes: 17 additions & 0 deletions ci/scripts/travis_docker_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -e
set -x

# Update package for ubuntu
sudo apt-get -qq update
sudo apt-get install -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" docker-engine

# Start service
sudo service docker stop
sudo service docker start

# Setup/update docker compose
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
21 changes: 0 additions & 21 deletions conftest.py

This file was deleted.

70 changes: 70 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: '2'
services:
zookeeper:
network_mode: "host"
image: bobrik/zookeeper:latest
environment:
- ZK_CONFIG=tickTime=2000,initLimit=10,syncLimit=5,maxClientCnxns=128,forceSync=no,clientPort=2181
- ZK_ID=1
mesos_master_0:
network_mode: "host"
image: mesosphere/mesos-master:1.1.0-2.0.107.ubuntu1404
environment:
- MESOS_LOGGING_LEVEL=ERROR
- MESOS_IP=127.0.0.1
- MESOS_HOSTNAME=localhost
- MESOS_ZK=zk://127.0.0.1:2181/mesos
- MESOS_QUORUM=1
- MESOS_CLUSTER=test
- MESOS_REGISTRY=in_memory
restart: "always"
mesos_master_1:
network_mode: "host"
image: mesosphere/mesos-master:1.1.0-2.0.107.ubuntu1404
environment:
- MESOS_LOGGING_LEVEL=ERROR
- MESOS_IP=127.0.0.1
- MESOS_HOSTNAME=localhost
- MESOS_ZK=zk://127.0.0.1:2181/mesos
- MESOS_QUORUM=1
- MESOS_CLUSTER=test
- MESOS_REGISTRY=in_memory
- MESOS_PORT=6060
restart: "always"
mesos_slave_0:
network_mode: "host"
image: mesosphere/mesos-slave:1.1.0-2.0.107.ubuntu1404
environment:
- MESOS_LOGGING_LEVEL=ERROR
- MESOS_IP=127.0.0.1
- MESOS_MASTER=zk://127.0.0.1:2181/mesos
- MESOS_CONTAINERIZERS=mesos
- MESOS_IMAGE_PROVIDERS=docker
- MESOS_ISOLATION=cgroups/cpu,cgroups/mem,docker/runtime
# - MESOS_DOCKER_REGISTRY=http://localhost:5000
- MESOS_PORT=5052
- MESOS_RESOURCES=cpus(*):0.5;mem(*):1024;ports(*):[11000-11999]
- MESOS_WORK_DIR=/tmp/mesos1
- MESOS_ATTRIBUTES=mentos:true
## To speed up provisioning images, default is copy
# MESOS_IMAGE_PROVISIONER_BACKEND=aufs
## To enable docker containerizer too`
- MESOS_CONTAINERIZERS=mesos,docker
- MESOS_SWITCH_USER=0
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
# ## To cache docker downloaded images
- /tmp/mesos/store/docker:/tmp/mesos/store/docker
# ## To enable docker containerizer
- /usr/bin/docker:/usr/local/bin/docker
- /var/run/docker.sock:/var/run/docker.sock
- /cgroup:/cgroup
- /sys:/sys

privileged: true
# marathon:
# network_mode: "host"
# image: mesosphere/marathon:v1.3.7
# command: --master zk://localhost:2181/mesos --zk zk://localhost:2181/marathon
# restart: "always"
#
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'satyr', u'Satyr Documentation',
(master_doc, 'mentor', u'Satyr Documentation',
[author], 1)
]

Expand Down
41 changes: 41 additions & 0 deletions examples/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

from mentor.scheduler import Framework
from mentos.scheduler import SchedulerDriver
import os
import getpass
from mentor.messages.base import TaskID, Disk, Cpus, Mem, TaskInfo, CommandInfo, Environment

sched = Framework()
driver = SchedulerDriver(sched, "Queue", getpass.getuser())

driver.start()

from mentor.messages.satyr import PythonTask
import sys
executor = {
"executor_id": {
"value": "MinimalExecutor"
},
"name": "MinimalExecutor",
"command": {
"value": '%s %s' % (
sys.executable, "~/workdir/mesos/malefico/malefico/executor.py"
)

}

}


task = TaskInfo(name='command-task', command=CommandInfo(value='echo $HOME'), resources=[Cpus(0.1), Mem(128), Disk(0)])
# task = PythonTask(task_id=TaskID(value='test-task-id'), executor=executor,
# fn=sum, args=[range(5)],
# resources=[Cpus(0.1), Mem(128), Disk(0)])
sched.submit(task)
sched.wait()
print("Clean Exit, I guess")


task_infos = [{'task_id': {'value': '39e762f5-9767-4d7d-b187-67029df5b151'}, 'agent_id': {'value': '7037ef03-cbef-4e11-aac6-d662a5ef4179-S1'}, 'name': 'task 39e762f5-9767-4d7d-b187-67029df5b151', 'executor': {'executor_id': {'value': 'MinimalExecutor'}, 'name': 'MinimalExecutor', 'command': {'value': '/opt/anaconda3/envs/mentos/bin/python /home/arti/workdir/mesos/dmentos/examples/executor.py'}, 'resources': [{'name': 'mem', 'type': 'SCALAR', 'scalar': {'value': 32}}, {'name': 'cpus', 'type': 'SCALAR', 'scalar': {'value': 0.1}}]}, 'data': 'SGVsbG8gZnJvbSB0YXNrIDM5ZTc2MmY1LTk3NjctNGQ3ZC1iMTg3LTY3MDI5ZGY1YjE1MSE=', 'resources': [{'name': 'cpus', 'type': 'SCALAR', 'scalar': {'value': 0.2}}, {'name': 'mem', 'type': 'SCALAR', 'scalar': {'value': 128}}]}]
offers = [{'agent_id': {'value': '7037ef03-cbef-4e11-aac6-d662a5ef4179-S0'}, 'framework_id': {'value': '4dca24e0-63bf-4505-8023-f544de0842d6-0001'}, 'hostname': 'malefico.io', 'id': {'value': '4dca24e0-63bf-4505-8023-f544de0842d6-O2'}, 'resources': [{'name': 'ports', 'ranges': {'range': [{'begin': 1025, 'end': 60000}]}, 'role': '*', 'type': 'RANGES'}, {'name': 'cpus', 'role': '*', 'scalar': {'value': 7.9}, 'type': 'SCALAR'}, {'name': 'mem', 'role': '*', 'scalar': {'value': 14895.0}, 'type': 'SCALAR'}, {'name': 'disk', 'role': '*', 'scalar': {'value': 145941.0}, 'type': 'SCALAR'}], 'url': {'address': {'hostname': 'malefico.io', 'ip': '127.0.0.1', 'port': 5051}, 'path': '/slave(1)', 'scheme': 'http'}}, {'agent_id': {'value': '7037ef03-cbef-4e11-aac6-d662a5ef4179-S1'}, 'attributes': [{'name': 'mentos', 'text': {'value': 'true'}, 'type': 'TEXT'}], 'framework_id': {'value': '4dca24e0-63bf-4505-8023-f544de0842d6-0001'}, 'hostname': 'malefico.io', 'id': {'value': '4dca24e0-63bf-4505-8023-f544de0842d6-O3'}, 'resources': [{'name': 'cpus', 'role': '*', 'scalar': {'value': 0.5}, 'type': 'SCALAR'}, {'name': 'mem', 'role': '*', 'scalar': {'value': 1024.0}, 'type': 'SCALAR'}, {'name': 'ports', 'ranges': {'range': [{'begin': 11000, 'end': 11999}]}, 'role': '*', 'type': 'RANGES'}, {'name': 'disk', 'role': '*', 'scalar': {'value': 5114.0}, 'type': 'SCALAR'}], 'url': {'address': {'hostname': 'malefico.io', 'ip': '127.0.0.1', 'port': 5052}, 'path': '/slave(1)', 'scheme': 'http'}}]

Empty file added examples/testmessage.py
Empty file.
12 changes: 7 additions & 5 deletions mentor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

import pkg_resources as _pkg_resources

from .scheduler import QueueScheduler
from .executor import OneOffExecutor
from .messages import PythonTask, PythonTaskStatus # important to register classes

from .scheduler import QueueScheduler, SchedulerDriver
from .executor import ThreadExecutor, ProcessExecutor, ExecutorDriver
from .messages import PythonTask, PythonTaskStatus

__version__ = _pkg_resources.get_distribution('mentor').version

__all__ = ('QueueScheduler',
'OneOffExecutor',
'SchedulerDriver',
'ExecutorDriver',
'ThreadExecutor',
'ProcessExecutor',
'PythonTask',
'PythonTaskStatus')
Loading