@inlineCallbacks<EOL><INDENT>def scan(self):<DEDENT>
log.debug("<STR_LIT>" % self.name)<EOL>deployed = set()<EOL>services = yield self.client.get_children(self.path + "<STR_LIT>")<EOL>for name in services:<EOL><INDENT>log.debug("<STR_LIT>" % name)<EOL>try:<EOL><INDENT>value, metadata = yield self.client.get(<EOL>self.path + "<STR_LIT>" + name + "<STR_LIT>"<EOL>)<EOL><DEDENT>except NoNodeException:<EOL><INDENT>log.warn(<EOL>"<STR_LIT>" %<EOL>name<EOL>)<EOL>machines = []<EOL><DEDENT>else:<EOL><INDENT>machines = json.loads(value)<EOL><DEDENT>if machines:<EOL><INDENT>log.debug("<STR_LIT>" % "<STR_LIT:U+002CU+0020>".join(machines))<EOL>if self.name in machines:<EOL><INDENT>deployed.add(name)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>log.debug("<STR_LIT>")<EOL><DEDENT><DEDENT>count = len(deployed)<EOL>log.debug("<STR_LIT>" % count)<EOL>running = yield self.client.get_children(<EOL>self.path + "<STR_LIT>" + self.name<EOL>)<EOL>self.stopped = deployed - set(running)<EOL>if self.stopped:<EOL><INDENT>log.debug("<STR_LIT>" % "<STR_LIT:U+002CU+0020>".join(<EOL>map(repr, self.stopped)))<EOL><DEDENT>elif running:<EOL><INDENT>log.debug("<STR_LIT>")<EOL><DEDENT>
Analyze state and queue tasks.