/srv/irclogs.ubuntu.com/2015/05/20/#juju-gui.txt

=== kadams54 is now known as kadams54-away
=== urulama__ is now known as urulama
frankbanlazyPower: ping10:36
lazyPowerfrankban: pong13:30
frankbanlazyPower: it seems that the services framework doesn't automatically handle setting data on established relations when a relevant config is changed on a service, correct?13:32
lazyPowerAh, I'm not sure. I'm not terribly familiar with the services framework. cory_fu would be a good candidate to answer that question, let me see if i can get him in here13:33
frankbanlazyPower: FWIW I am writing a redis charm with the services framework, it would be awesome if you'll be able to take a look at it when it's ready.13:33
lazyPower!!13:34
lazyPowerawesome!13:34
lazyPowerthanks cory_fu. 13:34
cory_fulazyPower: np13:34
lazyPowerrepost: <frankban> lazyPower: it seems that the services framework doesn't automatically handle setting data on established relations when a relevant config is changed on a service, correct?13:34
cory_fufrankban: The provide_data method on relations in the provided_data block is called for every hook that is handled by manage().  As long as that function is returning data from hookenv.config() or what-have-you, and the config-changed hook is also handled by manage(), it should reflect changes on established relations13:36
frankbanlazyPower: and also FYI, some doc improvements would help there, especially re relation contexts. The redis charm I am working on will support master-slave relations of two services deployed from the same charm: I have a solution but I am not sure if it's idiomatic13:36
cory_fuThat said, the provides side of the framework is decidedly lacking polish, for sure.13:36
lazyPowerfrankban: charms that change behavior on role make sense. we have quite a few of those already13:37
frankbancory_fu: in provide_data relation_set is called only if if re.match(r'{}-relation-(joined|changed)'.format(provider.name), hook_name)13:37
cory_fuOne issue is that it happens before the data_ready callbacks are fired, so can't react to changes caused by those callbacks.  Another is that it blocks sending data if the data doesn't fulfill the relation class's required_keys.  Both of those are bugs13:37
cory_fufrankban: Agh.  Yes, you are right.  That is also a bug13:38
frankbanlazyPower: I know is idiomatic in Juju, I am not sure my implementation is idiomatic in the services framework13:38
cory_fulazyPower: Personally, I despise that pattern.  I feel like it makes the charms more complex and harder to understand, and it makes them more difficult to deploy, since it inherently makes the relations ambiguous 100% of the time13:40
frankbancory_fu: but it also avoids a lot of code duplication between very similar charms13:41
lazyPowercory_fu: i disagree that it makes sense to have 2 charms that duplicate the logic, when all you're doing is updating configuration 80% of the time13:41
cory_fuObviously, there are some benefits, but my personal opinion is that factoring shared code into a separate, shared library is a better solution.  At least, to the cases I've encountered so far.13:41
frankbancory_fu: in my case, for the redis charm, everything is shared, metadata, config, hooks. Establishing a master-slave relation means adding just a single line in the redis conf13:42
hatchwhat is the services framework?13:43
cory_fufrankban: Fair enough.  That is certainly a more extreme case of overlap than what I had encountered13:43
frankbanhatch: https://pythonhosted.org/charmhelpers/examples/services.html13:43
hatchfrankban: so this allows people to stop using those massive 'hook.py' files13:44
hatch?13:44
frankbancory_fu: I handle that with the services framweork by defining two services in the manager, both actually pointing to the same init service13:44
frankbanhatch: yes, but nothing actually forced people to do that ;-)13:45
hatchreading this closer it almost seems like this services framework encourages putting the hooks all in the same file13:46
cory_fuhatch: The main benefit is that it gives a way to describe more complex cross-dependencies.  For example, a service that depends on both a database and a caching service before it can start up can not meaningfully make any decisions based on a single hook invocation.  It has to make decisions based on a combination of states.  The services framework was the first attempt at addressing that13:46
hatchcory_fu: ahh that's an interesting issue which I haven't yet run into myself13:46
lazyPowerright, the reduces a ton of the guard code i've been writing in ansible to achieve the same goal13:46
cory_fuHowever, the syntax is unwieldy and breaks down in some areas.  So bcsaller and I are working on the next approach to the solution, using a more reactive pattern13:47
hatchyou use ansible on purpose? :P13:47
cory_fuhatch: There's a fair chance you actually have and didn't realize it. ;)13:47
hatchhaha13:47
hatchwhat do you mean by a more reactive pattern?13:47
hatchcan you give me an example?13:47
cory_fuIt can actually come up with even a single relation, if there are also config options that influence code paths as well13:47
cory_fuWell, the idea behind the reactive pattern is to talk about things in terms of states that can be triggered and reacted to, instead of just a list of dependencies.13:49
cory_fuThe rough example that we've been working from looks about like this: https://gist.github.com/bcsaller/788da7aee582f5dff65913:49
cory_fuWith the relation being handled by something like this: https://gist.github.com/bcsaller/6fb14c5b39b2219aadf913:50
hatchahhh interesting13:50
cory_fuWe think that being able to define semantically relevant states (and allow the charms to define their own, for higher-order behavior and dependencies) will allow for more expressive descriptions of what is required to do a given thing13:51
hatchyeah that makes sense from my limited experience13:51
cory_fuIt also gets away from having to have a big service description block that the current framework requires, and brings it back down to simpler decorators that people are more familiar with13:52
cory_fuI'm also doing everything I can to make this available via the CLI so that bash (and other language) charms can benefit from it directly, as well13:52
cory_fuFor example, in bash, a similar reactive block would look something like this: http://pastebin.ubuntu.com/11245268/13:53
frankbancory_fu: looks interesting13:54
frankbanlazyPower, cory_fu: thanks for your help13:54
cory_fuOr, if you prefer: http://pastebin.ubuntu.com/11245287/13:54
cory_fufrankban: :)  I hope that it pans out as well as we're thinking it will.13:55
lazyPowerit was all cory_fu :) 13:55
frankbancory_fu: as I mentioned, the documentations lacks a little bit for the relations part, and I also needed to handle the relating-to-self use case, and I ended up reading the code13:57
cory_fuThe reactive pattern is also tied tightly in with the idea of relation "stubs," which is basically our approach to codifying interface protocols in actual code that can be used directly by charms, so that charm authors don't have to reimplement the client side of the mysql relation, for example, every time, by looking at the source of the mysql charm13:57
frankbancory_fu: that's a great idea for not reimplementing relations over and over13:58
cory_fufrankban: Yeah, the framework isn't really constructed to support self-relations all that well, but I really need to fix those three issues with the provide_data methods which would help, I think13:58
cory_fuIt is a great idea.  I wish it had been mine.  ;)13:58
cory_fufrankban: Does https://code.launchpad.net/~johnsca/charm-helpers/provide-data-fix/+merge/259630 seem like it will address some of your issues with the framework?14:35
frankbancory_fu: looking14:42
frankbancory_fu: if isinstance(provider, type): perhaps if callable(provider)?14:48
cory_fuWell, providers need to be RelationContext classes, so that they have the .name attribute.  Before that change, I think it required that they be instantiated.  I might remove that line entirely14:49
frankbancory_fu: also I am not sure about whether remote_service can be useful, given that the service name is arbitrary14:50
cory_fuThe idea for that was for things like mysql, that create the database name based on the remote service name14:51
frankbancory_fu: I see14:51
frankbancory_fu: those changes look good14:53
frankbancory_fu: estimated release time?14:53
cory_fuI'm working on getting a review now14:54
frankbancory_fu: great ty!14:56
cory_fuI can't guarantee that it will be merged immediately, but I will keep pushing for it.14:57
=== kadams54 is now known as kadams54-away
=== kadams54 is now known as kadams54-away
=== kadams54 is now known as kadams54-away
=== kadams54-away is now known as kadams54
=== kadams54 is now known as kadams54-away
=== kadams54-away is now known as kadams54
=== kadams54 is now known as kadams54-away

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!