Example #1
0
File: app.py Project: bhyvex/morfeu
import requests
import logging

from morfeu.tsuru.client import TsuruClient
from morfeu.settings import TIME_RANGE_IN_HOURS, ESEARCH_HOST, TIMEOUT

LOG = logging.getLogger(__name__)

tsuru_client = TsuruClient()


class TsuruApp(object):
    def __init__(self, name=None, dry=False):
        self.dry = dry
        self.name = name
        self.timeout = TIMEOUT
        self.ip = None
        self.pool = None

        self.__load_info()

    def __unicode__(self):
        return u"{0}".format(self.name)

    def __load_info(self):
        app_info = tsuru_client.get_app(self.name)
        self.ip = app_info.get("ip")
        self.pool = app_info.get("pool")

    def sleep(self):
        if self.dry:
Example #2
0
 def setUp(self):
     self.tsuru_client = TsuruClient()