extras-buildsys/builder Builder.py,1.8,1.9
Daniel Williams (dcbw)
fedora-extras-commits at redhat.com
Thu May 11 15:52:28 UTC 2006
Author: dcbw
Update of /cvs/fedora/extras-buildsys/builder
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22058/builder
Modified Files:
Builder.py
Log Message:
2006-05-11 Dan Williams <dcbw at redhat.com>
* builder/Builder.py
- Make Builder::cleanup() work again
- Sleep in ActiveBuilder::stop() until the thread is actually stopped
Index: Builder.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/builder/Builder.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Builder.py 11 May 2006 14:44:56 -0000 1.8
+++ Builder.py 11 May 2006 15:52:26 -0000 1.9
@@ -60,10 +60,6 @@
pass
return max_jobs
-def log(string):
- sys.stdout.write(string + "\n")
- sys.stdout.flush()
-
class Builder(object):
""" Abstract builder base object """
@@ -92,9 +88,12 @@
build_arches.append(arch)
self._log("Available architectures: [%s]" % string.join(build_arches, ", "))
- def _log(self, string):
+ def _log(self, msg, newline=True):
if self._cfg.get_bool("General", "debug"):
- log(string)
+ if newline:
+ msg = msg + "\n"
+ sys.stdout.write(msg)
+ sys.stdout.flush()
def new_builder(cfg, btype):
if btype == 'passive':
@@ -109,19 +108,18 @@
pass
def cleanup(self):
- return
- (building_jobs, free) = bcs.building_jobs()
- for jobid in building_jobs.keys():
- bcs.die(jobid)
+ self._building_jobs_lock.acquire()
+ for job in self._building_jobs:
+ job.die()
+ self._building_jobs_lock.release()
# wait for the jobs to clean up before quitting
- self._log("Waiting for running jobs to stop...")
+ self._log("Waiting for running jobs to stop...", newline=False)
while True:
- (building_jobs, free) = bcs.building_jobs()
- if len(building_jobs.keys()) == 0:
+ if len(self._building_jobs) == 0:
break
try:
- self._log(".")
+ self._log(".", newline=False)
time.sleep(0.5)
except KeyboardInterrupt:
break
@@ -405,6 +403,7 @@
def __init__(self, cfg):
Builder.__init__(self, cfg)
self._stop = False
+ self._stopped = False
self._last_comm = time.time() - self._SERVER_CONTACT_INTERVAL - 1
self._queued_cmds = []
self._xmlrpc_address = self._get_server_address(cfg.get_str("Active", "xmlrpc_port"))
@@ -554,6 +553,12 @@
resp = self._send_commands()
self._process_server_response(resp)
time.sleep(1)
+ self._stopped = True
def stop(self):
self._stop = True
+ while not self._stopped:
+ try:
+ time.sleep(0.2)
+ except KeyboardInterrupt:
+ pass
More information about the fedora-extras-commits
mailing list