code: def push_external_commands_to_schedulers(self):
          if not self.unprocessed_external_commands:
              return
          commands_to_process = self.unprocessed_external_commands
          self.unprocessed_external_commands = []
          logger.debug("Commands: %s", commands_to_process)
          logger.debug("Commands to process: %d commands", len(commands_to_process))
          for ext_cmd in commands_to_process:
              cmd = self.external_commands_manager.resolve_command(ext_cmd)
              logger.debug("Resolved command: %s, result: %s", ext_cmd.cmd_line, cmd)
              if cmd and cmd['global']:
                  for scheduler_link_uuid in self.schedulers:
                      self.schedulers[scheduler_link_uuid].pushed_commands.append(ext_cmd)
          count_pushed_commands = 0
          count_failed_commands = 0
          for scheduler_link_uuid in self.schedulers:
              link = self.schedulers[scheduler_link_uuid]
              if not link.active:
                  logger.debug("The scheduler '%s' is not active, it is not possible to push "
                               "external commands to its connection!", link.name)
                  continue
              commands = [ext_cmd.cmd_line for ext_cmd in link.pushed_commands]
              if not commands:
                  logger.debug("The scheduler '%s' has no commands.", link.name)
                  continue
              logger.debug("Sending %d commands to scheduler %s", len(commands), link.name)
              sent = []
              try:
                  sent = link.push_external_commands(commands)
              except LinkError:
                  logger.warning("Scheduler connection failed, I could not push external commands!")
              link.pushed_commands = []
              if sent:
                  statsmgr.gauge('external-commands.pushed.%s' % link.name, len(commands))
                  count_pushed_commands = count_pushed_commands + len(commands)
              else:
                  count_failed_commands = count_failed_commands + len(commands)
                  statsmgr.gauge('external-commands.failed.%s' % link.name, len(commands))
                  self.external_commands.extend(commands)
          statsmgr.gauge('external-commands.pushed.all', count_pushed_commands)
          statsmgr.gauge('external-commands.failed.all', count_failed_commands)