Code review comment for lp:~michael.nelson/launchpad/db-build-farm-job-model
- db-build-farm-job-model
- Merge into db-devel
Revision history for this message
Michael Nelson (michael.nelson) wrote : | # |
1 | === modified file 'lib/lp/buildmaster/interfaces/buildfarmjob.py' |
2 | --- lib/lp/buildmaster/interfaces/buildfarmjob.py 2010-04-21 16:08:35 +0000 |
3 | +++ lib/lp/buildmaster/interfaces/buildfarmjob.py 2010-04-23 12:13:43 +0000 |
4 | @@ -67,14 +67,14 @@ |
5 | IProcessor, title=_("Processor"), required=False, readonly=True, |
6 | description=_( |
7 | "The Processor required by this build farm job. " |
8 | - "For processor-independent job types please return None.")) |
9 | + "This should be None for processor-independent job types.")) |
10 | |
11 | virtualized = Bool( |
12 | title=_('Virtualized'), required=False, readonly=True, |
13 | description=_( |
14 | "The virtualization setting required by this build farm job. " |
15 | - "For job types that do not care about virtualization please " |
16 | - "return None.")) |
17 | + "This should be None for job types that do not care whether " |
18 | + "they run virtualized.")) |
19 | |
20 | date_created = Datetime( |
21 | title=_("Date created"), required=True, readonly=True, |
22 | @@ -90,7 +90,7 @@ |
23 | |
24 | date_first_dispatched = Datetime( |
25 | title=_("Date finished"), required=False, readonly=True, |
26 | - description=_("The timestamp when the build farm job was finished.")) |
27 | + description=_("The timestamp when the build farm job was dispatched.")) |
28 | |
29 | builder = Reference( |
30 | title=_("Builder"), schema=IBuilder, required=False, readonly=True, |
31 | @@ -98,7 +98,7 @@ |
32 | |
33 | status = Choice( |
34 | title=_('Status'), required=True, |
35 | - # Really PackagePublishingPocket, patched in |
36 | + # Really BuildStatus, patched in |
37 | # _schema_circular_imports.py |
38 | vocabulary=DBEnumeratedType, |
39 | description=_("The current status of the job.")) |
40 | |
41 | === modified file 'lib/lp/buildmaster/model/buildfarmjob.py' |
42 | --- lib/lp/buildmaster/model/buildfarmjob.py 2010-04-21 16:08:35 +0000 |
43 | +++ lib/lp/buildmaster/model/buildfarmjob.py 2010-04-23 12:20:34 +0000 |
44 | @@ -71,10 +71,8 @@ |
45 | job_type = DBEnum( |
46 | name='job_type', allow_none=False, enum=BuildFarmJobType) |
47 | |
48 | - def __init__(self, job_type, status=None, processor=None, |
49 | - virtualized=None): |
50 | - if status is None: |
51 | - status = BuildStatus.NEEDSBUILD |
52 | + def __init__(self, job_type, status=BuildStatus.NEEDSBUILD, |
53 | + processor=None, virtualized=None): |
54 | self.job_type, self.status, self.process, self.virtualized = ( |
55 | job_type, |
56 | status, |
57 | @@ -83,7 +81,7 @@ |
58 | ) |
59 | |
60 | @classmethod |
61 | - def new(cls, job_type, status=None, processor=None, |
62 | + def new(cls, job_type, status=BuildStatus.NEEDSBUILD, processor=None, |
63 | virtualized=None): |
64 | """See `IBuildFarmJobSource`.""" |
65 | build_farm_job = BuildFarmJob( |
On Fri, Apr 23, 2010 at 12:53 PM, Abel Deuring
<email address hidden> wrote:
> Hi Michael,
>
> a nice branch; just just have a few formal nitpicks.
Thanks Abel, comments below.
> buildmaster/ interfaces/ buildfarmjob. py' buildmaster/ interfaces/ buildfarmjob. py 2010-04-21 07:15:40 +0000 buildmaster/ interfaces/ buildfarmjob. py 2010-04-22 07:42:23 +0000 ource', erived' , launchpad. interfaces. librarian import ILibraryFileAlias interfaces. builder import IBuilder interfaces. processor import IProcessor Interface) : ("Processor" ), required=False, readonly=True, independent job types please return None.")) independent jobs"?
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -9,15 +9,20 @@
>>
>> __all__ = [
>> 'IBuildFarmJob',
>> + 'IBuildFarmJobS
>> 'IBuildFarmJobD
>> 'BuildFarmJobType',
>> ]
>>
>> from zope.interface import Interface, Attribute
>> -
>> -from canonical.launchpad import _
>> +from zope.schema import Bool, Choice, Datetime
>> from lazr.enum import DBEnumeratedType, DBItem
>> from lazr.restful.fields import Reference
>> +
>> +from canonical.launchpad import _
>> +from canonical.
>> +
>> +from lp.buildmaster.
>> from lp.soyuz.
>>
>>
>> @@ -56,6 +61,66 @@
>> class IBuildFarmJob(
>> """Operations that jobs for the build farm must implement."""
>>
>> + id = Attribute('The build farm job ID.')
>> +
>> + processor = Reference(
>> + IProcessor, title=_
>> + description=_(
>> + "The Processor required by this build farm job. "
>> + "For processor-
>
> It is perhaps my limited English knowledge, but this sounds to me
> like a polite request to the implementation class to do the right
> thing ;) What about "should|must be None for processor-
Yep. This was just a copy-n-paste, but you're right. Updated.
> ('Virtualized' ), required=False, readonly=True,
>
>> +
>> + virtualized = Bool(
>> + title=_
>> + description=_(
>> + "The virtualization setting required by this build farm job. "
>> + "For job types that do not care about virtualization please "
>> + "return None."))
>
> Same here.
Ditto.
> dispatched = Datetime( dispatched/
>> +
>> + date_created = Datetime(
>> + title=_("Date created"), required=True, readonly=True,
>> + description=_("The timestamp when the build farm job was created."))
>> +
>> + date_started = Datetime(
>> + title=_("Date started"), required=False, readonly=True,
>> + description=_("The timestamp when the build farm job was started."))
>> +
>> + date_finished = Datetime(
>> + title=_("Date finished"), required=False, readonly=True,
>> + description=_("The timestamp when the build farm job was finished."))
>> +
>> + date_first_
>> + title=_("Date finished"), required=False, readonly=True,
>> + description=_("The timestamp when the build farm job was finished."))
>
> s/finished/
Done.
> ngPocket, patched in hingPocket/ BuildStatus/
>> +
>> + builder = Reference(
>> + title=_("Builder"), schema=IBuilder, required=False, readonly=True,
>> + description=_("The builder assigned to this job."))
>> +
>> + status = Choice(
>> + title=_('Status'), required=True,
>> + # Really PackagePublishi
>
> s/PackagePublis
Done.
> urce(Interface) : buildbase isn't that basic ;) I'm wondering BuildStatus. PENDING
> [...]
>
>> @@ -149,3 +202,17 @@
>> accurately based on this job's properties.
>> """
>>
>> +
>> +class IBuildFarmJobSo
>> + """A utility of BuildFarmJob used to create _things_."""
>> +
>> + def new(job_type, status=None, processor=None,
>> + virtualized=None):
>> + """Create a new `IBuildFarmJob`.
>> +
>> + :param job_type: A `BuildFarmJobType` item.
>> + :param status: A `BuildStatus` item, defaulting to PENDING.
>> + :param processor: An optional processor for this job.
>> + :param virtualized: An optional boolean indicating whether
>> + this job should be run virtualized.
>> + """
>
> I understand that you use status=None because you can't import BuildStatus
> here. Seems that interfaces.
> if it is worth to move the definition of BuildStatus into another module
> like "realbuildbase" which does not import anything "build related" --
> I simply prefer to see a default value status=
> in the method definition. Even more, because you have this pattern "None
> means pending" in two method (new and __init__) in ther implementation.
Yes, it will *need* to be moved (as IBuildStatus will be removed NEEDSBUILD here now. You were
later), and the logical place is actually here with IBuildFarmJob. I'm
not keen to do that move as part of this branch, but funnily, I'm able
to use the default value of BuildStatus.
right about why I'd set it to None initially, but I must have resolved
the import issue, as it works fine now. Thanks!
> buildmaster/ model/packagebu ildfarmjob. py' buildmaster/ model/packagebu ildfarmjob. py 2010-04-20 14:38:20 +0000 buildmaster/ model/packagebu ildfarmjob. py 2010-04-22 07:42:23 +0000 rmJob) ildFarmJob, self).__init__()
> [...]
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -26,7 +26,9 @@
>> itself a concrete class. This class (PackageBuildFa
>> will also be renamed PackageBuild and turned into a concrete class.
>> """
>> - super(PackageBu
>> + # Classes that initialise with a build are not yet using
>> + # the concrete class, so we don't call the superclass'
>> + # initialisation.
>
> Is this a candidate for an XXX, i.e., are you planning to call super()
> once the "transition period" is over?
It is, and the XXX is already included in the docstring (only part of
which you can see here).
Thanks Abel. /code.edge. launchpad. net/~michael. nelson/ launchpad/ db-build- farm-job- model/+ merge/23913 /lists. ubuntu. com/mailman/ listinfo/ launchpad- reviews
>
> --
> https:/
> Your team Launchpad code reviewers from Canonical is subscribed to branch lp:launchpad.
>
> --
> launchpad-reviews mailing list
> <email address hidden>
> https:/
>