def request_progress(self, dummy_client, msg): """ RequestQueue implementation dumps progress to log.""" if msg[0] != 'SimpleProgress': self.debug(msg[0]) return self.debug(str(parse_progress(msg)))
def monitor_callback(self, update_sm, client, msg): """ FCP message status callback which writes to a ui. """ if self.verbosity < 2: return #prefix = update_sm.current_state.name prefix = '' if self.verbosity > 2: prefix = client.request_id()[:10] + ':' if hasattr(update_sm.current_state, 'pending') and self.verbosity > 1: prefix = ("{%i}:" % len(update_sm.runner.running)) + prefix if msg[0] == 'SimpleProgress': text = str(parse_progress(msg)) elif msg[0] == 'URIGenerated': return # shows up twice #elif msg[0] == 'PutSuccessful': # text = 'PutSuccessful:' + msg[1]['URI'] elif msg[0] == 'ProtocolError': text = 'ProtocolError:' + str(msg) elif msg[0] == 'AllData': # Don't try to print raw data. text = 'AllData: length=%s' % msg[1].get('DataLength', '???') elif msg[0].find('Failed') != -1: code = get_code(msg) or -1 redirect = '' if (code == 27 and 'RedirectURI' in msg[1] and is_usk(msg[1]['RedirectURI'])): redirect = ", redirected to version: %i" % \ get_version(msg[1]['RedirectURI']) text = "%s: code=%i%s" % (msg[0], code, redirect) else: text = msg[0] self.ui_.status("%s%s:%s\n" % (prefix, str(client.tag), text))