Esempio n. 1
0
    def __init__(self, clk_per="10n", vdd_voltage=1.0, output_load="4x"):
        self.design = Design(vdd_voltage)
        d = self.design
        self.power_sources = [d.vpwr]
        (self.inputTerms, self.outputTerms) = self.build_bench(d)
        Simulation.__init__(self, self.design, "1", str(self.__class__),
                            clk_per)

        for it in self.inputTerms:
            drvr = Voltage(d, vdd_voltage)
            drvrInv = Inverter(d)
            d.pair({
                drvr.plus: drvrInv.input,
                drvrInv.output: it,
                drvr.minus: d.vss
            })

        for ot in self.outputTerms:
            loadInv = Inverter(d, width=output_load)
            rload = Resistor(d, "1000000000")
            d.pair({
                loadInv.input: ot,
                loadInv.output: rload.a,
                rload.b: d.vss
            })
Esempio n. 2
0
def fromLIST(list):
    d = Design()
    for col in list:
        d.addCollection(col['collection'])
        d.addShardKey(col['collection'], col['shardKey'])
        for i in col['indexes']:
            d.addIndex(col['collection'], i)
        d.denorm[col['collection']] = col['denorm']
    return d
Esempio n. 3
0
    def generate(self):
        LOG.info("Generating random design")
        design = Design()
        rng = random.Random()
        for col_info in self.collections.itervalues():
            design.addCollection(col_info['name'])

            col_fields = []
            for field, data in col_info['fields'].iteritems():
                col_fields.append(field)

            # Figure out which attribute has the highest value for
            # the params that we care about when choosing the best design
            attrs = [ ]
            chosen_field = None
            while chosen_field is None or str(chosen_field).startswith("#") or str(chosen_field).startswith("_"):
                chosen_field = random.choice(col_fields)
            attrs.append(chosen_field)
            print "field: ", chosen_field

            design.addShardKey(col_info['name'], attrs)
            design.addIndex(col_info['name'], attrs)

        return design
    ## DEF

## CLASS
Esempio n. 4
0
def handle_request(req):
    command = req['command']
    print("Description: ", req['userDesc'])

    if command == u'NEW-USER':
        print('Handle')

    elif command == u'UPLOAD':
        des = Design(req['filePath'], req['userName'])
        des_name = des.full_name
        desc = Semant(req['userName'], req['fileName'], req['userDesc'])

        print "Coordinates of the design: "
        print des.project()

        result = des.to_stl(req['fileDir'])
        result['properties'] = des.project()
        result['score'] = des.score()

        # compute distance matrix and other information
        DesDom.add_design(des)
        SemDom.add_desc(desc)

        print 'Shape matrix: ', DesDom.dmat
        print 'Semantic matrix: ', SemDom.dmat

        log('UPLOAD', req['filePath'], 'by', req['userName'], '\n\tPROPERTIES',
            str(des.project()))

        return json.dumps(result)

    elif command == u'RECOMMEND':
        recomms = DesDom.recommend(req['userName'], req['condition'],
                                   RECOMM_NUM)
        names = map(lambda x: x[0], recomms)
        paths = map(render_path, names)
        result = {'recommendations': paths}

        log('RECOMMEND', 'to', req['userName'], '\n\tDESIGNS', str(paths))

        return json.dumps(result)

    elif command == u'DELETE':
        print('Received DELETE request')
        print('Request: ')
        print(req)

        DesDom.remove_design(req['userName'], req['designName'])
        SemDom.remove_desc(req['userName'], req['fileName'])

        result = {'delete': 'SUCCESS'}  # error handling required

        log('DELETE', 'design', req['designName'], 'by', req['userName'])

        return json.dumps(result)

    else:
        print('Handle')
Esempio n. 5
0
    def generate(self):
        if self.debug:
            LOG.debug("Computing initial design")
        design = Design()

        # STEP 1
        # Generate a histogram of the sets of keys that are used together
        col_keys = self.generateCollectionHistograms()
        map(design.addCollection, col_keys.iterkeys())

        # STEP 2
        # Select the sharding key for each collection as the set of keys
        # that are occur most often
        self.__selectShardingKeys__(design, col_keys)

        # STEP 3
        # Iterate through the collections and keep adding indexes until
        # we exceed our initial design memory allocation
        total_memory = self.config.getint(
            configutil.SECT_CLUSTER,
            "node_memory") * INITIAL_INDEX_MEMORY_ALLOCATION
        assert total_memory > 0
        self.__selectIndexKeys__(design, col_keys, total_memory)

        return design
Esempio n. 6
0
 def design(self, instance):
     home_screen = APP.root.current_screen
     from design import Design
     self.design = Design()
     APP.root.add_widget(self.design)
     APP.root.current = "design"
     APP.root.remove_widget(home_screen)
Esempio n. 7
0
  def predict(self, net: ConvNet, design: Design, freq=200):
    (num_cycles, num_data), results = design.run(net)
    num_secs = num_cycles * 1. / (freq * 1e6)
    gflops = net.num_ops * 1e-9 / num_secs
    CTC = net.num_ops / (num_data * 2)

    return num_cycles, num_secs, gflops, num_data, CTC, results
Esempio n. 8
0
    def __init__(self, parent=None):
        global app
        app = self
        gtk.Window.__init__(self)
        try:
            self.set_screen(parent.get_screen())
        except AttributeError:
            self.connect('destroy', lambda *w: gtk.main_quit())

        self.design = Design(self)

        actions = gtk.ActionGroup("Actions")
        actions.add_actions(menu_entries)

        ui = gtk.UIManager()
        ui.insert_action_group(actions, 0)
        self.add_accel_group(ui.get_accel_group())

        # better path to 'ui.xml' needed
        uifile = os.path.join(os.path.dirname(sys.argv[0]), "ui.xml")

        try:
            mergeid = ui.add_ui_from_file(uifile)
        except gobject.GError, msg:
            print "error building menus: %s" % (msg)
Esempio n. 9
0
class Cell(Btn):
    cell_type = StringProperty('inputs')
    text = StringProperty('0')
    theme = Design().default_theme
    bent_title = StringProperty('def.')
    bent_index = ObjectProperty(-1)
    bent_title_cell = ObjectProperty(None)

    def none_method(self, *args):
        print('[BeastWood-WARNING]: none_method has been called.')

    save_value = ObjectProperty(none_method)

    def on_release(self):
        cell_type = self.cell_type
        values = ['0', '1', 'X', '@']
        if self.text in values:
            index = 3
            if cell_type == 'inputs':
                index = (values.index(self.text) + 1) % 2
            elif cell_type == 'outputs':
                index = (values.index(self.text) + 1) % 3
            self.text = values[index]

        try:
            self.save_value(self.bent_title_cell.text, self.bent_index,
                            self.text)
        except AttributeError:
            self.save_value(self.bent_title, self.bent_index, self.text)
Esempio n. 10
0
class RadioButton(CheckBox):
    C_DISABLED = (.8, .8, .8, 1)
    C_NORMAL = (0, 0, 0, 1)

    theme = Design().default_theme
    label = ObjectProperty(None)
    text_input = ObjectProperty(None)
    mates = []

    def on_press(self):
        self.set_status(True)

    def set_status(self, active):
        """ Args: active [bool]

        """
        if active:
            self.active = True
            self.label.color = self.C_NORMAL
            self.text_input.disabled = False

            for mate in self.mates:
                mate['Radio Button'].active = False
                mate['Label'].color = mate['Radio Button'].C_DISABLED
                mate['Text Input'].disabled = True
Esempio n. 11
0
def fromLIST(list) :
    d = Design()
    for col in list :
        d.addCollection(col['collection'])
        d.addShardKey(col['collection'], col['shardKey'])
        for i in col['indexes'] :
            d.addIndex(col['collection'], i)
        d.denorm[col['collection']] = col['denorm']
    return d
Esempio n. 12
0
class Testbench(Simulation):

    RegisteredTests = dict()

    def __init__(self, clk_per="10n", vdd_voltage=1.0, output_load="4x"):
        self.design = Design(vdd_voltage)
        d = self.design
        self.power_sources = [d.vpwr]
        (self.inputTerms, self.outputTerms) = self.build_bench(d)
        Simulation.__init__(self, self.design, "1", str(self.__class__),
                            clk_per)

        for it in self.inputTerms:
            drvr = Voltage(d, vdd_voltage)
            drvrInv = Inverter(d)
            d.pair({
                drvr.plus: drvrInv.input,
                drvrInv.output: it,
                drvr.minus: d.vss
            })

        for ot in self.outputTerms:
            loadInv = Inverter(d, width=output_load)
            rload = Resistor(d, "1000000000")
            d.pair({
                loadInv.input: ot,
                loadInv.output: rload.a,
                rload.b: d.vss
            })

    def printNetlist(self, stream=stdout):
        self.design.print_netlist(stream)

    def run(self):
        pass

    def build_bench(self, design):
        raise NotImplementedError()
Esempio n. 13
0
def unsat_test(debug_prints=True):
    adj = {'n1': {'n2', 'n3', 'n4', 'n5', 'n6'}}

    fab = Fabric((3, 3), wire_lengths={1})
    des = Design(adj, fab, position.Packed2H)
    des.add_constraint_generator('nearest_neighbor',
                                 constraints.nearest_neighbor_var)
    des.add_constraint_generator('distinct', constraints.distinct)
    sol = run_test(des, debug_prints)
    return des, fab, sol
    def __init__(self, h5n):
        self._h5n = h5n  # type: H5Nastran

        self.constraint = Constraint(self._h5n, self)
        # self.contact = Contact(self.h5n, self)
        self.coordinate_system = CoordinateSystem(self._h5n, self)
        self.design = Design(self._h5n, self)
        # self.domains = None
        self.dynamic = Dynamic(self._h5n, self)
        self.element = Element(self._h5n, self)
        # self.fatigue = None
        self.load = Load(self._h5n, self)
        self.material = Material(self._h5n, self)
        # self.matrix = None
        # self.modules = None
        self.node = Node(self._h5n, self)
        self.parameter = Parameter(self._h5n, self)
        # self.partition = None
        self.property = Property(self._h5n, self)
        self.table = Table(self._h5n, self)
Esempio n. 15
0
def small_test(dims=(8, 8), debug_prints=True):
    '''
        place a depth 5 binary tree on a 8 by 8 with wire lengths of 1 or 2
    '''
    adj = {
        'n{}'.format(i): frozenset(
            (('n{}'.format(2 * i), 1), ('n{}'.format(2 * i + 1), 1)))
        for i in range(1, 2**4)
    }
    fab = Fabric(dims, wire_lengths={1, 2})
    des = Design(adj, fab, position.Packed2H)
    des.add_constraint_generator('neighborhood',
                                 constraints.in_neighborhood(2))
    des.add_constraint_generator('distinct', constraints.distinct)
    sol = run_test(des, debug_prints)
    return des, fab, sol
Esempio n. 16
0
def tiny_opt_test(dims=(4, 4), debug_prints=True):
    '''
        place 4 nodes on a 3x3 fabric [with length 1 wires]
    '''
    adj = {
        'n1': [('n2', 1), ('n3', 1)],
        'n2': [('n4', 1)],
        'n3': [('n4', 1)],
        'n4': {}
    }
    fab = Fabric(dims, wire_lengths={1})

    des = Design(adj, fab, position.BVXY)
    des.add_optimizer('min_L1', constraints.min_L1, True)
    des.add_constraint_generator('distinct', constraints.opt_distinct)

    sol = run_opt_test(des, debug_prints)
    return des, fab, sol
Esempio n. 17
0
class SideConf(GreyDefault):
    _theme = Design().default_theme
    C_DISABLED = (.8, .8, .8, 1)
    C_NORMAL = (0, 0, 0, 1)

    def __init__(self):
        super().__init__()
        self.data = fw.read()
        bottom = SideConfBottom()
        self.ids.bottom_container.add_widget(bottom)
        bottom.ids.save_as_btn.bind(on_release=self.show_save)
        bottom.ids.open_btn.bind(on_release=self.show_load)

    def show_save(self, *args):
        content = Save(save=self.save, cancel=self.dismiss_popup)
        self._popup = WhitePopup(title="Save file", content=content)
        self._popup.open()

    def show_load(self, *args):
        content = Load(load=self.load, cancel=self.dismiss_popup)
        self._popup = WhitePopup(title="Open file", content=content)
        self._popup.open()

    def save(self, file_name):
        fw.save(self.data, name=file_name)
        fw.save(self.data)
        fw.autosave(self.data)
        self.dismiss_popup()

    def load(self, file_name):
        if file_name:
            self.data = fw.read(name=file_name)
            self.dismiss_popup()

    def dismiss_popup(self):
        self._popup.dismiss()
Esempio n. 18
0
def tiny_test(dims=(3, 3), debug_prints=True):
    '''
        place 4 nodes on a 3x3 fabric [with length 1 wires]
    '''
    adj = {
        'n1': [('n2', 1), ('n3', 1)],
        'n2': [('n4', 1)],
        'n3': [('n4', 1)],
        'n4': {}
    }
    fab = Fabric(dims, wire_lengths={1})

    des = Design(adj, fab, position.Unpacked2H)
    des.add_constraint_generator('nearest_neighbor',
                                 constraints.nearest_neighbor_fast)
    des.add_constraint_generator('distinct', constraints.distinct)

    sol = run_test(des, debug_prints)
    return des, fab, sol
Esempio n. 19
0
class Btn(HoverButton):
    theme = Design().default_theme
Esempio n. 20
0
design_file = args.design
contexts = args.contexts
fabric_file = args.fabric
optimizer_name = args.optimizer_name

cutoff = args.cutoff
optimize_final = args.optimize_final
incremental = args.incremental
duplicate_const = args.duplicate_const
duplicate_all = args.duplicate_all

optimizer = tester.OPTIMIZERS[optimizer_name]
solver = tester.SOLVER

mods, ties = dotparse.dot2graph(design_file)
design = Design(mods, ties)
cgra = adlparse(fabric_file)
mrrg = MRRG(cgra, contexts=contexts, add_tie_nodes=not args.ntiesnodes)

pnr = PNR(mrrg,
          design,
          solver,
          incremental=incremental,
          duplicate_const=duplicate_const,
          duplicate_all=duplicate_all)

full_timer.start()
result = pnr.optimize_design(
    optimizer,
    tester.init,
    tester.funcs,
Esempio n. 21
0
    def get_WORDPRESS_Design(self):
        d = Design()
        # collection wp_posts
        col_name = "wp_posts"
        d.addCollection(col_name)
        d.addIndex(col_name, ["ID", "post_type", "meta_key", "meta_value"])
        d.addIndex(col_name, ["post_type", "post_parent", "post_status"])
        d.addIndex(col_name, ["post_name", "post_status"])
        d.addIndex(col_name, ["post_status", "post_type", "post_date"])
        d.addIndex(col_name, ["ID", "post_name", "post_type", "post_parent"])
        d.addIndex(col_name, ["post_parent"])
        d.addShardKey(col_name, ["ID"])

        # collection wp_users
        col_name = "wp_users"
        d.addCollection(col_name)
        d.addIndex(col_name, ["user_login"])
        d.addIndex(col_name, ["ID"])
        d.addShardKey(col_name, ["user_login"])

        # collection wp_comments
        col_name = "wp_comments"
        d.addCollection(col_name)
        d.addIndex(col_name, ["comment_approved", "comment_post_ID"])
        d.addIndex(col_name, ["comment_post_ID"])
        d.addShardKey(col_name, ["comment_approved", "comment_post_ID"])

        # collection wp_options
        col_name = "wp_options"
        d.addCollection(col_name)
        d.addIndex(col_name, ["option_name"])
        d.addIndex(col_name, ["autoload"])
        d.addShardKey(col_name, ["option_name"])

        # collection wp_usermeta
        col_name = "wp_usermeta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["user_id"])
        d.addIndex(col_name, ["meta_key"])
        d.addShardKey(col_name, ["user_id"])

        # collection wp_postmeta
        col_name = "wp_postmeta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["post_id", "meta_key"])
        d.addShardKey(col_name, ["post_id", "meta_key"])

        print d.toJSON()
Esempio n. 22
0
sys.path.append(os.path.join(basedir, ".."))

from dbcombiner import DBCombiner
from dbdenormalizer import DBDenormalizer
from design_deserializer import Deserializer
from design import Design

def test_combine_deletes(combiner, operations):
    return combiner.combineDeletes(operations)

if __name__=="__main__":
    design_path = r"/home/ruiz1/mongodb-d4/exps/tpcc_design"
    print design_path
    deserializer = Deserializer()
    deserializer.loadDesignFile(design_path)
    design = Design()
    design.data = deserializer.json_doc
    print design.data

    dm = DBDenormalizer(None, None, None, None, design)
    graph = dm.constructGraph()
    dm.metadata_db = pymongo.Connection('localhost:27017')['tpcc_meta']
    parent_keys = dm.readSchema('schema')

    combiner = DBCombiner(None, design, graph, parent_keys)

    operations = []
    for i in range(5):
        op = dict()
        op['query_content'] = [] 
        op['query_fields'] = None
Esempio n. 23
0
                                   'wspace': 0
                               },
                               figsize=(textwidth, figheight))

# run experiment: entropy
for j, exptime in enumerate(exptimes):
    all_SNR = np.sqrt(exptime / all_n_bins)
    all_SR = (lam_max + lam_min) / (lam_max - lam_min) * all_n_bins / 2

    dist_low = np.zeros(all_SNR.shape)
    dist_high = np.zeros_like(dist_low)
    dist_med = np.zeros_like(dist_low)

    for i in range(all_n_bins.shape[0]):
        design = Design(n_bins=all_n_bins[i],
                        exp_time=exptime,
                        lam_min=lam_min,
                        lam_max=lam_max)
        U, err = find_utility(design,
                              spectrum_set,
                              samples,
                              utility='information')

        dist_low[i] = U - err
        dist_med[i] = U
        dist_high[i] = U + err

    ax1.fill_between(all_SR, dist_low, dist_high, label=exptime, alpha=0.3)
    ax1.plot(all_SR, dist_med)

    ax2.fill_between(all_SNR, dist_low, dist_high, label=exptime, alpha=0.3)
    ax2.plot(all_SNR, dist_med)
Esempio n. 24
0
    def get_WIKIPEDIA_Design(self):
        d = Design()
        # collection recentchanges
        col_name = "recentchanges"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection logging
        col_name = "logging"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection useracct
        col_name = "useracct"
        d.addCollection(col_name)
        d.addIndex(col_name, ["user_id"])
        d.addShardKey(col_name, ["user_id"])

        # collection text
        col_name = "text"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection watchlist
        col_name = "watchlist"
        d.addCollection(col_name)
        d.addIndex(col_name, ["wl_namespace", "wl_notificationtimestamp", "wl_title", "wl_user", "j+WV+mk6"])
        d.addIndex(col_name, ["wl_namespace", "wl_notificationtimestamp", "wl_title", "wl_user", "A", "zLl6Bw"])
        d.addShardKey(col_name, ["wl_namespace", "wl_notificationtimestamp", "wl_title", "wl_user"])

        # collection page
        col_name = "page"
        d.addCollection(col_name)
        d.addIndex(col_name, ["page_namespace", "page_title"])
        d.addShardKey(col_name, ["page_namespace", "page_title"])

        # collection revision
        col_name = "revision"
        d.addCollection(col_name)
        d.addIndex(col_name, ["rev_page", "rev_id", "page_id"])
        d.addShardKey(col_name, ["rev_page", "rev_id", "page_id"])

        print d.toJSON()
Esempio n. 25
0
    def get_MMS_Design(self):
        d = Design()
        # collection mmsdbdays.data.rrdDays
        col_name = "mmsdbdays.data.rrdDays"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4f8dd12187d1d86fa8b99e50.acb986577e749f0d3c5b4e1de17e1e1a
        col_name = "mmsdblogs-4f8dd12187d1d86fa8b99e50.acb986577e749f0d3c5b4e1de17e1e1a"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.68df4b3652978efc8b58f6f6a5fd5fc5
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.68df4b3652978efc8b58f6f6a5fd5fc5"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.397b8c68e7baa122099e9c0f420d0bf2
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.397b8c68e7baa122099e9c0f420d0bf2"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdb.data.agentAudits
        col_name = "mmsdb.data.agentAudits"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.754274d901dc95950d1f9fba2441be34
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.754274d901dc95950d1f9fba2441be34:"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdb.data.rrdMinutes
        col_name = "mmsdb.data.rrdMinutes"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addIndex(col_name, ["d, cid, hid, g, i"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.aa2d0cd7e5420c5c807ad6be8d22a7ba
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.aa2d0cd7e5420c5c807ad6be8d22a7ba"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.d9d289019f38a50c8278a505584f6a82
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.d9d289019f38a50c8278a505584f6a82"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdbhours.data.rrdHours
        col_name = "mmsdbhours.data.rrdHours"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_i"])

        print d.toJSON()
Esempio n. 26
0
    def get_WORDPRESS_Design(self):
        d = Design()
        # collection wp_posts
        col_name = "wp_posts"
        d.addCollection(col_name)
        d.addIndex(col_name, ["ID", "post_type", "meta_key", "meta_value"])
        d.addIndex(col_name, ["post_type", "post_parent", "post_status"])
        d.addIndex(col_name, ["post_name", "post_status"])
        d.addIndex(col_name, ["post_status", "post_type", "post_date"])
        d.addIndex(col_name, ["ID", "post_name", "post_type", "post_parent"])
        d.addIndex(col_name, ["post_parent"])
        d.addShardKey(col_name, ["ID"])

        # collection wp_users
        col_name = "wp_users"
        d.addCollection(col_name)
        d.addIndex(col_name, ["user_login"])
        d.addIndex(col_name, ["ID"])
        d.addShardKey(col_name, ["user_login"])

        # collection wp_comments
        col_name = "wp_comments"
        d.addCollection(col_name)
        d.addIndex(col_name, ["comment_approved", "comment_post_ID"])
        d.addIndex(col_name, ["comment_post_ID"])
        d.addShardKey(col_name, ["comment_approved", "comment_post_ID"])

        # collection wp_options
        col_name = "wp_options"
        d.addCollection(col_name)
        d.addIndex(col_name, ["option_name"])
        d.addIndex(col_name, ["autoload"])
        d.addShardKey(col_name, ["option_name"])

        # collection wp_usermeta
        col_name = "wp_usermeta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["user_id"])
        d.addIndex(col_name, ["meta_key"])
        d.addShardKey(col_name, ["user_id"])

        # collection wp_postmeta
        col_name = "wp_postmeta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["post_id", "meta_key"])
        d.addShardKey(col_name, ["post_id", "meta_key"])

        print d.toJSON()
Esempio n. 27
0
class WhitePopup(Popup):
    theme = Design().default_theme
Esempio n. 28
0
        max_time = args.stop_after_time
    else:
        max_time = 60

    # Set up the parallel executor
    # TODO

    # Register designs
    design_dir = args.designs
    os.makedirs(f"{design_dir}/register", exist_ok=True)
    designs = []
    for f in os.listdir(design_dir):
        if f.endswith(".json"):
            with open(f'{design_dir}/{f}', 'r') as json_f:
                desp = json.load(json_f)
            design = Design(f.split(".")[0])
            design.register(desp, f"{design_dir}/register/{design.name}.py")
            #print(design.name)
            designs.append(design)
    if len(designs) == 0:
        raise RuntimeError("No design found")
    #exit(0)

    # Load task
    with open(f'task/{args.task}.json') as f:
        data = json.load(f)
    tasks = []
    for task in data["tasks"]:
        tasks.append(task)

    # Start searching
Esempio n. 29
0
    def get_WIKIPEDIA_Design(self):
        d = Design()
        # collection recentchanges
        col_name = "recentchanges"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection logging
        col_name = "logging"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection useracct
        col_name = "useracct"
        d.addCollection(col_name)
        d.addIndex(col_name, ["user_id"])
        d.addShardKey(col_name, ["user_id"])

        # collection text
        col_name = "text"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection watchlist
        col_name = "watchlist"
        d.addCollection(col_name)
        d.addIndex(col_name, [
            "wl_namespace", "wl_notificationtimestamp", "wl_title", "wl_user",
            "j+WV+mk6"
        ])
        d.addIndex(col_name, [
            "wl_namespace", "wl_notificationtimestamp", "wl_title", "wl_user",
            "A", "zLl6Bw"
        ])
        d.addShardKey(col_name, [
            "wl_namespace", "wl_notificationtimestamp", "wl_title", "wl_user"
        ])

        # collection page
        col_name = "page"
        d.addCollection(col_name)
        d.addIndex(col_name, ["page_namespace", "page_title"])
        d.addShardKey(col_name, ["page_namespace", "page_title"])

        # collection revision
        col_name = "revision"
        d.addCollection(col_name)
        d.addIndex(col_name, ["rev_page", "rev_id", "page_id"])
        d.addShardKey(col_name, ["rev_page", "rev_id", "page_id"])

        print d.toJSON()
Esempio n. 30
0
    def get_MMS_Design(self):
        d = Design()
        # collection mmsdbdays.data.rrdDays
        col_name = "mmsdbdays.data.rrdDays"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4f8dd12187d1d86fa8b99e50.acb986577e749f0d3c5b4e1de17e1e1a
        col_name = "mmsdblogs-4f8dd12187d1d86fa8b99e50.acb986577e749f0d3c5b4e1de17e1e1a"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.68df4b3652978efc8b58f6f6a5fd5fc5
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.68df4b3652978efc8b58f6f6a5fd5fc5"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.397b8c68e7baa122099e9c0f420d0bf2
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.397b8c68e7baa122099e9c0f420d0bf2"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdb.data.agentAudits
        col_name = "mmsdb.data.agentAudits"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.754274d901dc95950d1f9fba2441be34
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.754274d901dc95950d1f9fba2441be34:"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdb.data.rrdMinutes
        col_name = "mmsdb.data.rrdMinutes"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addIndex(col_name, ["d, cid, hid, g, i"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.aa2d0cd7e5420c5c807ad6be8d22a7ba
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.aa2d0cd7e5420c5c807ad6be8d22a7ba"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdblogs-4fa020bf87d1d86fa8b9eb6b.d9d289019f38a50c8278a505584f6a82
        col_name = "mmsdblogs-4fa020bf87d1d86fa8b9eb6b.d9d289019f38a50c8278a505584f6a82"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection mmsdbhours.data.rrdHours
        col_name = "mmsdbhours.data.rrdHours"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_i"])

        print d.toJSON()
Esempio n. 31
0
    def get_EXFM_Design(self):
        d = Design()
        # collection exfm.sotd
        col_name = "exfm.sotd"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.site.followers
        col_name = "exfm.site.followers"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.site
        col_name = "exfm.user.site"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.meta
        col_name = "exfm.user.meta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addIndex(col_name, ["email"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.activity
        col_name = "exfm.user.activity"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addIndex(col_name, ["verb", "_id"])
        d.addIndex(col_name, ["verb", "username", "obj_id"])
        d.addIndex(col_name, ["verb", "username", "created"])
        d.addShardKey(col_name, ["verb", "_id"])

        # collection exfm.user.loved
        col_name = "exfm.user.loved"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.following
        col_name = "exfm.user.following"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.service
        col_name = "exfm.user.service"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.song.site
        col_name = "exfm.song.site"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.site.songs
        col_name = "exfm.site.songs"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.recently_viewed_site
        col_name = "exfm.user.recently_viewed_site"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.site.song_publish_dates
        col_name = "exfm.site.song_publish_dates"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id", "p"])
        d.addShardKey(col_name, ["p"]) # If insert volume low, shard on p, if high shard on _id

        # collecion exfm.user.followers
        col_name = "exfm.user.followers"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.artist.meta
        col_name = "exfm.artist.meta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.feed
        col_name = "exfm.user.feed"
        d.addCollection(col_name)
        d.addIndex(col_name, ["username", "verb"])
        d.addIndex(col_name, ["verb", "actor", "obj_id"])
        d.addShardKey(col_name, ["username", "verb"])

        # collection exfm.site.meta
        col_name = "exfm.site.meta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.song.meta
        col_name = "exfm.song.meta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addIndex(col_name, ["md5"])
        d.addShardKey(col_name, ["_id"])

        print d.toJSON()
Esempio n. 32
0
    def get_TATP_Design(self):
        d = Design()
        # collection SUBSCRIBER
        col_name = "SUBSCRIBER"
        d.addCollection(col_name)
        d.addIndex(col_name, ["s_id"])
        d.addIndex(col_name, ["sub_nbr"])
        d.addShardKey(col_name, ["s_id"])

        # collection ACCESS_INFO
        col_name = "ACCESS_INFO"
        d.addCollection(col_name)
        d.addIndex(col_name, ["ai_type", "s_id"])
        d.addShardKey(col_name, ["ai_type,", "s_id"])

        # collection SPECIAL_FACILITY
        col_name = "SPECIAL_FACILITY"
        d.addCollection(col_name)
        d.addIndex(col_name, ["s_id", "sf_type", "is_active"])
        d.addShardKey(col_name, ["s_id", "sf_type", "is_active"])

        # collection CALL_FORWARDING
        col_name = "CALL_FORWARDING"
        d.addCollection(col_name)
        d.addIndex(col_name, ["start_time", "sf_type", "s_id", "end_time"])
        d.addShardKey(col_name, ["start_time", "sf_type", "s_id", "end_time"])

        print d.toJSON()
Esempio n. 33
0
            _translate(
                "Dialog",
                "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
                "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                "p, li { white-space: pre-wrap; }\n"
                "</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
                "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Version</span>:V0.1.11</p>\n"
                "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
                "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Email</span>:[email protected]</p></body></html>"
            ))
        self.pushButton_6.setText(_translate("Dialog", "Exit"))


if __name__ == "__main__":
    app = QApplication(sys.argv)
    form = QWidget()
    w = Ui_Dialog()
    w.setupUi(form)
    form.show()
    uiDesign = Design()
    uiParse = Parse()
    uiAug = Aug()
    uiTrain = Train()
    uiTest = Test()
    w.pushButton.clicked.connect(uiParse.show)
    w.pushButton_2.clicked.connect(uiAug.show)
    w.pushButton_3.clicked.connect(uiDesign.show)
    w.pushButton_4.clicked.connect(uiTrain.show)
    w.pushButton_5.clicked.connect(uiTest.show)
    sys.exit(app.exec_())
Esempio n. 34
0
def random_design( point_type, lower, upper, size = 100, rng = None ) :
    scaler = Scaler( lower, upper, rng )
    design = Design( point_type, scaler, scipy.zeros( ( size, scaler.dims ) ) )
    design.randomize()
    return design
Esempio n. 35
0
    def get_EXFM_Design(self):
        d = Design()
        # collection exfm.sotd
        col_name = "exfm.sotd"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.site.followers
        col_name = "exfm.site.followers"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.site
        col_name = "exfm.user.site"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.meta
        col_name = "exfm.user.meta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addIndex(col_name, ["email"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.activity
        col_name = "exfm.user.activity"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addIndex(col_name, ["verb", "_id"])
        d.addIndex(col_name, ["verb", "username", "obj_id"])
        d.addIndex(col_name, ["verb", "username", "created"])
        d.addShardKey(col_name, ["verb", "_id"])

        # collection exfm.user.loved
        col_name = "exfm.user.loved"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.following
        col_name = "exfm.user.following"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.service
        col_name = "exfm.user.service"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.song.site
        col_name = "exfm.song.site"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.site.songs
        col_name = "exfm.site.songs"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.recently_viewed_site
        col_name = "exfm.user.recently_viewed_site"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.site.song_publish_dates
        col_name = "exfm.site.song_publish_dates"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id", "p"])
        d.addShardKey(
            col_name,
            ["p"])  # If insert volume low, shard on p, if high shard on _id

        # collecion exfm.user.followers
        col_name = "exfm.user.followers"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.artist.meta
        col_name = "exfm.artist.meta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.user.feed
        col_name = "exfm.user.feed"
        d.addCollection(col_name)
        d.addIndex(col_name, ["username", "verb"])
        d.addIndex(col_name, ["verb", "actor", "obj_id"])
        d.addShardKey(col_name, ["username", "verb"])

        # collection exfm.site.meta
        col_name = "exfm.site.meta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addShardKey(col_name, ["_id"])

        # collection exfm.song.meta
        col_name = "exfm.song.meta"
        d.addCollection(col_name)
        d.addIndex(col_name, ["_id"])
        d.addIndex(col_name, ["md5"])
        d.addShardKey(col_name, ["_id"])

        print d.toJSON()
Esempio n. 36
0
File: core.py Progetto: rcthomas/qnd
def random_design(point_type, lower, upper, size=100, rng=None):
    scaler = Scaler(lower, upper, rng)
    design = Design(point_type, scaler, scipy.zeros((size, scaler.dims)))
    design.randomize()
    return design
Esempio n. 37
0
class DefaultLayout(BoxLayout):
    theme = Design().default_theme
Esempio n. 38
0
    def get_TATP_Design(self):
        d = Design()
        # collection SUBSCRIBER
        col_name = "SUBSCRIBER"
        d.addCollection(col_name)
        d.addIndex(col_name, ["s_id"])
        d.addIndex(col_name, ["sub_nbr"])
        d.addShardKey(col_name, ["s_id"])

        # collection ACCESS_INFO
        col_name = "ACCESS_INFO"
        d.addCollection(col_name)
        d.addIndex(col_name, ["ai_type", "s_id"])
        d.addShardKey(col_name, ["ai_type,", "s_id"])

        # collection SPECIAL_FACILITY
        col_name = "SPECIAL_FACILITY"
        d.addCollection(col_name)
        d.addIndex(col_name, ["s_id", "sf_type", "is_active"])
        d.addShardKey(col_name, ["s_id", "sf_type", "is_active"])

        # collection CALL_FORWARDING
        col_name = "CALL_FORWARDING"
        d.addCollection(col_name)
        d.addIndex(col_name, ["start_time", "sf_type", "s_id", "end_time"])
        d.addShardKey(col_name, ["start_time", "sf_type", "s_id", "end_time"])

        print d.toJSON()