extras-buildsys/common Commands.py,1.7,1.8

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Sun May 14 05:43:09 UTC 2006


Author: dcbw

Update of /cvs/fedora/extras-buildsys/common
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2964/common

Modified Files:
	Commands.py 
Log Message:
2006-05-14  Dan Williams  <dcbw at redhat.com>

    * Rework archjob handling.  They are now processed from the owning
    PackageJob object, and only one is spawned for the lifetime of the
    PackageJob for each architecture (previously one was spawned for each
    individual build job on the builder).  Archjob UIDs are generated on
    the server now rather than the builder.

    * Correctly handle builders going away before they've had a chance to
    notify the server that they have started an archjob.  Previously, these
    jobs would just be lost.  This is the real reason for the rework of the
    archjob handling above.

    * On the builder, don't use die() to end jobs that have failed; do it
    properly and upload files to the server if we weren't killed

    * Deal with active builders whose hostnames can't be resolved when
    the server starts

    * Kill any existing jobs on builders when the server starts up

    * Consolidate and simplify logging functions in PackageJob

    * More pylint-induced cleanups




Index: Commands.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/common/Commands.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Commands.py	12 May 2006 04:04:05 -0000	1.7
+++ Commands.py	14 May 2006 05:43:06 -0000	1.8
@@ -330,11 +330,19 @@
 
     _need_ack = True
 
-    def __init__(self, parent_job, target_dict, srpm_url, seq=0):
+    def __init__(self, archjob, target_dict=None, srpm_url=None, archjob_id=None, seq=0):
         PlgCommand.__init__(self, CMD_NAME_NEW_JOB_REQ, seq)
-        self._parent_job = parent_job  # doesn't get serialized
-        self._target_dict = target_dict
-        self._srpm_url = srpm_url
+        self._archjob = archjob  # doesn't get serialized
+        if archjob:
+            self._target_dict = archjob.target_dict()
+            self._srpm_url = archjob.srpm_url()
+            self._archjob_id = archjob.archjob_id()
+        else:
+            if not target_dict or not srpm_url or not archjob_id:
+                raise Exception("Need a target_dict, an srpm_url, and an archjob_id.")
+            self._target_dict = target_dict
+            self._srpm_url = srpm_url
+            self._archjob_id = archjob_id
 
     def _deserialize(args):
         try:
@@ -345,8 +353,12 @@
             srpm_url = args['srpm_url']
         except (KeyError, TypeError):
             raise ValueError("No 'srpm_url' argument found.")
+        try:
+            archjob_id = args['archjob_id']
+        except (KeyError, TypeError):
+            raise ValueError("No 'archjob_id' argument found.")
 
-        return PlgCommandNewJobReq(None, target_dict, srpm_url)
+        return PlgCommandNewJobReq(None, target_dict, srpm_url, archjob_id)
 
     _deserialize = staticmethod(_deserialize)
 
@@ -354,10 +366,11 @@
         args = {}
         args['target_dict'] = self._target_dict
         args['srpm_url'] = self._srpm_url
+        args['archjob_id'] = self._archjob_id
         return PlgCommand._serialize(self, args)
 
-    def parent_job(self):
-        return self._parent_job
+    def archjob(self):
+        return self._archjob
 
     def target_dict(self):
         return self._target_dict
@@ -365,8 +378,12 @@
     def srpm_url(self):
         return self._srpm_url
 
+    def archjob_id(self):
+        return self._archjob_id
+
     def __str__(self):
-        return "%s(seq: %d, target_dict: %s, srpm_url: %s)" % (self._name, self._seq, self._target_dict, self._srpm_url)
+        return "%s(seq: %d, target_dict: %s, srpm_url: %s, archjob_id: %s)" % (self._name,
+                self._seq, self._target_dict, self._srpm_url, self._archjob_id)
 
 
 class PlgCommandNewJobAck(PlgCommandAck):




More information about the fedora-extras-commits mailing list