[10:47] <Keybuk> morning
[10:48] <mdales> morning Keybuk 
[10:48] <mdales> thanks for your help yesterday, my system seems to be doing what I want now :)
[10:49] <Keybuk> cool :) no problem
[10:49] <mdales> thought I'd loiter for a bit still as I learned a bit from just watching the general chat here yesterday
[11:53] <Keybuk> hmm
[11:53] <Keybuk> action reload script
[11:53] <Keybuk>  ...
[11:53] <Keybuk> end script
[11:53] <Keybuk> action reload on some-event
[11:53] <Keybuk> syntax could use some work there :-/
[01:24] <Keybuk> action reload
[01:24] <Keybuk>   on some-event
[01:25] <Keybuk>   script
[01:25] <Keybuk>     ..
[01:25] <Keybuk>   end script
[01:25] <Keybuk> end action
[01:25] <Keybuk> that might work
[01:25] <_ion> Looks quite intuitive.
[01:30] <Keybuk> need to sort out the job status messages first though
[02:17] <Keybuk> for a given job, "foo", there may be:
[02:18] <Keybuk>  - old versions running from before the config file was modified
[02:18] <Keybuk>  - a master instance that never runs
[02:18] <Keybuk>  - multiple running instances
[02:18] <Keybuk>  - or a single instance of the job
[02:18] <Keybuk> and for each instance, there may be:
[02:18] <Keybuk>  - a "main stream" process (pre-start, main, post-start)
[02:18] <Keybuk>  - a "side stream" process (post-start, pre-stop)
[02:18] <Keybuk>  - any number of user actions
[02:21] <Keybuk> start foo => obviously only cares about the master/single instance of current versions
[02:22] <Keybuk> stop foo => only needs to care about single or multiple instances, but of both current and old versions
[02:22] <Keybuk> status foo => probably cares about them all?
[02:25] <Keybuk> this comes back to how instances are implemented
[02:25] <Keybuk> right now they're just extra entries in the hash table
[02:25] <Keybuk> perhaps separating all the non-config state into a JobInstance structure, and having a list of those in the job, is one way to do it
[05:07] <Keybuk> *giggles*
[05:07] <Keybuk> a deleted job can't stop
[05:07] <Keybuk> because the job_change_goal() function won't let you run it for a deleted job
[05:07] <AlexExtreme> heh
[05:59] <mdales> AlexExtreme: we'll quote you on that in 5 years when 32 bit pids are a cause of global concern
[05:59] <AlexExtreme> :D
[05:59] <wasabi_> They are a cause for concern right now in my world.
[05:59] <wasabi_> Heh.
[05:59] <Keybuk> it doesn't matter, I've deliberately put in code to cope with it just in case
[06:00] <Keybuk> that branch is sub-optimal though
[06:00] <Keybuk> since once the counter wraps, it has to scan the entire jobs hash each time you want to add a new one to ensure uniqueness
[06:00] <Keybuk> (there's probably a clever way to avoid that)
[06:03] <wasabi_> oh, pids. n/m.
[06:03] <wasabi_> for whatever reason my mind thought uid
[06:09] <Keybuk> not pids
[06:09] <Keybuk> the Job and EventEmission structures have a unique id field
[06:09] <Keybuk> so you know *which* "foo" job, and which "block-device-added" event it is
[06:09] <wasabi_> uh huh
[06:09] <Keybuk> they're uint32_t, which wraps after 4 billion job file changes, or 4 billion initctl emits
[06:09] <Keybuk> (or 4 billion job state changes)
[06:10] <Keybuk> obviously once wrapped, job->id = job_id++ is no longer guaranteed to be unique
[06:15] <wasabi_> so you need to scan before allocating.
[06:15] <Keybuk> right
[06:15] <Keybuk> but only once we've wrapped once
[06:15] <wasabi_> store a "lowest known job id value". update it when you lease/release a number. when leasing one, use the "last known one ++" and check if it's < the lowest known. if not, do teh forward scan.
[06:15] <Keybuk> the "update when release" is the tricky bit :p
[06:16] <wasabi_> well you only have to update on release when release == current lowest known
[06:17] <wasabi_> none of which really matters anyways.
[06:17] <wasabi_> the jobs hash is going to be small enough for it to not matter.
[06:21] <Keybuk> indeed
[06:21] <Keybuk> and job creation isn't a time-critical activity
[06:22] <Keybuk> in fact, upstart has no time critical activities :p
[06:22] <wasabi_> only at boot. and that won't have looped anyways