Take the now clear load and forward it on to the client cmd
160912
def syndic_cmd(self, data):
        '''
        
        '''
        # Set up default tgt_type
        if 'tgt_type' not in data:
            data['tgt_type'] = 'glob'
        kwargs = {}

        # optionally add a few fields to the publish data
        for field in ('master_id',  # which master the job came from
                      'user',  # which user ran the job
                      ):
            if field in data:
                kwargs[field] = data[field]

        def timeout_handler(*args):
            log.warning('Unable to forward pub data: %s', args[1])
            return True

        with tornado.stack_context.ExceptionStackContext(timeout_handler):
            self.local.pub_async(data['tgt'],
                                 data['fun'],
                                 data['arg'],
                                 data['tgt_type'],
                                 data['ret'],
                                 data['jid'],
                                 data['to'],
                                 io_loop=self.io_loop,
                                 callback=lambda _: None,
                                 **kwargs)
301552
def process(self):
    
    client = self._get_client_by_hostname(self.host)
    self._await_flow(client, self.flow_id)
    collected_flow_data = self._download_files(client, self.flow_id)
    if collected_flow_data:
      print('{0:s}: Downloaded: {1:s}'.format(
          self.flow_id, collected_flow_data))
      fqdn = client.data.os_info.fqdn.lower()
      self.state.output.append((fqdn, collected_flow_data))
974913
def _do_watch_progress(filename, sock, handler):
    """"""
    connection, client_address = sock.accept()
    data = b''
    try:
        while True:
            more_data = connection.recv(16)
            if not more_data:
                break
            data += more_data
            lines = data.split(b'\n')
            for line in lines[:-1]:
                line = line.decode()
                parts = line.split('=')
                key = parts[0] if len(parts) > 0 else None
                value = parts[1] if len(parts) > 1 else None
                handler(key, value)
            data = lines[-1]
    finally:
        connection.close()
901880
async def start(self):
        """"""

        self._command_task.start()

        try:
            await self._cleanup_old_connections()
        except Exception:
            await self.stop()
            raise

        #FIXME: This is a temporary hack, get the actual device we are serving.
        iotile_id = next(iter(self.adapter.devices))
        self.device = self.adapter.devices[iotile_id]

        self._logger.info("Serving device 0x%04X over BLED112", iotile_id)
        await self._update_advertisement()

        self.setup_client(self.CLIENT_ID, scan=False, broadcast=True)
1052962
def run(self):
        """"""
        # self.log("ready to receive.")
        # we use a runloop instead of synchronous recv so stopping the node mid-recv is possible
        read_ready = None

        while self.keep_listening:
            try:
                read_ready, w, x = select.select([self.recv_socket], [], [], 0.01)
            except Exception:
                # catch timeouts
                pass

            if read_ready:
                packet, addr = read_ready[0].recvfrom(4096)
                if addr[1] == self.port:
                    # for each address listening to this link
                    for mac_addr, recv_queue in self.inq.items():
                        recv_queue.put(packet)  # put packet in node's recv queue
                else:
                    pass
993504
async function reload() {
  const requestOptions = {
    hostname: 'localhost',
    port: 8081,
    path: '/reloadapp',
    method: 'HEAD',
  };

  const req = http.request(requestOptions, () => {
    clear();
    logger.done('Sent reload request');
    req.end();
  });

  req.on('error', e => {
    clear();
    const error = e.toString();
    if (error.includes('connect ECONNREFUSED')) {
      logger.error(`Reload request failed. Make sure Haul is up.`);
    } else {
      logger.error(e);
    }
  });

  req.end();
}
103901
def goingLive(self, ctx, client):
        '''
        
        '''

        self.ctx = ctx
        self.client = client
459966
def send(self, data):
        
        if data is not None:
            data = data.encode("UTF-8")

        try:
            self.wfile.write(data)
            self.wfile.flush()
            return True

        except IOError:
            # An error occurred, mask it
            # -> This allows to handle the command even if the client has been
            # disconnect (i.e. "echo stop 0 | nc localhost 9000")
            return False
1268761
def send_command(self, data, read_delay=None):
        """"""
        self._write(data)
        if read_delay:
            time.sleep(read_delay)
        return self._read()
242784
def _send_ssh_pub(self, load, ssh_minions=False):
        '''
        
        '''
        if self.opts['enable_ssh_minions'] is True and ssh_minions is True:
            log.debug('Send payload to ssh minions')
            threading.Thread(target=self.ssh_client.cmd, kwargs=load).start()
1274464
def _process_ping(self):
        
        yield self.send_command(PONG_PROTO)
        if self._flush_queue.empty():
            yield self._flush_pending()
1189819
def receive(cmd_id, receive_timeout = nil)
      receive_timeout ||= timeout
      start = Time.now

      until @messages.key?(cmd_id)
        raise Errno::EWOULDBLOCK if (Time.now - start) >= receive_timeout
        if @receive_mutex.try_lock
          begin
            IO.select([socket], [], [], receive_timeout) || raise(Errno::EWOULDBLOCK)
            data = socket.recv(RECV_SIZE)
            break if data.empty?
            driver.parse(data)
          ensure
            @receive_mutex.unlock
          end
        else
          sleep(0.05)
        end
      end
      @messages.delete(cmd_id)
    end
1063102
def send_command(self, cmd, priority=False):
        
        if priority:
            self._pending.insert(0, cmd)
        else:
            self._pending.append(cmd)
        self._pending_size += len(cmd)

        if self._pending_size > DEFAULT_PENDING_SIZE:
            yield self._flush_pending()
42898
def sendDAT(self):
        """"""
        finished = False
        blocknumber = self.context.next_block
        # Test hook
        if DELAY_BLOCK and DELAY_BLOCK == blocknumber:
            import time
            log.debug("Deliberately delaying 10 seconds...")
            time.sleep(10)
        dat = None
        blksize = self.context.getBlocksize()
        buffer = self.context.fileobj.read(blksize)
        log.debug("Read %d bytes into buffer", len(buffer))
        if len(buffer) < blksize:
            log.info("Reached EOF on file %s"
                % self.context.file_to_transfer)
            finished = True
        dat = TftpPacketDAT()
        dat.data = buffer
        dat.blocknumber = blocknumber
        self.context.metrics.bytes += len(dat.data)
        log.debug("Sending DAT packet %d", dat.blocknumber)
        self.context.sock.sendto(dat.encode().buffer,
                                 (self.context.host, self.context.tidport))
        if self.context.packethook:
            self.context.packethook(dat)
        self.context.last_pkt = dat
        return finished
843407
def start_program(self, turn_on_load=True):
        
        self.__set_buffer_start(self.CMD_START_PROG)
        self.__set_checksum()
        self.__send_buffer()
        # Turn on Load if not on
        if turn_on_load and not self.load_on:
            self.load_on = True
450473
def cli(ctx, path, renku_home, use_external_storage):
    """"""
    ctx.obj = LocalClient(
        path=path,
        renku_home=renku_home,
        use_external_storage=use_external_storage,
    )
215897
def flush_commands(self, event=None):
        
        if self._do_CURRENT_command:
            self._do_CURRENT_command = False
            canvas = get_current_canvas()
            if canvas and hasattr(canvas, '_backend'):
                fbo = canvas._backend._vispy_get_fb_bind_location()
            else:
                fbo = 0
            self.shared.parser.parse([('CURRENT', 0, fbo)])
        self.glir.flush(self.shared.parser)