def _query(zk): responses = fire(zk, token, 'info') return { key: hints for key, (_, hints, code) in responses.items() if code == 200 }
def _query(zk): responses = fire(zk, '*', 'info') return { key: hints['process'] for key, (_, hints, code) in responses.items() if code == 200 }
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'] }
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
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)
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']}
def _query(zk): responses = fire(zk, '*', 'info') return {key: hints['process'] for key, (_, hints, code) in responses.items() if code == 200}
def _query(zk): return fire(zk, token, 'control/off')
def _query(zk): return fire(zk, token, 'reset')
def _query(zk): return fire(zk, token, 'log')