Merge lp:~al-maisan/launchpad/xx-next-builder-502927 into lp:launchpad
| Status: | Merged |
|---|---|
| Merged at revision: | not available |
| Proposed branch: | lp:~al-maisan/launchpad/xx-next-builder-502927 |
| Merge into: | lp:launchpad |
| Diff against target: |
759 lines (+524/-111) 2 files modified
lib/lp/soyuz/model/buildqueue.py (+81/-0) lib/lp/soyuz/tests/test_buildqueue.py (+443/-111) |
| To merge this branch: | bzr merge lp:~al-maisan/launchpad/xx-next-builder-502927 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Graham Binns (community) | code | 2010-01-06 | Approve on 2010-01-06 |
|
Review via email:
|
|||
| Muharem Hrnjadovic (al-maisan) wrote : | # |
| Graham Binns (gmb) wrote : | # |
Hi Muharem,
Great branch this; I'm really impressed with the whole thing. Couple of
minor nitpicks but otherwise this is r=me.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -212,6 +212,83 @@
> free_builders = result_
> return free_builders
>
> + def _estimateTimeTo
> + self, head_job_processor, head_job_
> + """Estimate time until next builder becomes available.
> +
> + For the purpose of estimating the dispatch time of the job of interest
> + (JOI) we need to know how long it will take until the job at the head
> + of JOI's queue is dispatched.
> +
> + There are two cases to consider here: the head job is
> +
> + - processor dependent: only builders with the matching
> + processor/
> + - *not* processor dependent: all builders should be considered.
> +
> + :param head_job_processor: The processor required by the job at the
> + head of the queue.
> + :param head_job_
> + the job at the head of the queue.
> + :return: The estimated number of seconds untils a builder capable of
> + running the head job becomes available or None if no such builder
> + exists.
> + """
> + store = getUtility(
> +
> + # First check whether we have free builders.
> + free_builders = self._freeBuild
> + head_job_processor, head_job_
> +
> + if free_builders > 0:
> + # We have free builders for the given processor/
> + # combination -> zero delay
> + return 0
> +
> + extra_clauses = ''
> + if head_job_processor is not None:
> + # Only look at builders with specific processor types.
> + extra_clauses += """
> + AND Builder.processor = %s
> + AND Builder.virtualized = %s
> + """ % sqlvalues(
> +
> + params = sqlvalues(
> +
> + delay_query = """
> + SELECT MIN(
> + CASE WHEN
> + EXTRACT(EPOCH FROM
> + (BuildQueue.
> + (((now() AT TIME ZONE 'UTC') - Job.date_
> + THEN
> + EXTRACT(EPOCH FROM
> + (BuildQueue.
> + (((now() AT TIME ZONE 'UTC') - Job.date_
> + ELSE
> + -- Assume that jobs that have overdrawn their estimated
> + -- duration time budget will complete within 2 minutes.
> + -- This is a wild guess but has worked well so far.
As discussed on IRC, this comment should indicate that nothing will
actually break if this wild guess i...
| Muharem Hrnjadovic (al-maisan) wrote : | # |
Graham Binns wrote:
> Review: Approve code
> Hi Muharem,
>
> Great branch this; I'm really impressed with the whole thing. Couple of
> minor nitpicks but otherwise this is r=me.
Hello Graham,
thank you for being so courteous and reviewing this branch on request.
I have revised the branch to accommodate all your suggestions. Please
find the incremental diff enclosed.
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -212,6 +212,83 @@
>> free_builders = result_
>> return free_builders
>>
>> + def _estimateTimeTo
>> + self, head_job_processor, head_job_
>> + """Estimate time until next builder becomes available.
>> +
>> + For the purpose of estimating the dispatch time of the job of interest
>> + (JOI) we need to know how long it will take until the job at the head
>> + of JOI's queue is dispatched.
>> +
>> + There are two cases to consider here: the head job is
>> +
>> + - processor dependent: only builders with the matching
>> + processor/
>> + - *not* processor dependent: all builders should be considered.
>> +
>> + :param head_job_processor: The processor required by the job at the
>> + head of the queue.
>> + :param head_job_
>> + the job at the head of the queue.
>> + :return: The estimated number of seconds untils a builder capable of
>> + running the head job becomes available or None if no such builder
>> + exists.
>> + """
>> + store = getUtility(
>> +
>> + # First check whether we have free builders.
>> + free_builders = self._freeBuild
>> + head_job_processor, head_job_
>> +
>> + if free_builders > 0:
>> + # We have free builders for the given processor/
>> + # combination -> zero delay
>> + return 0
>> +
>> + extra_clauses = ''
>> + if head_job_processor is not None:
>> + # Only look at builders with specific processor types.
>> + extra_clauses += """
>> + AND Builder.processor = %s
>> + AND Builder.virtualized = %s
>> + """ % sqlvalues(
>> +
>> + params = sqlvalues(
>> +
>> + delay_query = """
>> + SELECT MIN(
>> + CASE WHEN
>> + EXTRACT(EPOCH FROM
>> + (BuildQueue.
>> + (((now() AT TIME ZONE 'UTC') - Job.date_
>> + THEN
>> + EXTRACT(EPOCH FROM
>> + (BuildQueue.
>> + (((now() AT TIME ZONE 'UTC') - Job.date_
>> + ELSE
>> + ...

Hello there!
This is the next step in getting us to a point where we can estimate build
farm job dispatch times irrespective of job type (binary build, "create source
package from recipe" job, translation job).
The dispatch time estimation requires us to know when the next builder capable
of running the job of interest (JOI) will become available. The branch at hand
adds that logic.
Tests to run:
bin/test -vv -t test_buildqueue
No "make lint" errors or warnings.