Comment 5 for bug 487009

Revision history for this message
Michael Nelson (michael.nelson) wrote :

Hrm, I just played with the above suggestion - but afaics I can only do that by introducing knowledge of the different build types and behaviours into the job class (well, BuildQueue item - it's the one with the job_type attribute).

Currently, all the knowledge of types and behaviours is restricted to the lp.buildmaster.interfaces.buildfarmjob and the zcml configuration, so to create a new job type, for example, you would:

1. Create a new db item on the BuildFarmJobType enum in buildfarmjob.py
2. Add the marker interface for the job type, also in buildfarmjob.py
3. Add your custom build behaviour in your own code, and then
4. Update the zcml configuration so that your new type can be adapted to your new behaviour.

On the other hand, if I update so that the adaption is on BuildQueue (using the _init() to set the marker interface depending on the job_type), then (2) above would be replaced with:

2b. Update BuildQueue._init() to set the correct marker interface for your new job type, where the _init() method needs to know about all BuildFarmJobType's and their related behaviours.

I personally like the current implementation better (knowledge of different types/behaviours only required in the one place) but will switch it if you guys think it should definitely otherwise. Let me know.