Ejemplo n.º 1
0
def solver_result(Uid):
"""
   copy solution by scp and report to server
"""
   # copy solution files
   scp_sol(Uid)

   # report the poly has been solved
   data = "23%s%s"%(solver_id,Uid)
   
   data = retry_exchange_msg(data)
   
   solver_sleep = 0
   return solver_sleep
Ejemplo n.º 2
0
def solver_solve():
   data = '21%s' % solver_id
   
   data = retry_exchange_msg(data)
   
   solver_sleep = 1
   Uid = data[1:1+client_id_len]
   print "Uid = " + Uid
   if data[0] =='1':
      # new poly system to solve
      if Uid!= 'Empty':
         pid = PHC_Solve(Uid,data[1+client_id_len:])
         Userproc[Uid]= pid
         with open(Uid+'.pid', 'w') as f:
            f.write(data)
         f.close()
      solver_sleep = 0
   return solver_sleep
Ejemplo n.º 3
0
def solver_kill():
   # job to kill
   data = '22%s' % solver_id

   data = retry_exchange_msg(data)
   
   solver_sleep = 1
   if data[0] =='2':
      Uid = data[1:1+client_id_len]
      print "Uid = " + Uid
      print Uid + " to kill"
      if Uid in Userproc:
         Pid = Userproc[Uid]
         PHC_Kill(Pid,Uid)
         del Userproc[Uid]
      else:
         print "no such a process"
      solver_sleep = 0
   return solver_sleep