extras-buildsys/builder Builder.py,1.1,1.2 BuilderMock.py,1.1,1.2
Daniel Williams (dcbw)
fedora-extras-commits at redhat.com
Wed May 3 04:04:30 UTC 2006
- Previous message (by thread): extras-buildsys/common Commands.py,1.1,1.2 HTTPServer.py,1.13,1.14
- Next message (by thread): extras-buildsys/server ArchJob.py, 1.27, 1.28 Builder.py, 1.34, 1.35 PackageJob.py, 1.45, 1.46
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: dcbw
Update of /cvs/fedora/extras-buildsys/builder
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15275/builder
Modified Files:
Builder.py BuilderMock.py
Log Message:
2006-05-03 Dan Williams <dcbw at redhat.com>
More builder/server comm rework;
- Add job status command
- implement repo unlock command
- fix bugs
Index: Builder.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/builder/Builder.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Builder.py 28 Apr 2006 03:17:35 -0000 1.1
+++ Builder.py 3 May 2006 04:04:27 -0000 1.2
@@ -99,7 +99,7 @@
def repo_unlocked(self, uniqid):
try:
job = self._all_jobs[uniqid]
- job.repo_unlocked()
+ job.unlock_repo()
except KeyError:
pass
return 0
@@ -271,6 +271,32 @@
self._log(msg)
return (uniqid, msg)
+ def _get_building_jobs_cmd(self):
+ jobs_list = []
+ cmd = Commands.PlgCommandBuildingJobs(self._seq_gen.next())
+ self._building_jobs_lock.acquire()
+ for job in self._building_jobs:
+ cmd.add_job(job.uniqid(), job.status())
+ self._building_jobs_lock.release()
+ return cmd
+
+ def _handle_unlock_repo_request(self, cmd):
+ uniqid = cmd.archjob_id()
+ self._building_jobs_lock.acquire()
+ for item in self._building_jobs:
+ if job.uniqid() == uniqid:
+ job.unlock_repo()
+ self._building_jobs_lock.release()
+
+ def _handle_job_status_request(self, cmd):
+ reply = None
+ try:
+ uniqid = cmd.archjob_id()
+ job = self._all_jobs[uniqid]
+ reply = Commands.PlgCommandJobStatusAck(uniqid, job.status(), cmd.seq(), self._seq_gen.next())
+ except KeyError, e:
+ pass
+ return reply
class PassiveBuilder(Builder):
"""
@@ -405,6 +431,8 @@
cmd = Commands.PlgCommandSlots(free, max, next_seq)
defcmds.append(cmd)
+ defcmds.append(self._get_building_jobs_cmd())
+
return defcmds
def _send_commands(self):
@@ -438,6 +466,12 @@
(uniqid, msg) = self._start_new_job(cmd.target_dict(), cmd.srpm_url())
ack = Commands.PlgCommandNewJobAck(uniqid, msg, cmd.seq(), self._seq_gen.next())
self._queued_cmds.append(ack)
+ elif isinstance(cmd, Commands.PlgCommandUnlockRepo):
+ self._handle_unlock_repo_request(cmd)
+ elif isinstance(cmd, Commands.PlgCommandJobStatus):
+ reply = self._handle_job_status_request()
+ if reply:
+ self._queued_cmds = self._queued_cmds + reply
def _process_server_response(self, response):
"""Process the server's response."""
Index: BuilderMock.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/builder/BuilderMock.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BuilderMock.py 28 Apr 2006 03:17:35 -0000 1.1
+++ BuilderMock.py 3 May 2006 04:04:27 -0000 1.2
@@ -493,7 +493,7 @@
def files(self):
return self._files
- def repo_unlocked(self):
+ def unlock_repo(self):
self._repo_locked = False
def is_done_status(self):
- Previous message (by thread): extras-buildsys/common Commands.py,1.1,1.2 HTTPServer.py,1.13,1.14
- Next message (by thread): extras-buildsys/server ArchJob.py, 1.27, 1.28 Builder.py, 1.34, 1.35 PackageJob.py, 1.45, 1.46
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list