/srv/irclogs.ubuntu.com/2008/12/16/#upstart.txt

sadmac2Keybuk: http://screwyouenterpriseedition.blogspot.com/2008/12/new-upstart-state-machine-part-2.html16:11
sadmac2ignore what you didn't understand from the last post16:12
sadmac2This should be simple enough16:12
ion_sadmac: Concrete examples would be easier to grasp.16:13
sadmac2ion_: that's part 4 :)16:13
ion_Actual use cases instead of thystate and crunchy16:13
sadmac2ion_: I don't want to redesign this thing again. Part of that means that rigor is very important to me.16:14
sadmac2I want this thing to be perfectly defined. Its only its /presentation/ that has to be perfectly comprehensible.16:14
ion_Explaining it in a way we mere mortals understand shouldn’t require changing the design. :-)16:19
sadmac2ion_: it doesn't :)16:19
sadmac2ion_: but designing it in a way mere mortals understand requires changing the design every time someone says "well what about this?"16:19
sadmac2ion_: the fact is mere mortals don't have to know how it works for most values of "how it works"16:23
sadmac2ion_: relational databases: "put shit in tables," "Use joins"16:24
sadmac2ion_: that's a piss-poor picture of the relational model, but its almost enough to not screw up with postgres16:24
ion_Please give us the piss-poor picture of your design. :-)16:27
sadmac2ion_: you have states. they are either on or off. they can require others to be on before they come on. they can be made to come on upon certain system events, whenever their dependencies are satisfied, or automatically.16:30
sadmac2ion_: there's another process that will start a service whenever a particular state is on16:30
Keybukwhat about the process that sets the state based on the service?16:32
sadmac2Keybuk: when does that happen?16:32
Keybukwhat else would you set states from?16:33
sadmac2devicekit signals, user request, etc16:34
sadmac2events16:34
KeybukD-Bus signals (like those from DeviceKit) are very definitely events, not states16:45
KeybukI think the most common case is dependencies on other jobs16:46
sadmac2right16:46
Keybukwith the second most common case being the existing of particular D-Bus objects16:46
Keybuk(which is defined as the period between two well known events with common parameters)16:46
sadmac2still with you16:46
Keybukthough defining D-Bus signals is just a world of ugh16:52
sadmac2the split beetween Pid 1 (the service manager) and Pid X (the state machine) is what I want to firm up the most16:53
Keybukfrom dbus(NAME=org.freedesktop.DeviceKit, PATH=/org/freedesktop/DeviceKit, MEMBER=org.freedesktop.DeviceKit.DeviceEvent, 1="add") until dbus(NAME=org.freedesktop.DeviceKit, PATH=/org/freedesktop/DeviceKit, MEMBER=org.freedesktop.DeviceKit.DeviceEvent, 1="remove", 2=$2)16:54
sadmac2Keybuk: we can probably macrify a lot of that. especially for something like devicekit that we'll be hitting up all the time16:56
sadmac2from US_DEVKIT(1="add") until US_DEVKIT(1="remove", 2=$2)16:57
Keybukof course, that requires from/until to match the right side against the left16:58
Keybukwhich is pretty essential16:58
sadmac2Keybuk: I think we probably had it right before17:01
Keybukbefore?17:02
sadmac2Keybuk: from have_device(%1) until lost_device(%1)17:02
Keybukright17:02
sadmac2Keybuk: where have_device and lost device are something that is specifically sent to the state machine17:02
Keybukwhile <STATE>  -- defines a match on STATE17:02
sadmac2and causing those events due to whatever is SEP17:02
Keybukfrom EVENT until EVENT  -- defines a match on a state defined as EVENT ... EVENT (rhs of a state matches against left)17:03
Keybukbefore <STATE> -- defines a match on the opposite side of the STATE transition to while17:03
sadmac2whoa. do we need that?17:03
Keybukomgyes17:04
Keybukwhile ~= started -> stopping17:04
Keybukbefore =~ starting -> stopped17:04
sadmac2oic17:04
sadmac2I kind of like the idea of specifying the state names for each of these17:05
sadmac2foostate while otherstate17:05
sadmac2let me explain why:17:05
Keybukbut you're inherently specifying the state name17:05
Keybukbecause you're writing it in the job file ;)17:05
Keybukor the state definition file ;)17:06
sadmac2Keybuk: that's my issue17:06
sadmac2Keybuk: I want to dissociate states from files17:06
sadmac2Keybuk: consider replacing runlevels.17:06
sadmac2Keybuk: we have a series of states, defined however, but none of them have auto17:06
KeybukI don't want to replace them, I want to kill them dead :)17:07
sadmac2Keybuk: well, we need some way to group services based on what kind of system the user wants running17:07
Keybuk  /etc/init/docked:17:08
Keybuk    while service117:08
Keybuk    while service217:08
Keybuk    while service317:08
Keybukdocked is true if they're all running17:08
Keybukand you can start/stop docked manually to enter/leave that state17:08
sadmac2ah, damn17:08
sadmac2I don't think in terms of pulling the dependencies well yet :)17:08
Keybukof course, you might arguably want to separate the dependencies from the requirements17:09
sadmac2Keybuk: you might want them to come from another place17:09
sadmac2/etc/init/docked-foopkg: error: file not found17:10
sadmac2yum install foopkg17:10
sadmac2/etc/init/docked-foopkg:17:10
sadmac2docked while fooservice17:10
Keybukmakes it hard to find out what docked is17:11
Keybukyou have to grep multiple trees of files17:11
sadmac2Keybuk: we have to support that case somehow though17:12
sadmac2Keybuk: also, that case kind of demonstrates why "while" might be a poor choice17:13
sadmac2it reads "whe are docked while fooservice is running"17:13
sadmac2which feels particularly backward for that state17:13
sadmac2I propose "implies"17:13
sadmac2docked implies fooservice17:13
sadmac2brb lunch. my backlog should contain you if you keep going :)17:14
ion_For that,17:22
ion_/etc/init/foo:17:22
ion_while docked17:22
sadmac2ion_: that means the opposite18:20
sadmac2ion_: that means whenever you started foo, the system would enter the docked state18:20
ion_I propose it doesn’t. :-)18:20
sadmac2ion_: then what goes in /etc/init/docked?18:21
ion_from devicekit-said-dock-connected until devicekit-said-dock-disconnected18:22
sadmac2ion_: so foo gets while foo; auto18:26
ion_Huh?18:28
sadmac2ion_: while docked; auto18:39
sadmac2ion_: sorry18:39
sadmac2hmm... a implies a18:39
sadmac2how do tautological states behave?18:39
ion_What’s this auto thing?18:40
sadmac2ion_: a state doesn't start just because its deps are satisfied unless auto is specified18:40
sadmac2ion_: otherwise its deps satisfied + got event18:40
sadmac2The more I describe this state machine the more I realize its a great deal more powerful than I thought :)20:01
sadmac2Its can do some things I didn't think of20:01
sadmac2mount_state(dev: %1, mountpoint: %2) { action: mount $dev $mountpoint }20:04
sadmac2^^ignore that...20:04
sadmac2mount_state(dev: %1, mountpoint: %2, type: %3) { action: mount -t $type $dev $mountpoint }20:05
sadmac2mount_state(dev: %1, mountpoint: %2, type: funkyfusefs) { action: funkyfusemounter $dev $mountpoint }20:05
sadmac2its like haskell, but in a good way20:07
sadmac2ion_, Keybuk: http://screwyouenterpriseedition.blogspot.com/2008/12/new-upstart-state-machine-part-3.html21:44
sadmac2^^practical examples included (start reading when you see fstab lines)21:45
=== mbiebl_ is now known as mbiebl

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