<commit_before>#!/usr/bin/env python

import sys, mapper, random

def h(sig, id, timetag, f):
    try:
        print '--> destination instance', id, 'got', f
    except:
        print '--> exception'
        print sig, id, f

def print_instance_ids():
    phrase = 'active /outsig: ['
    count = outsig.num_active_instances()
    for i in range(count):
        phrase += ' '
        phrase += str(outsig.active_instance_id(i))
    phrase += ' ]   '
    phrase += 'active /insig: ['
    count = insig.num_active_instances()
    for i in range(count):
        phrase += ' '
        phrase += str(insig.active_instance_id(i))
    phrase += ' ]'
    print phrase

src = mapper.device("src")
outsig = src.add_output("/outsig", 1, 'f', None, 0, 1000)

dest = mapper.device("dest")
insig = dest.add_input("/insig", 1, 'f', None, 0, 1, h)

while not src.ready() or not dest.ready():
    src.poll()
    dest.poll(10)

monitor = mapper.monitor()

monitor.link('%s' %src.name, '%s' %dest.name)
monitor.connect('%s%s' %(src.name, outsig.name),
                '%s%s' %(dest.name, insig.name),
                {'mode': mapper.MO_LINEAR})

for i in range(100):
    r = random.randint(0,5)
    id = random.randint(0,5)<commit_msg>Reserve instances for devices in testinstance.py<commit_after>#!/usr/bin/env python

import sys, mapper, random

def h(sig, id, timetag, f):
    try:
        print '--> destination instance', id, 'got', f
    except:
        print '--> exception'
        print sig, id, f

def print_instance_ids():
    phrase = 'active /outsig: ['
    count = outsig.num_active_instances()
    for i in range(count):
        phrase += ' '
        phrase += str(outsig.active_instance_id(i))
    phrase += ' ]   '
    phrase += 'active /insig: ['
    count = insig.num_active_instances()
    for i in range(count):
        phrase += ' '
        phrase += str(insig.active_instance_id(i))
    phrase += ' ]'
    print phrase

src = mapper.device("src")
outsig = src.add_output("/outsig", 1, 'f', None, 0, 1000)
outsig.reserve_instances(5)

dest = mapper.device("dest")
insig = dest.add_input("/insig", 1, 'f', None, 0, 1, h)
insig.reserve_instances(5)

while not src.ready() or not dest.ready():
    src.poll()
    dest.poll(10)

monitor = mapper.monitor()

monitor.link('%s' %src.name, '%s' %dest.name)
monitor.connect('%s%s' %(src.name, outsig.name),
                '%s%s' %(dest.name, insig.name),
                {'mode': mapper.MO_LINEAR})

for i in range(100):
    r = random.randint(0,5)
    id = random.randint(0,5)
{'fraction_non_alphanumeric': 0.17168913560666138, 'fraction_numerical': 0.01506740681998414, 'mean_word_length': 2.793984962406015, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6137615', 'n_tokens_mistral': 938, 'n_tokens_neox': 908, 'n_words': 214}