docs: def scan(self):
          """Analyze state and queue tasks."""
  
          log.debug("scanning machine: %s..." % self.name)
  
          deployed = set()
          services = yield self.client.get_children(self.path + "/services")
  
          for name in services:
              log.debug("checking service: '%s'..." % name)
  
              try:
                  value, metadata = yield self.client.get(
                      self.path + "/services/" + name + "/machines"
                      )
              except NoNodeException:
                  log.warn(
                      "missing machines declaration for service: %s." %
                      name
                      )
                  machines = []
              else:
                  machines = json.loads(value)
  
              if machines:
                  log.debug("machines: %s." % ", ".join(machines))
  
                  if self.name in machines:
                      deployed.add(name)
              else:
                  log.debug("service not configured for any machine.")
  
          count = len(deployed)
          log.debug("found %d service(s) configured for this machine." % count)
  
          running = yield self.client.get_children(
              self.path + "/machines/" + self.name
              )
  
          self.stopped = deployed - set(running)
  
          if self.stopped:
              log.debug("services not running: %s." % ", ".join(
                  map(repr, self.stopped)))
          elif running:
              log.debug("all services are up.")