text stringlengths 0 828 |
|---|
self.log.info('New %s %s branched compose ready', branch, arch) |
log = body['msg']['log'] |
if log != 'done': |
self.log.warn('Compose not done?') |
return |
repo = branch |
elif 'updates.fedora' in topic: |
self.log.info('New Fedora %(release)s %(repo)s compose ready', |
body['msg']) |
repo = 'f%(release)s-%(repo)s' % body['msg'] |
else: |
self.log.warn('Unknown topic: %s', topic) |
release = self.releases[repo] |
reactor.callInThread(self.compose, release)" |
1796,"def parse_addr(text): |
""Parse a 1- to 3-part address spec."" |
if text: |
parts = text.split(':') |
length = len(parts) |
if length== 3: |
return parts[0], parts[1], int(parts[2]) |
elif length == 2: |
return None, parts[0], int(parts[1]) |
elif length == 1: |
return None, '', int(parts[0]) |
return None, None, None" |
1797,"def start(self): |
""Start the service"" |
# register signals |
gevent.signal(signal.SIGINT, self._shutdown) |
# spawn the flush trigger |
def _flush_impl(): |
while 1: |
gevent.sleep(self._stats.interval) |
# rotate stats |
stats = self._stats |
self._reset_stats() |
# send the stats to the sink which in turn broadcasts |
# the stats packet to one or more hosts. |
try: |
self._sink.send(stats) |
except Exception, ex: |
trace = traceback.format_tb(sys.exc_info()[-1]) |
self.error(''.join(trace)) |
self._flush_task = gevent.spawn(_flush_impl) |
# start accepting connections |
self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, |
socket.IPPROTO_UDP) |
self._sock.bind(self._bindaddr) |
while 1: |
try: |
data, _ = self._sock.recvfrom(MAX_PACKET) |
for p in data.split('\n'): |
if p: |
self._process(p) |
except Exception, ex: |
self.error(str(ex))" |
1798,"def _process(self, data): |
""Process a single packet and update the internal tables."" |
parts = data.split(':') |
if self._debug: |
self.error('packet: %r' % data) |
if not parts: |
return |
# interpret the packet and update stats |
stats = self._stats |
key = parts[0].translate(KEY_TABLE, KEY_DELETIONS) |
if self._key_prefix: |
key = '.'.join([self._key_prefix, key]) |
for part in parts[1:]: |
srate = 1.0 |
fields = part.split('|') |
length = len(fields) |
if length < 2: |
continue |
value = fields[0] |
stype = fields[1].strip() |
with stats_lock: |
# timer (milliseconds) |
if stype == 'ms': |
stats.timers[key].append(float(value if value else 0)) |
# counter with optional sample rate |
elif stype == 'c': |
if length == 3 and fields[2].startswith('@'): |
srate = float(fields[2][1:]) |
value = float(value if value else 1) * (1 / srate) |
stats.counts[key] += value |
elif stype == 'g': |
value = float(value if value else 1) |
stats.gauges[key] = value" |
1799,"def step_note_that(context, remark): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.