~loyalinfo/openerp-tools/trunk

« back to all changes in this revision

Viewing changes to openerp-runbot/openerprunbot/jobs/install_all.py

  • Committer: Olivier Dony
  • Date: 2013-10-29 20:26:27 UTC
  • Revision ID: odo@openerp.com-20131029202627-lp9lmym0clnpqmwt
[FIX] runbot: try to know if the server of a job is really still running

This should hopefully prevent leaving `Connect`
buttons for dead jobs. The old system was counting
the last N jobs and guessing that the job was
still alive, but it was often off by a few
due to sticky branches that were skipped by the
reaper

Show diffs side-by-side

added added

removed removed

Lines of Context:
374
374
        if self.running_server_pid:
375
375
            kill(self.running_server_pid, signal.SIGTERM)
376
376
            threading.Timer(3, kill, [self.running_server_pid, signal.SIGKILL]).start()
 
377
            self.running_server_pid = 0
377
378
        if self.client_web_pid:
378
379
            kill(self.client_web_pid)
 
380
            threading.Timer(3, kill, [self.client_web_pid, signal.SIGKILL]).start()
 
381
            self.client_web_pid = 0
379
382
        subprocess.call(["psql","postgres","-c","select pg_terminate_backend(pid) from pg_stat_activity where datname in ('%s','%s')"%(self.db,self.db_all)])
380
 
        subprocess.call(["dropdb", self.db])
381
 
        subprocess.call(["dropdb", self.db_all])
 
383
        subprocess.call(["dropdb", "--if-exists", self.db])
 
384
        subprocess.call(["dropdb", "--if-exists", self.db_all])
382
385
        run(["rm", "-rf", self.server_path])
383
386
 
384
387
    def save_json(self):