mesos_api package

Submodules

mesos_api.api module

class mesos_api.api.HardwareResources(cpus=0.0, mem=0.0, disk=0.0)

Bases: object

Represents hardware resource metrics for a host.

Parameters:
  • cpus (float) – The number of processing units.
  • mem (float) – The amount of memory in MiB.
  • disk (float) – The amount of disk space in MiB.
to_dict()

Converts this object to a dictionary representation.

Returns:All of the object attributes formatted as a dictionary.
Return type:dict
exception mesos_api.api.MesosError

Bases: exceptions.Exception

Error when there is a problem fetching results from the Mesos REST API

class mesos_api.api.SlaveInfo(hostname=None, port=0, total=None, scheduled=None, used=None, slave_id=None)

Bases: object

Represents information about a host system.

Parameters:
to_dict()

Converts this object to a dictionary representation.

Returns:All of the object attributes formatted as a dictionary.
Return type:dict

mesos_api.apps module

class mesos_api.apps.MesosConfig(app_name, app_module)

Bases: django.apps.config.AppConfig

Configuration for the mesos_api app

label = u'mesos_api'
name = u'mesos_api'
verbose_name = u'Mesos API'

mesos_api.offers module

Defines the functions for generating Mesos tasks

mesos_api.offers.from_mesos_offer(mesos_offer)

Creates a dot accessible offer from input dict

Parameters:mesos_offer (mesoshttp.offers.Offer) – Offer object to translate into dot accessible object
Returns:Dot accessible object
Return type:Namespace

mesos_api.tasks module

Defines the functions for generating Mesos tasks

mesos_api.tasks.create_mesos_task(task)

Creates and returns a Mesos task from a Scale task

Parameters:task (job.tasks.base_task.Task) – The task
Returns:JSON TaskInfo instance
Return type:dict

mesos_api.utils module

Provides utility functions for handling Mesos

mesos_api.utils.create_task_update_model(status)

Creates and returns a task update model for the given Mesos task status

Parameters:status (dict) – The task status in TaskStatus JSON format
Returns:The task update model
Return type:job.models.TaskUpdate
mesos_api.utils.get_status_agent_id(status)

Returns the agent ID of the given Mesos task status

Parameters:status (dict) – The task status in TaskStatus JSON format
Returns:The agent ID
Return type:string
mesos_api.utils.get_status_data(status)

Returns the data dict in the given Mesos task status. If there is no data dict or it is invalid, an empty dict will be returned.

Parameters:status (dict) – The task status in TaskStatus JSON format
Returns:The task status data dict
Return type:dict
mesos_api.utils.get_status_message(status)

Returns the message of the given Mesos task status, possibly None

Parameters:status (dict) – The task status in TaskStatus JSON format
Returns:The task status message
Return type:string
mesos_api.utils.get_status_reason(status)

Returns the reason of the given Mesos task status, possibly None

Parameters:status (dict) – The task status in TaskInfo JSON format
Returns:The task status reason
Return type:string
mesos_api.utils.get_status_source(status)

Returns the source of the given Mesos task status, possibly None

Parameters:status (dict) – The task status in TaskStatus JSON format
Returns:The task status source
Return type:string
mesos_api.utils.get_status_state(status)

Returns the state of the given Mesos task status, possibly None

Parameters:status (dict) – The task status in TaskStatus JSON format
Returns:The task status state
Return type:string
mesos_api.utils.get_status_task_id(status)

Returns the task ID of the given Mesos task status

Parameters:status (dict) – The task status in TaskStatus JSON format
Returns:The task ID
Return type:string
mesos_api.utils.get_status_timestamp(status)

Returns the timestamp of the given Mesos task status, possibly None

Parameters:status (dict) – The task status in TaskStatus JSON format
Returns:The task status timestamp
Return type:datetime.datetime
mesos_api.utils.obj_from_json(input_json)

Converts an JSON dict into a dot accessible object

Parameters:input_json (dict) – The task status in TaskStatus JSON format
Returns:The Task Status in dot accessible form
Return type:Namespace

Module contents