Merge lp:~al-maisan/launchpad/spec-job-class-503839 into lp:launchpad
| Status: | Merged |
|---|---|
| Merged at revision: | not available |
| Proposed branch: | lp:~al-maisan/launchpad/spec-job-class-503839 |
| Merge into: | lp:launchpad |
| Diff against target: |
182 lines (+114/-3) 4 files modified
lib/lp/soyuz/configure.zcml (+10/-0) lib/lp/soyuz/interfaces/buildqueue.py (+4/-0) lib/lp/soyuz/model/buildqueue.py (+22/-3) lib/lp/soyuz/tests/test_buildqueue.py (+78/-0) |
| To merge this branch: | bzr merge lp:~al-maisan/launchpad/spec-job-class-503839 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Nelson (community) | code | 2010-01-07 | Approve on 2010-01-07 |
| Björn Tillenius | code | 2010-01-07 | Pending |
|
Review via email:
|
|||
| Muharem Hrnjadovic (al-maisan) wrote : | # |
| Michael Nelson (michael.nelson) wrote : | # |
Hi Muharem!
It's great seeing the pieces of the generalisation falling into place!
I've got one rather large question about this change: Why can't you just
use a normal adapter? It seems that you've gone the long way around to
implement adapter-like functionality.
That is, you've got a BuildFarmJobType specified on IBuildQueue.
and you want to find the corresponding class. I don't know whether it is
the best solution, but you *could* in this case, adapt the build_queue
entry itself to the correct IBuildFarmJob implementation?
IBuildFarmJob(
which would return the specifc build farm job.
I'm wondering if it's really that you need specific_
work in the build estimations, rather than specifically for this branch. That
is, originally when you were chatting with gary about using the class manager,
I had understood that you needed to *iterate* over the different
classes to build a query... in that case you would certainly need something
like the specific_
not needing to iterate them at all for this branch, and looking at this branch
in isolation would suggest that a normal adapter would be more intuitive.
If it is the case that you will need specific_
then it may indeed make sense to *not* use adaption here and re-use the
specific_
would need to define both the utility *and* the adapter. I'd like to get
BjornT's thoughts on that point, hence marking as needs information.
Some comments in line below.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -897,6 +897,16 @@
> <allow
> interface=
> </class>
> + <!--
> + The registration below is used to discover all build farm job classes
> + that implement the `IBuildFarmJob` interface. Please see bug #503839
> + for more detail.
> + The 'name' attribute needs to be set to the appropriate
> + `BuildFarmJobType` enumeration value.
> + -->
> + <utility component=
> + name="PACKAGEBUILD"
> + provides=
>
> <!-- BinaryPackageBu
> <adapter
>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -55,6 +55,10 @@
> title=_('The builder behavior required to run this job.'),
> required=False, readonly=True)
>
> + specific_
> + title=_('Job classes that may run on the build farm.'),
> + required=True, readonly=True)
> +
> estimated_duration = Timedelta(
> title=_("Estimated Job Duration"), required=True,
> description=
>
> === modified file 'lib/lp/soyuz/...
| Muharem Hrnjadovic (al-maisan) wrote : | # |
Michael Nelson wrote:
> Review: Needs Information code
> Hi Muharem!
>
> It's great seeing the pieces of the generalisation falling into place!
>
> I've got one rather large question about this change: Why can't you just
> use a normal adapter? It seems that you've gone the long way around to
> implement adapter-like functionality.
>
> That is, you've got a BuildFarmJobType specified on IBuildQueue.
> and you want to find the corresponding class. I don't know whether it is
> the best solution, but you *could* in this case, adapt the build_queue
> entry itself to the correct IBuildFarmJob implementation?
>
> IBuildFarmJob(
>
> which would return the specifc build farm job.
>
> I'm wondering if it's really that you need specific_
> work in the build estimations, rather than specifically for this branch. That
> is, originally when you were chatting with gary about using the class manager,
> I had understood that you needed to *iterate* over the different
> classes to build a query... in that case you would certainly need something
> like the specific_
> not needing to iterate them at all for this branch, and looking at this branch
> in isolation would suggest that a normal adapter would be more intuitive.
>
> If it is the case that you will need specific_
> then it may indeed make sense to *not* use adaption here and re-use the
> specific_
> would need to define both the utility *and* the adapter. I'd like to get
> BjornT's thoughts on that point, hence marking as needs information.
Hello Michael, sorry for the terse answer but, yes, I need to iterate
over the farm build job classes.
See e.g. lines 48-54 in the enclosed diff which is an excerpt from
lp:~al-maisan/launchpad/job-delays-504086, the branch I am currently
working on.
> Some comments in line below.
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -897,6 +897,16 @@
>> <allow
>> interface=
>> </class>
>> + <!--
>> + The registration below is used to discover all build farm job classes
>> + that implement the `IBuildFarmJob` interface. Please see bug #503839
>> + for more detail.
>> + The 'name' attribute needs to be set to the appropriate
>> + `BuildFarmJobType` enumeration value.
>> + -->
>> + <utility component=
>> + name="PACKAGEBUILD"
>> + provides=
>>
>> <!-- BinaryPackageBu
>> <adapter
>>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -55,6 +55,10 @@
>> title=_('The builder behavior required to run this ...
| Muharem Hrnjadovic (al-maisan) wrote : | # |
Michael Nelson wrote:
> Review: Needs Information code
[..]
> I've got one rather large question about this change: Why can't you
> just use a normal adapter? It seems that you've gone the long way
> around to implement adapter-like functionality.
>
> That is, you've got a BuildFarmJobType specified on
> IBuildQueue.
> don't know whether it is the best solution, but you *could* in this
> case, adapt the build_queue entry itself to the correct IBuildFarmJob
> implementation?
>
> IBuildFarmJob(
How would that actually work? IBuildFarmJob is not what we want here.
IBuildQueue.
BuildPackageJob instance.
> which would return the specifc build farm job.
>
> I'm wondering if it's really that you need specific_
> further work in the build estimations, rather than specifically for
That's the case indeed, sorry for not explaining that better.
> this branch. That is, originally when you were chatting with gary
> about using the class manager, I had understood that you needed to
> *iterate* over the different classes to build a query... in that case
> you would certainly need something like the specific_
> you've provided below. But as it is, you are not needing to iterate
> them at all for this branch, and looking at this branch in isolation
> would suggest that a normal adapter would be more intuitive.
Sorry for not explaining in more detail why this is needed please see my
previous email for an example where I do need to iterate over the build
farm job classes.
I also expect that that's something that will be needed when we
generalize the candidate job selection.
> If it is the case that you will need specific_
> branch, then it may indeed make sense to *not* use adaption here and
> re-use the specific_
As stated in the previous reply I do require the iteration over the build
farm job classes for the purpose of job dispatch time estimation.
Being able to register build farm classes in the way suggested makes it
also much easier to test the code.
Please see the end of the diff (lines 193-222) enclosed in my previous
reply for an example.
[..]
Best regards
--
Muharem Hrnjadovic <email address hidden>
Public key id : B2BBFCFC
Key fingerprint : A5A3 CC67 2B87 D641 103F 5602 219F 6B60 B2BB FCFC
| Michael Nelson (michael.nelson) wrote : | # |
Great, thanks for the info Muharem.
So given that you need the class iteration, I'm keen to approve this now (assuming you address the issues I mentioned above inline).
Thanks!
| Muharem Hrnjadovic (al-maisan) wrote : | # |
Michael Nelson wrote:
[..]
Hello Michael,
thanks again for taking the time to review this branch despite your own
busy schedule. That's very much appreciated :)
> Some comments in line below.
Please see my replies as well as the enclosed incremental diff.
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -897,6 +897,16 @@
>> <allow
>> interface=
>> </class>
>> + <!--
>> + The registration below is used to discover all build farm job classes
>> + that implement the `IBuildFarmJob` interface. Please see bug #503839
>> + for more detail.
>> + The 'name' attribute needs to be set to the appropriate
>> + `BuildFarmJobType` enumeration value.
>> + -->
>> + <utility component=
>> + name="PACKAGEBUILD"
>> + provides=
>>
>> <!-- BinaryPackageBu
>> <adapter
>>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -55,6 +55,10 @@
>> title=_('The builder behavior required to run this job.'),
>> required=False, readonly=True)
>>
>> + specific_
>> + title=_('Job classes that may run on the build farm.'),
>> + required=True, readonly=True)
>> +
>> estimated_duration = Timedelta(
>> title=_("Estimated Job Duration"), required=True,
>> description=
>>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -57,11 +57,31 @@
>> return IBuildFarmJobBe
>>
>> @property
>> + def specific_
>> + """See `IBuildQueue`."""
>> + from zope.component import getSiteManager
>> + from lp.buildmaster.
>
> Is there a reason for these imports to be inline? If so, please add a
> comment or otherwise move them as per the guidelines.
No other code in the module uses them. I have added a comment to that
effect.
>> +
>> + job_classes = []
>> + components = getSiteManager()
>> + # Get all components that implement the `IBuildFarmJob` interface.
>> + implementations = sorted(
>> + # The above yields a collection of 2-tuples where the first element
>> + # is the name of the `BuildFarmJobType` enum and the second element
>> + # is the implementing class respectively.
>> + for job_enum_name, job_class in implementations:
>> + job_enum = getattr(
>
> I was originally going to say that we should be checking first with
> safe_hasat...
| Michael Nelson (michael.nelson) wrote : | # |
On Thu, Jan 7, 2010 at 8:57 PM, Muharem Hrnjadovic
<email address hidden> wrote:
> Michael Nelson wrote:
> [..]
>
> Hello Michael,
>
> thanks again for taking the time to review this branch despite your own
> busy schedule. That's very much appreciated :)
No probs!
>
>> Some comments in line below.
> Please see my replies as well as the enclosed incremental diff.
>
>>> === modified file 'lib/lp/
>>> --- lib/lp/
>>> +++ lib/lp/
>>> @@ -57,11 +57,31 @@
>>> return IBuildFarmJobBe
>>>
>>> @property
>>> + def specific_
>>> + """See `IBuildQueue`."""
>>> + from zope.component import getSiteManager
>>> + from lp.buildmaster.
>>
>> Is there a reason for these imports to be inline? If so, please add a
>> comment or otherwise move them as per the guidelines.
> No other code in the module uses them. I have added a comment to that
> effect.
Erm... I didn't realise that was a valid reason? I thought we only did
so if we *had* to (ie. circular imports etc.). Please check our
styleguide... I'm going from memory but I thought the imports should
always be at the top even if no other code in the module uses them.
Cheers, and happy flying!
-Michael
| Muharem Hrnjadovic (al-maisan) wrote : | # |
Michael Nelson wrote:
> On Thu, Jan 7, 2010 at 8:57 PM, Muharem Hrnjadovic
> <email address hidden> wrote:
>> Michael Nelson wrote:
>> [..]
>>
>> Hello Michael,
>>
>> thanks again for taking the time to review this branch despite your own
>> busy schedule. That's very much appreciated :)
>
> No probs!
>
>>> Some comments in line below.
>> Please see my replies as well as the enclosed incremental diff.
>>
>>>> === modified file 'lib/lp/
>>>> --- lib/lp/
>>>> +++ lib/lp/
>>>> @@ -57,11 +57,31 @@
>>>> return IBuildFarmJobBe
>>>>
>>>> @property
>>>> + def specific_
>>>> + """See `IBuildQueue`."""
>>>> + from zope.component import getSiteManager
>>>> + from lp.buildmaster.
>>> Is there a reason for these imports to be inline? If so, please add a
>>> comment or otherwise move them as per the guidelines.
>> No other code in the module uses them. I have added a comment to that
>> effect.
>
> Erm... I didn't realise that was a valid reason? I thought we only did
> so if we *had* to (ie. circular imports etc.). Please check our
> styleguide... I'm going from memory but I thought the imports should
> always be at the top even if no other code in the module uses them.
Whoops .. sorry .. and thanks for catching this :)
> Cheers, and happy flying!
Thank you! Have a safe journey as well :)
Best regards
--
Muharem Hrnjadovic <email address hidden>
Public key id : B2BBFCFC
Key fingerprint : A5A3 CC67 2B87 D641 103F 5602 219F 6B60 B2BB FCFC

Hello there!
This is another step in the renovation of the (Soyuz) build farm. Now that
we're introducing additional build farm job types we need to be able to figure
out what these are without hardcoding that information.
This is mostly required by the general build farm infrastructure i.e. for the
purpose of job dispatch time estimation and candidate job selection.
Pre-implementation discussion (via email) with Gary Poster and others.
Tests to run:
bin/test -vv -t TestJobClasses
No pertinent "make lint" errors or warnings.
Please see also bug #503839 for more detail.