Ejemplo n.º 1
0
    def submit_single_graph(self, graph_id, algo="sarkar", deploy=False):
        lgn = lgnames[graph_id]
        fp = pkg_resources.resource_filename("dfms.dropmake", "web/{0}".format(lgn))
        lg = LG(fp)
        drop_list = lg.unroll_to_tpl()
        # node_list = self.get_avail_hosts()
        node_list = self._dc.nodes()
        pgtp = MySarkarPGTP(drop_list, len(node_list), merge_parts=True)
        pgtp.json
        pg_spec = pgtp.to_pg_spec(node_list, ret_str=False)
        if self._output:
            with open(self._output, "w") as f:
                json.dump(pg_spec, f, indent=2)
        completed_uids = [x["oid"] for x in droputils.get_roots(pg_spec)]

        ssid = "{0}-{1}".format(lgn.split(".")[0], lg._session_id)
        self._dc.create_session(ssid)
        print "session created"
        self._dc.append_graph(ssid, pg_spec)
        print "graph appended"

        if deploy:
            ret = self._dc.deploy_session(ssid, completed_uids=completed_uids)
            print "session deployed"
            return ret
Ejemplo n.º 2
0
 def test_mysarkar_pgtp_gen_pg(self):
     lgnames = ['lofar_std.json', 'chiles_two.json', 'test_grpby_gather.json', 'chiles_two_dev1.json', 'chiles_simple.json']
     tgt_partnum = [15, 15, 10, 10, 5]
     node_list = ['10.128.0.11', '10.128.0.12', '10.128.0.13']
     for i, lgn in enumerate(lgnames):
         fp = pkg_resources.resource_filename('dfms.dropmake', 'web/{0}'.format(lgn))
         lg = LG(fp)
         drop_list = lg.unroll_to_tpl()
         pgtp = MySarkarPGTP(drop_list, 3, merge_parts=True)
         pgtp.json
         pg_spec = pgtp.to_pg_spec(node_list)
Ejemplo n.º 3
0
 def produce_physical_graphs(self, graph_id, algo="sarkar", tgt="/tmp"):
     lgn = lgnames[graph_id]
     fp = pkg_resources.resource_filename("dfms.dropmake", "web/{0}".format(lgn))
     lg = LG(fp)
     drop_list = lg.unroll_to_tpl()
     node_list = self._dc.nodes()
     # node_list = ['10.128.0.11', '10.128.0.14', '10.128.0.15', '10.128.0.16']
     pgtp = MySarkarPGTP(drop_list, len(node_list), merge_parts=True)
     pgtp.json
     pg_spec = pgtp.to_pg_spec(node_list)
     with open("/{1}/sar_{0}_pgspec.json".format(lgn.split(".")[0], tgt), "w") as f:
         f.write(pg_spec)