/srv/irclogs.ubuntu.com/2012/01/27/#upstart.txt

bradleyayersI'm a bit confused about what http://upstart.ubuntu.com/cookbook/#restarting-jobs-with-complex-conditions means01:41
bradleyayersI was under the impression that upstart tracked the state of jobs, and would start jobs when their conditions were met01:42
bradleyayerswould the situation (in that link) be any different if a 'stop on …' was defined?01:43
bradleyayerswould it be any different if 'respawn' was specified?01:44
SpamapSbradleyayers: upstart tracks the state of jobs, but it only changes their goal-state on events, not conditions. Its a subtle difference.06:29
SpamapSbradleyayers: that section is a bit ambiguous.. I'm going to propose a slight change.06:31
bradleyayersso say i have a job X that "start on started A and started B", and "stop on stopping A or stopping B". A starts, then B starts, so 'started JOB=B' would be emitted, which would cause X to start right?06:32
bradleyayersthen B changes its goal to stopped, so 'stopping JOB=B' would be emitted, which would cause X to change its goal to stopped, right?06:32
bradleyayersso then let's say X stops, then B stops06:33
bradleyayerswhat happens when i do 'start B'06:33
* SpamapS draws it in his head06:39
SpamapSbradleyayers: it blocks06:40
SpamapSbradleyayers: until started A is emitted06:40
bradleyayersyou mean started X?06:40
SpamapSno06:40
bradleyayers:O06:40
SpamapSbecause it is started A and started B ...06:41
SpamapSthe and blocks06:41
SpamapSwhich is why and's require careful consideration06:41
bradleyayersoh okay, so B starts fine06:41
SpamapSbug #44765406:41
bradleyayersbut then A stays with its goal as stopped06:41
bradleyayersaaa06:41
bradleyayersawit06:41
bradleyayers!!!06:42
bradleyayersZ stays with its goal as stopped**06:42
bradleyayersX06:42
SpamapSwe had no Z!06:42
bradleyayersi know :(06:42
SpamapSok06:42
bradleyayersI'll start again06:42
SpamapSyes X stays with its goal as stopped06:42
bradleyayersB starts properly06:42
bradleyayersthen X stays with its goal as stopped06:42
SpamapSand perhaps more importantly, the started event for B is not "finished".. its blocking06:42
SpamapSso while B is started, the 'start' command (or event) will be waiting06:43
SpamapSThere are times where this doesn't matter06:43
SpamapSyou can use 'and' freely when the events that you are 'and'ing are never waited for06:43
bradleyayersbut how can 'started' ever block, it's an event06:44
SpamapSfor instance, the 'filesystem' event or the 'net-device-up' events aren't waited on06:44
SpamapSbradleyayers: ALL events can block06:44
SpamapSit is critical to the proper sequencing of the boot06:44
bradleyayershttp://upstart.ubuntu.com/cookbook/#event-types says Signals don't block06:44
SpamapSfor instance, the starting event needs to block, so that whatever you're trying to start before, doesn't start until you yourself are started06:45
bradleyayerswhich 'started' is06:45
SpamapSbradleyayers: signals aren't waited on.. but they actuall do still block.. :-/06:45
bradleyayersi should have said: "but how can 'started' ever block, it's a *signal*"06:45
SpamapSactually I should say06:45
bradleyayersah okay, i didn't realise there was a difference between block and waited on :/06:45
bradleyayersmy misunderstanding06:45
SpamapSstarted is not a signal06:46
SpamapSwell it might be actually06:46
SpamapSI suppose it is since nothing is waiting for it.06:46
SpamapSstarting, however, is always waited on06:46
bradleyayersthat's my understanding too06:47
bradleyayersstarting is a 'method event'06:47
bradleyayersor probably 'hook'06:47
bradleyayersso back to my original scenario, 'starting B' would be emitted, i dont understand why that doesn't trigger X's condition to be re-evaluated06:49
bradleyayersi'll read over bug #44765406:50
SpamapSbradleyayers: the condition is evaluated, and B's event satisfies only one side of it.06:51
SpamapSbradleyayers: since it is an and, you need to have A's started event *again*06:51
bradleyayersi see06:52
SpamapSbradleyayers: the disconnect that nearly everyone experiences is that they are events, not states, and so are inherently ephemeral.06:54
bradleyayersyeah :(06:55
bradleyayersi get it now06:55
bradleyayersso this definitely hasn't been fixed yet?06:55
SpamapSNo, it effectively needs a rewrite of the event loop to add the ability to observe states.06:57
SpamapSIn practice, it can be worked around with the 'wait-for-state' job.06:58
SpamapSbradleyayers: is this your bug btw: https://bugs.launchpad.net/upstart-cookbook/+bug/91234806:59
bradleyayersyeah that sums up what my question was07:00
SpamapSCool, I just pushed up a merge proposal https://code.launchpad.net/~clint-fewbar/upstart-cookbook/clarify-complex-start-stop/+merge/9037907:01
bradleyayersi'd probably bold "is not known to upstart"07:04
bradleyayersbut otherwise it looks good07:04
bradleyayersbut a bit hard to be objective now that I actually understand it07:04
SpamapSbradleyayers: agreed on the bolding, pushed that up07:12
bradleyayerscool07:12
bradleyayershey SpamapS thanks for the help before09:26
=== JanC_ is now known as JanC

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