Exemplo n.º 1
0
 def testBudgetApply(self):
     self.serv = BudgetApplyServer(self.dir_, Settings(), rpc_server=self.rpc_server)
     self.cli1 = BudgetApplyClient(self.serv)
     self.cli2 = BudgetApplyClient('localhost:%s'%self.port)
         
     try:
         self.serv.set_budgets(90)
         self.assertEqual(self.cli1.apply(50), 50)
         self.assertEqual(self.cli2.apply(50), 40)
             
         self.cli1.finish(50)
         self.assertEqual(50, self.serv.finished)
         self.cli2.finish(50)
         self.assertEqual(90, self.serv.finished)
             
         self.cli1.error(10)
         self.assertEqual(90, self.serv.applied)
         self.serv.finished = 0
         self.cli2.error(10)
         self.assertEqual(80, self.serv.applied)
     finally:
         self.serv.shutdown()
Exemplo n.º 2
0
 def _init_budget_server(self):
     budget_dir = os.path.join(self.working_dir, 'budget')
     self.budget_server = BudgetApplyServer(budget_dir,
                                            self.settings,
                                            rpc_server=self.rpc_server,
                                            app_name=self.job_name)