项目作者: AVENTER-UG

项目描述 :
Python Libs to use Mesos via HTTP Rest API
高级语言: Python
项目地址: git://github.com/AVENTER-UG/python-avmesos.git
创建时间: 2020-12-10T18:20:34Z
项目社区:https://github.com/AVENTER-UG/python-avmesos

开源协议:Apache License 2.0

下载


Python mesos scheduler HTTP library

This is a Python library to create a Mesos scheduler.

It removes the need to use/install Mesos python bindings and makes use of the HTTP API (native bindings are not updated anymore with new features)

MesosClient is the main entrypoint that connects to the Mesos master. You can then register for callbacks on events.
On subscribe, you get a driver instance which you can use to send messages to master on current framework (kill, etc.)

MesosClient must be executed in a separate thread as it keeps a loop pooling connection with the master.

Submitted tasks should be in JSON format (according to mesos.proto).

See sample/test.py for example.

Callbacks will “block” the mesos message treatment, so they should be short, or messages should be forwarded to a queue in an other thread/process where longer tasks will handle messages.

DCOS EE Strict

Additions have been made to support login with ACS to allow access through to the master
in a Strict security posture. The sample/test.py script is configured to accept the SERVICE_SECRET environment variable, which can be created and passed to the
service using the script given below:

  1. dcos security org service-accounts keypair service-account-private.pem service-account-public.pem
  2. dcos security org service-accounts create -p service-account-public.pem -d "Service account for Scale data processing framework" service-account
  3. dcos security secrets create-sa-secret --strict service-account-private.pem service-account service-account-secret
  4. # Test with SUPERUSER perms on user
  5. dcos security org users grant service-account dcos:superuser full
  6. # Build image to test - update name in 2 commands below and marathon.json to your personal Docker Hub account name
  7. docker build -t gisjedi/python-mesos-http -f Dockerfile-test-framework .
  8. docker push gisjedi/python-mesos-http
  9. # Deploy app consuming image to marathon
  10. dcos marathon app add sample/marathon.json
  11. # Once success has been confirmed, more granular permissions should be applied
  12. dcos security org users revoke service-account dcos:superuser full
  13. dcos security org users grant service-account dcos:mesos:agent:task create
  14. dcos security org users grant service-account dcos:mesos:agent:task:app_id create
  15. dcos security org users grant service-account dcos:mesos:agent:task:user:nobody create
  16. dcos security org users grant service-account dcos:mesos:master:framework create
  17. dcos security org users grant service-account dcos:mesos:master:reservation create
  18. dcos security org users grant service-account dcos:mesos:master:reservation delete
  19. dcos security org users grant service-account dcos:mesos:master:reservation:principal:service_account delete
  20. dcos security org users grant service-account dcos:mesos:master:task create
  21. dcos security org users grant service-account dcos:mesos:master:task:app_id create
  22. dcos security org users grant service-account dcos:mesos:master:task:user:nobody create
  23. dcos security org users grant service-account dcos:mesos:master:volume create
  24. dcos security org users grant service-account dcos:mesos:master:volume delete
  25. dcos security org users grant service-account dcos:mesos:master:volume:principal:service_account delete

About

This library does not implement all options of mesos.proto and manages schedulers only (not executors). Implemented features should be enough to implement a scheduler, if something is missing, please ask, or contribute ;-)

Install

  1. pip install mesoshttp

Documentation

Documentation Status