Ejemplo n.º 1
0
    def bootstrap(self):
        session = self.schema.session
        query = session.query(Service)

        self.schema.lock_tables(session, 'service')
        try:
            for id in self.configuration.get('required_services', []):
                service = query.get(id)
                if not service:
                    Service.create(session, id=id)

            for service in query:
                service.reset()

            session.commit()
        finally:
            session.close()

        self.schema.purge()
        current_runtime().register_mule('service-registry', self.manage)
Ejemplo n.º 2
0
    def bootstrap(self):
        session = self.schema.session
        query = session.query(Service)

        self.schema.lock_tables(session, 'service')
        try:
            for id in self.configuration.get('required_services', []):
                service = query.get(id)
                if not service:
                    Service.create(session, id=id)

            for service in query:
                service.reset()

            session.commit()
        finally:
            session.close()

        self.schema.purge()
        current_runtime().register_mule('service-registry', self.manage)
Ejemplo n.º 3
0
 def unregister(self, archetype):
     table = self._construct_table(archetype)
     if self.schema.table_exists(table):
         self.schema.drop_table(table)
         current_runtime().reload()
Ejemplo n.º 4
0
 def register(self, archetype, changed=False):
     table = self._construct_table(archetype)
     if changed or not self.schema.is_table_correct(table):
         current_runtime().reload()
Ejemplo n.º 5
0
 def restart_when_dependents_ready(self):
     current_runtime().reload()
     return {'status': 'restarting', 'stage': 'docket-ready'}
Ejemplo n.º 6
0
 def unregister(self, archetype):
     table = self._construct_table(archetype)
     if self.schema.table_exists(table):
         self.schema.drop_table(table)
         current_runtime().reload()
Ejemplo n.º 7
0
 def register(self, archetype, changed=False):
     table = self._construct_table(archetype)
     if changed or not self.schema.is_table_correct(table):
         current_runtime().reload()
Ejemplo n.º 8
0
 def restart_when_dependents_ready(self):
     current_runtime().reload()
     return {'status': 'restarting', 'stage': 'docket-ready'}