/srv/irclogs.ubuntu.com/2013/06/23/#juju-dev.txt

rogpeppe1jam: hiya08:01
jamhi rogpeppe108:08
=== rogpeppe1 is now known as rogpeppe
rogpeppejam: i was just thinking about your "single watcher for multiple agents" remark and wondering how you thought it might work08:10
jamrogpeppe: on the client side, when you get an event from Changes it includes the context of what thing was changing.08:11
rogpeppejam: i'm talking about the watcher at the API level here, not the watcher on the state directly08:11
rogpeppejam: usually it doesn't08:11
rogpeppejam: e.g. the result from an EntityWatcher is struct{}08:12
rogpeppejam: it's true that if you want to watch multiple things, you'd probably need to interpose an intermediate goroutine to add the context08:13
jamrogpeppe: right, I don't intend to use the EntityWatcher model, because the only thing we are watching is a state.Tools which is a small compact thing. It seems perverse to send an empty "something changed" rather than sending the actual 100 bytes of what changed.08:13
rogpeppejam: sure, that's fine08:13
rogpeppejam: what other watchers *do* include the context of what thing was changing?08:14
jamrogpeppe: LifeCycleWatcher returns an array of things that changed, though I guess not what they changed to?08:15
jamI mentioned it with fwereade__, and he seemed fine with it.08:15
jamI can see for things you are worried about convergence, you want an event to go check there is something new.08:16
rogpeppejam: LifecycleWatcher doesn't tell you what collection of things you're watching (which is the equivalent)08:16
rogpeppejam: i think that sending the state.Tools is fine08:16
rogpeppejam: i don't think it's worth sending the Id though08:16
rogpeppejam: especially since i can't imagine a scenario where an agent is watching many things for tools changing, and even if it did, it's easy to work around.08:17
rogpeppejam: it's also easy to add the id at the client side if we want08:18
rogpeppejam: we already have an intermediate goroutine that calls Next and sends on the channel which has info about the id being watched08:19
rogpeppejam: it could easily add its local knowledge of the id to the channel without it needing to go across the network08:19
rogpeppejam: does that make sense?08:29
jamrogpeppe: but why do you need N goroutines watching N watchers when you could have 1 goroutine watching 1 watcher watching N things?08:30
rogpeppejam: the upgrader is only watching one thing, right?08:31
jamrogpeppe: the API is intended to allow you to watch more than one thing if you ask for it.08:31
jamATM it probably only watches one.08:31
jamBut why explicitly limit it08:31
jamwhen it isn't that hard to have it do more08:31
jamwith the only "overhead" that the Change event includes slightly more context.08:32
rogpeppejam: ah, i see, you want the bulk call to return a single watcher for all the things being watched08:33
jamrogpeppe: that was the idea, yes08:33
rogpeppejam: i see. that could work. except that it's probably more code (you have to keep track of more stuff at the server side, i think) and as with most of the bulk call stuff, i cannot think of any possible future scenario where we might possibly actually use this functionality.08:38
rogpeppejam: the whole point of this watcher is for a single entity to ask to be notified of its new tools. why would we ever want to watch multiple things? ok, i see (well i don't, but i go along with it) that for reasons of "habit", we make the initial Watch call a bulk call, but it's simpler, less code, easier to understand and just as general to return a watcher for each id (and in practice we'll only ever have one) than a single watcher that08:41
rogpeppewatches many things.08:41
rogpeppejam: it's probably not even going to be measurably less efficient08:42
jamrogpeppe: except if you ever want to transition to the case of more-than-one-thing you have to go into a fairly complex "create a bunch of goroutines adding context into a single channel", when a watcher that watches multiple things naturally handles all of that for you.08:42
rogpeppejam: that assumes that you have a single goroutine wanting to see changes on all those entities, of course.08:44
rogpeppejam: my visceral reaction is YAGNI here08:45
rogpeppejam: i think it will be much easier to write the server side if a Next call is looking up tools with respect to a single entity.08:48
rogpeppejam: hmm, maybe it's not too bad. here's a sketch of how Next might work at the server side in each case: http://paste.ubuntu.com/5791950/08:52
rogpeppejam: you might want to have a single state watcher shared by the whole API server that watches the global version number.08:57
rogpeppejam: there are some interesting questions about the best way to send the info to all the watchers08:58
rogpeppejam: something like this might turn out to be useful: https://code.google.com/p/rog-go/source/browse/values/values.go09:04
jamrogpeppe: what is wrong with my logic for AgentVersion ?09:41
jamA user requests an upgraded version09:41
jamthat sets the global version09:41
jamMachine agents notice09:41
jamupgrade09:41
jamwhen the upgrade finishes09:41
jamthey save their current actual version09:41
jamUnit agents notice when their Machine agent versions upgrade09:41
jamand they go to upgrade09:41
jamYou're right that if we want to do canary upgrades, we'd need a separate field.09:43
jamThough we can make the API be "what version do you want me to be", and the first implementation just watches the global field.09:43
jamAnd future versions can change that in a perfectly compatible manner. (I think)09:44
rogpeppejam: yes, that last seems good to me (but just thinking through the implications)09:45
jamrogpeppe: some of this is more on the "lets make sure we can do what we think we need to" rather than "lets do this right now".09:45
rogpeppejam: +1 to that09:45
rogpeppejam: upgrades will be marginally slower (two poll intervals rather than one) but other than that, i can't think of any down sides.09:47
rogpeppejam: especially since every container is now a "machine", so we know that only one piece of code has the responsibility for actually downloading stuff.09:49
jamrogpeppe: if you're still around, any idea why the last patch set of https://codereview.appspot.com/10437043/#ps2001 includes 'azure' changes?11:12
rogpeppejam: if you do a diff between two patch sets, it'll show you the actual diffs between the two branches11:12
rogpeppejam: and that has many changes because i'd merged trunk between the two11:13
rogpeppejam: but...11:14
jamrogpeppe: sure, by why when you merged trunk didn't the updated diff be computed against trunk again? (I guess this is a difference between how LP computes diffs, and how lbox does)11:14
rogpeppejam: i don't see that happening here11:14
rogpeppejam: there's only one patch set, and i don't see any azure changes11:14
jamrogpeppe: https://codereview.appspot.com/10437043/#ps500211:14
jam(same CL, next patch set11:14
jamPatch Set 2 looks quite sane to review.11:15
jamPatch set 3 has lots of unrelated changes.11:15
rogpeppehmm, weird11:15
rogpeppejam: probably because i hadn't merge trunk to the prereq11:16
rogpeppemerged11:16
jamsomething like that sounds reasonable.11:16
jamprereq + merge trunk can make lbox confused11:16
jamLaunchpad does prereq's differently than lbox11:16
rogpeppeone mo, i'll sort it out11:16
jamrogpeppe: you don't have to spend a lot of time. the "I merged trunk" is a sufficient answer.11:17
jamI don't think you did much in your responses, I was just following along.11:17
jamAnd didn't think you did lots of Azure changes in response to feedback :)11:17
rogpeppejam: i didn't. and i can't sort out the CL now11:21
rogpeppejam: "error: Failed to send patch set to codereview: diff is empty"11:21
rogpeppejam: unsurprisingly11:21
jamrogpeppe: right, because your patch has landed11:21
jamoh well11:21
jamnp11:21
rogpeppejam: if you're in reviewing mode, i'd appreciate your thoughts on https://codereview.appspot.com/10447047/11:22
rogpeppejam: and also https://codereview.appspot.com/10259049/ (i know william's commented already, but the more eyes the better)11:22
jamrogpeppe: golang question. How is it possible that net/fd.go defines a "netFD" struct, which is also defined by "fd_windows.go".12:25
jamI think I understand the 'compile only modules that have _$GOOS' on the appropriate platform12:25
jamdoes doing that override types that are defined in the root x.go file ?12:26
rogpeppejam: i don't see a file fd.go12:26
rogpeppejam: i only see fd_$GOOS.go12:27
rogpeppejam: for GOOS in {bsd, plan9, unix, windows}12:27
jamrogpeppe: is that go-1.1 vs go 1.0.3?12:28
jambecause I clearly see src/pkg/net/fd.go12:28
rogpeppejam: perhaps; are you looking at go 1.0.312:28
rogpeppe?12:28
rogpeppejam: i'll check there12:28
jamrogpeppe: right. And: grep -rnI "type netFD" returns 2 locations. One in 'fd.go' and one in 'fd_windows.go', but no definitions in fd_linux.go etc.12:29
rogpeppejam: ah, in 1.0.3, the build constraints on fd.go are: // +build darwin freebsd linux netbsd openbsd12:29
rogpeppejam: that doesn't include windows12:29
jamrogpeppe: so the magic '+build' comment12:29
rogpeppejam: yeah, and it looks like x_$GOOS.go might be treated specially12:29
rogpeppejam: which i'd forgotten about - a bit of a possible gotcha12:30
rogpeppejam: ah yes: http://paste.ubuntu.com/5792362/12:31
rogpeppejam: that's a good reason to avoid underscores in filenames unless using them for magic (e.g. _test.go)12:31
rogpeppejam: see go doc go/build for the lowdown12:31
jamrogpeppe: sure, I knew about the _windows magic, as I've seen it quite a bit. I didn't know about +build12:32
rogpeppejam: ah!12:32
rogpeppejam: i knew about +build but had forgotten about the _windows magic :-)12:32
jamI've probably seen more _amd64 magic.12:32
rogpeppejam: // +build ignore12:32
rogpeppejam: is quite useful sometimes12:33
rogpeppejam: for commenting out a file12:33
jamrogpeppe: also, lbox doesn't compile on Windows because goetveld only has a 'terminal_linux.go' module,12:33
rogpeppejam: i don't see that12:37
rogpeppejam: i'm looking at revno 39 of goetveld12:37
rogpeppejam: which i just go got12:37
rogpeppejam: hmm, maybe i'm looking at a different tree. i can't see any terminal_linux.go in the revision history12:40
jamrogpeppe: I have a version of goetveld that has a patch from Dave Cheney which renames terminal.go => terminal_linux.go and adds terminal_darwin.go12:41
jamterminal.go itself doesn't compile on Windows12:41
rogpeppejam: ah12:41
jambecause it uses syscall.Termios functionality12:41
jamthat doesn't exist12:41
rogpeppejam: it would be easy enough to mock up a portable version of readPassword12:42
rogpeppejam: that didn't bother turning echo off12:42
jamprobably12:42
rogpeppejam: at least that would be a stand-by12:42
jamit is trying to do direct-to-terminal with-no-echo which I understand is useful for passwords.12:42
jamI tried to do something (because I was doing some juju work on Windows for enablement)12:42
jambut I sort of gave up.12:42
rogpeppejam: yeah, it's useful but not essential12:43
rogpeppejam: you can always make sure there's noone else in the room :-)12:43
rogpeppejam: it should really take a *File rather than the fd12:43
rogpeppejam: the portable version could print a warning: "WARNING: your password will not be hidden when you type it"12:44
jamrogpeppe: it looks like you might be able to use 'conio.h' and getch(): http://stackoverflow.com/questions/6856635/hide-password-input-on-terminal12:45
jamthough I don't really know how to get access to that without cgo.12:45
jamAnyway, not my primary concern today :)12:45
rogpeppejam: it sounds like echo is off by default in windows12:47
jamrogpeppe: I think 'getch' == characters with no echo, 'getc' is characters with echo from Posix.12:49
jamrogpeppe: http://msdn.microsoft.com/en-us/library/078sfkak%28v=vs.80%29.aspx12:49
rogpeppejam: the os package has special code to invoke ReadConsole under windows. i wonder if you just called syscall.Read, it might work with no echo12:51
rogpeppejam: or this http://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx12:54
rogpeppejam: but unfortunately syscall has GetConsoleMode but not SetConsoleMode12:54
jamrogpeppe: I thought there was a non-cgo way of grabbing functions from kernel32.lib12:55
rogpeppejam: it's possible12:55
rogpeppejam: i haven't used go on windows at all12:55
jamrogpeppe: at least, ISTR reading some other go code that didn't need cgo in order to call some windows API stuff. but maybe it just used the already exported syscall functions.12:56
rogpeppejam: yeah, i think you can probably use syscall.Syscall directly12:57
rogpeppejam: it's a pity that modkernel32 isn't exported, but perhaps it doesn't matter12:58
jamrogpeppe: well, it looks like you could always directly call syscall.LoadDLL() if you really wanted.13:01
rogpeppejam: yeah, my reading of http://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx is that it will be idempotent13:01
rogpeppe"13:08
rogpeppesomething about "where is13:08
rogpeppethis variable coming from" that I find hard to read with our current13:08
rogpeppeidioms13:08
rogpeppe"13:08
rogpeppejam: do you use emacs?13:08
jamrogpeppe: vim13:09
rogpeppejam: ah13:09
jamrogpeppe: I can use ctags + "^]" to go to a tag definition13:09
rogpeppejam: if you were using emacs, there's a plugin that uses my godef tool13:09
jamit is still very 'somewhere else in this package you might find something'13:09
rogpeppejam: which is much much better than ctags13:09
rogpeppejam: it takes you *precisely* to the definition13:10
rogpeppejam: even if you click on "z" in the expression like f().x.y.z and z is defined as a field in many paces13:10
rogpeppeplaces13:10
rogpeppejam: it might not be too much hassle to fit it into vim, though i'm not at all familiar with vim-as-programming-language13:11
jamrogpeppe: there was a vim runnig-a-server-to-get-definitions program that I used for a while a year ago, but then I stopped doing go for a while and it isn't packaged so I haven't tracked it down again.13:12
rogpeppejam: http://godoc.org/code.google.com/p/rog-go/exp/cmd/godef13:12
jamrogpeppe: https://github.com/nsf/gocode13:12
jamThat one does autocomplete on '.' sort of things.13:13
rogpeppejam: i think that did code completion but not definition finding AFAIR13:13
rogpeppejam: godef could theoretically be used to do code completion too13:13
rogpeppejam: as it knows about member names13:13
rogpeppejam: its dark side is that it's written against an ancient fork of the go parser13:14
rogpeppejam: some time i intend to make it use go/types, but "in my copious spare time"13:14
rogpeppejam: for the moment i use it constantly and it works in 99% of cases13:14
rogpeppejam: (and it's pretty instantaneous - runs in ~10ms)13:15
jamrogpeppe: so that is your "rog-go/exp/go/ast' stuff?13:17
rogpeppejam: yeah13:17
rogpeppejam: it does symbol resolution at ast-construction time13:18
rogpeppejam: which is *almost* but not quite possible in general13:18
rogpeppejam: rather, it's not possible without reading all the imports, which i didn't want to do13:19
rogpeppejam: and that's made worse by import to .13:19
rogpeppejam: which godef doesn't support (probably its main limitation)13:19
thumperah fark...23:30

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