def start(self): BaseService.start(self) self._directory_service_proxy.start() self.log.info("starting services...") for service_name, service in self._directory.iteritems(): self.log.info("starting service %s" % service_name) self.started_services.put(service.start())
class inittest(unittest.TestCase): def setUp(self): self.host = "www.harshniketseta.local" self.path = "testpath" self.base = BaseService("http://"+urljoin(self.host, self.path)) self.rest = Rest(self.host, self.path) self.xmlrpc = XMLRPC(self.host, self.path) def testrestinit(self): self.assertEqual(self.base.getURL(), self.rest.getURL()) def testXMLRPCinit(self): self.assertEqual(self.base.getURL(), self.xmlrpc.getURL())
def setUp(self): self.host = "www.harshniketseta.local" self.path = "testpath" self.base = BaseService("http://"+urljoin(self.host, self.path)) self.rest = Rest(self.host, self.path) self.xmlrpc = XMLRPC(self.host, self.path)
def start(self): BaseService.start(self) self._service_manager.start() return self.greenlet
def __init__(self, name): BaseService.__init__(self, name) self._service_manager = ServiceManager("service-manager") # workers each handle one rest endpoint self.event_loop_state = RoundRobinIndexer(2)
def __init__(self, name): scales.init(self, '/service-manager') BaseService.__init__(self, name) self._directory = {} self.started_services = Queue() self._directory_service_proxy = DirectoryService(self._directory)
def stop(self): self._service_manager.stop_services() self._service_manager.stop() BaseService.stop(self)
# user_command.py __author__ = 'Ron Roth Jr' __contact__ = 'u/ensosati' import traceback import pytz from config.setup import Setup from models.user import User from services import BaseService from utils import T SETUP = Setup() USER_HELP = SETUP.user_help RESERVED = SETUP.reserved_commands base_svc = BaseService() class UserCommand(): """ Handle 'user', 'u' commands and subcommands Subcommands: help - display a set of instructions on UserCommand usage user, u - display and create new users by name timezone, tz - set or display a list of existing timezones url, website, contact - set the contact url for the user alias - set up alias commands """ def __init__(self, parent, ctx, args, guild, user, channel): """
def __init__(self, name): BaseService.__init__(self, name) self._service_manager = ServiceManager( "service-manager") # workers each handle one rest endpoint self.event_loop_state = RoundRobinIndexer(2)