Ejemplo n.º 1
0
 def _query(zk):
     responses = fire(zk, token, 'info')
     return {
         key: hints
         for key, (_, hints, code) in responses.items()
         if code == 200
     }
Ejemplo n.º 2
0
 def _query(zk):
     responses = fire(zk, '*', 'info')
     return {
         key: hints['process']
         for key, (_, hints, code) in responses.items()
         if code == 200
     }
Ejemplo n.º 3
0
 def _query(zk):
     responses = fire(zk, cluster, 'info')
     return {
         key:
         '%d\t\t%s' % (hints['ports'][port], hints['public'])
         for key, (_, hints, code) in responses.items()
         if code == 200 and port in hints['ports']
     }
Ejemplo n.º 4
0
                        def _query(zk):
                            out = {}
                            responses = fire(zk, token, 'info')
                            for pod, (_, hints, code) in responses.items():
                                if code == 200:
                                    out[pod] = '[%s / %s] @ %s (%s)' % \
                                               (hints['state'], hints['process'], hints['node'], hints['public'])

                            return len(responses), out
Ejemplo n.º 5
0
            def _query(zk):

                #
                # - this closure will run in our zookeeper proxy actor
                # - in this case we'll HTTP POST a /info query to all our pods (you can use a glob pattern)
                # - fire() will figure out where the pods are running from and what their control port is
                # - we simply return the number of pods who answered with HTTP 200
                # - please note all the I/O is done on parallel for each pod and the outcome aggregated for you
                #
                responses = fire(zk, '*', 'info')
                return sum(1 for key, (_, _, code) in responses.items() if code == 200)
Ejemplo n.º 6
0
Archivo: port.py Proyecto: d2e/ochopod
 def _query(zk):
     responses = fire(zk, cluster, 'info')
     return {key: '%d\t\t%s' % (hints['ports'][port], hints['public'])
             for key, (_, hints, code) in responses.items() if code == 200 and port in hints['ports']}
Ejemplo n.º 7
0
Archivo: ls.py Proyecto: d2e/ochopod
 def _query(zk):
     responses = fire(zk, '*', 'info')
     return {key: hints['process'] for key, (_, hints, code) in responses.items() if code == 200}
Ejemplo n.º 8
0
 def _query(zk):
     return fire(zk, token, 'control/off')
Ejemplo n.º 9
0
 def _query(zk):
     return fire(zk, token, 'reset')
Ejemplo n.º 10
0
 def _query(zk):
     return fire(zk, token, 'log')