Exemplo n.º 1
0
 def do_work(self, central_db_obj, sched_db_obj, trace_id=None):
     """
     Args:
     - central_db_obj: DB object configured to access the analysis database.
     - sched_db_obj: DB object configured to access the slurm database of
         an experiment worker. 
     - trace_id: If set to an experiment valid trace_id, it runs only the
         experiment identified by trace_id.
     """
     there_are_more=True
     while there_are_more:
         ed = ExperimentDefinition()
         if trace_id:
             ed.load(central_db_obj, trace_id)
             ed.mark_pre_simulating(central_db_obj)
         else:
             there_are_more = ed.load_fresh(central_db_obj)
         if there_are_more:
             print(("About to run exp({0}):{1}".format(
                             ed._trace_id, ed._name)))
             er = ExperimentRunner(ed)
             if(er.do_full_run(sched_db_obj, central_db_obj)):
                 print(("Exp({0}) Done".format(
                                              ed._trace_id)))
             else:
                 print(("Exp({0}) Error!".format(
                                              ed._trace_id)))
         if trace_id:
             break  
Exemplo n.º 2
0
    def test_do_full_run(self):
        sched_db_obj = DB(self._vm_ip, "slurm_acct_db",
                          os.getenv("SLURMDB_USER", None),
                          os.getenv("SLURMDB_PASS", None))
        trace = ResultTrace()
        self.addCleanup(self._del_table, "traces")
        trace.create_trace_table(self._db, "traces")

        ExperimentRunner.configure(trace_folder="/tmp/",
                                   trace_generation_folder="tmp",
                                   local=False,
                                   run_hostname=self._vm_ip,
                                   run_user=None,
                                   scheduler_conf_dir="/scsf/slurm_conf",
                                   local_conf_dir="configs/",
                                   scheduler_folder="/scsf/",
                                   drain_time=100)
        ensureDir("tmp")
        ed = ExperimentDefinition(seed="seeeed",
                                  machine="edison",
                                  trace_type="single",
                                  manifest_list=[{
                                      "share": 1.0,
                                      "manifest": "manifestSim.json"
                                  }],
                                  workflow_policy="period",
                                  workflow_period_s=5,
                                  workflow_handling="single",
                                  preload_time_s=60,
                                  start_date=datetime(2016, 1, 1),
                                  workload_duration_s=1800)
        self.addCleanup(self._del_table, "experiment")
        ed.create_table(self._db)
        ed.store(self._db)

        er = ExperimentRunner(ed)
        self.assertTrue(er.do_full_run(sched_db_obj, self._db))