<div dir="ltr"><div><br></div>I think indeed, this is such a case were you would need to actually store some part of the config in the object inside checkConfig.<div>Like you already pointed out there are already some of the objects (if I recall correctly the worker are doing that) that are doing that for the same reason.</div><div><br></div><div>Looks like you are at the point were you could start sharing the code. I think it would be easier to discuss this in a PR even if this is not fully finished.</div><div><br></div><div>Pierre</div></div><br><div class="gmail_quote"><div dir="ltr">Le jeu. 22 déc. 2016 à 17:08, Neil Gilmore <<a href="mailto:ngilmore@grammatech.com">ngilmore@grammatech.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Good morning everyone,<br class="gmail_msg">
<br class="gmail_msg">
As you remember, we're having a lot of trouble related to schedulers in<br class="gmail_msg">
0.9.X not being reconfigurable in any meaningful sense of the word. I<br class="gmail_msg">
got the go-ahead to try to make a patch for this. Unfortunately, I've<br class="gmail_msg">
run into a fairly serious problem.<br class="gmail_msg">
<br class="gmail_msg">
The advice I was given was (in a nutshell) to take the code in the<br class="gmail_msg">
various schedulers' __init__ functions, and spread it into 2 functions.<br class="gmail_msg">
checkConfig() would check its arguments for validity, and<br class="gmail_msg">
reconfigService() would put them into the instance. Sure, there were<br class="gmail_msg">
some various snags at first. Partly, I'm not used to Python's<br class="gmail_msg">
argument-passing model. Partly, figuring out which arguments needed to<br class="gmail_msg">
get passed where. Partly, figuring out that name should only exist in<br class="gmail_msg">
the __init__'s, not the checkConfig's, etc.<br class="gmail_msg">
<br class="gmail_msg">
What happens when we create a scheduler is this:<br class="gmail_msg">
<br class="gmail_msg">
The scheduler's __init__ function is called. This calls it's base<br class="gmail_msg">
class's __init__, and so on, up to BuildbotService.__init__. Note that<br class="gmail_msg">
all arguments must be preserved during these calls. You'll see why.<br class="gmail_msg">
<br class="gmail_msg">
BuildbotService.__init__ calls checkConfig. Now, this call goes to the<br class="gmail_msg">
scheduler's checkConfig, which checks its own specific arguments, then<br class="gmail_msg">
passes everything else up to it's base class's checkConfig, and so on.<br class="gmail_msg">
<br class="gmail_msg">
Everything,s great, right? Wrong...<br class="gmail_msg">
<br class="gmail_msg">
At this point, we have validated everything. But only the name is in the<br class="gmail_msg">
instance. Because everything else is supposed to get assigned in<br class="gmail_msg">
reconfigService.<br class="gmail_msg">
<br class="gmail_msg">
But in between __init__ and reconfigService, other things happen. Such<br class="gmail_msg">
as check_single_master() (at least for single master systems). That<br class="gmail_msg">
attempts to check the builder names in the schedulers vs. the builders'<br class="gmail_msg">
names in the config. Naturally, this fails because the builder names<br class="gmail_msg">
haven't been put into the schedulers yet. And it would go on to check<br class="gmail_msg">
other things that probably fail, too.<br class="gmail_msg">
<br class="gmail_msg">
I'm not sure how to resolve this. The hacktastic way would be to just<br class="gmail_msg">
figure out what might ever get checked and put that back into __init__.<br class="gmail_msg">
But that's not very clean. The proper way would be to figure out how to<br class="gmail_msg">
make a scheduler reconcile it's own builderNames, et al. with the<br class="gmail_msg">
builders in the config. But I'd need to be able to get the config being<br class="gmail_msg">
checked, and I haven't figured out how to do that. There's other checks<br class="gmail_msg">
that go between items like this that I'd need to do, too.<br class="gmail_msg">
<br class="gmail_msg">
Really, I'm just uncomfortable having this task spread out into other<br class="gmail_msg">
areas of buildbot.<br class="gmail_msg">
<br class="gmail_msg">
Or I just go back to our 80% solution and hack checkConfig...<br class="gmail_msg">
<br class="gmail_msg">
Neil Gilmore<br class="gmail_msg">
<a href="http://grammatech.com" rel="noreferrer" class="gmail_msg" target="_blank">grammatech.com</a><br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
users mailing list<br class="gmail_msg">
<a href="mailto:users@buildbot.net" class="gmail_msg" target="_blank">users@buildbot.net</a><br class="gmail_msg">
<a href="https://lists.buildbot.net/mailman/listinfo/users" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.buildbot.net/mailman/listinfo/users</a><br class="gmail_msg">
</blockquote></div>