Commit Graph

56 Commits

Author SHA1 Message Date
James Shubin
0d8b4aa2bd Fix string issues in the build
Welcome back travis
2016-01-28 06:16:08 -05:00
James Shubin
2930985238 Avoid any possible errors with git describe 2016-01-21 00:40:04 -05:00
James Shubin
d5367b7a1c Add shell based test harness
This allows you to simulate one or more simultaneously running mgmt
processes. It should be easy to use by following the test cases provided.
2016-01-21 00:23:25 -05:00
James Shubin
820294cd9a Add golang stringer to deps 2016-01-21 00:23:11 -05:00
James Shubin
9ab746fbf3 I guess we'll have to stick with the name for now 2016-01-20 23:44:25 -05:00
James Shubin
d7903d8736 Update faq to add etcd vs. consul answer 2016-01-20 17:28:52 -05:00
James Shubin
0ca9351665 Don't generate file watch events if disabled
This previously ignored the events, but they were still generated!
2016-01-20 02:05:26 -05:00
James Shubin
491e9fd9bc Golint fixes
I used: `golint | grep -v comment | grep -v stringer` to avoid crap.
2016-01-19 23:35:33 -05:00
James Shubin
4599b393e9 Fix failure of go 1.4.3 due to missing go vet 2016-01-19 22:37:45 -05:00
James Shubin
30385c85f3 Bump golang versions in travis 2016-01-19 22:29:29 -05:00
James Shubin
8308680a50 Make sure to unpause all elements when resuming
The indegree code added a regression because elements with an indegree
would not be unpaused! This is now corrected. Time to add more tests :)
2016-01-19 22:01:51 -05:00
James Shubin
9c18972af4 Add information on providing good logs 2016-01-18 12:14:17 -05:00
James Shubin
79a5e0972f Improve wording in README.md for clarification 2016-01-18 12:13:47 -05:00
James Shubin
304b48265f Many examples now exist 2016-01-18 12:08:03 -05:00
James Shubin
c0d3678b79 Remove useless noop types
These aren't relevant to the example
2016-01-18 04:50:47 -05:00
James Shubin
74baa032b5 Add link to first blog post 2016-01-18 00:59:10 -05:00
James Shubin
61c668edd3 Limit the number of initial start poke's required
Every graph needs each vertex to have a change to run initially (after
it has started up) so that initial state detection can be applied to
fix anything that happened while the program was not running. We used to
poke every vertex which was unnecessary, when in fact we only need to
poke the set of vertices that are the minimum set of ultimate
pre-requisites for every other vertex in the graph. That way, you're
either poked directly, or poked by someone who was, etc...

It turns out we don't need Dilworth's theorem, and that looking at
vertices with an indegree of 0 is enough (I think it is a special case
when we have a DAG).

This also fixes a goroutine start scheduling race by ensuring the
initial pokes are received!
2016-01-15 17:01:27 -05:00
James Shubin
8db5d630d5 Exit if program was not compiled correctly
Catch the missing injection of program name.
2016-01-15 16:49:50 -05:00
James Shubin
6e9439f4e3 Avoid panic's when referencing non-existing objects
No idea why wrapping the cmd in a function avoids a panic. Probably
something about the gc...
2016-01-15 00:03:22 -05:00
James Shubin
f7858b8e9b Add state caching and invalidation to service type
This required a change in the event system to add an "activity" field.
This is meant to be generic in the case that there is more than one need
for it, but at the moment, allows a poke to tell that it is a poke in
response to an apply that just finished, instead of a regular poke or
backpoke in which all that matters is timestamp updates, because there
wasn't any actual work done (since that state was okay).
2016-01-15 00:02:45 -05:00
James Shubin
935805aeda Add state caching for most types
This adds state caching to avoid repeated execution when not necessary.
2016-01-14 23:17:26 -05:00
James Shubin
4c6647d807 Fixup state related items
* Fixup graph state readability
* Rename original SetState() to SetConvergedState() and friends...
* Add type state management for proper BackPoke() commands...
* Add better DEBUG logging

This is an important optimization that prevents running a BackPoke on a
parent which is in the process of running and will most certainly poke
the caller back in a moment. This avoids unnecessary roundtrips.
Unfortunately, there are still other algorithms required so that races
can't cause the graph to run for longer than necessary.
2016-01-12 04:57:05 -05:00
James Shubin
c57946e29b Fix dependency issue
* Fix Process() object calling
* Add PokeParent() to poke upwards
* Break linear exec chains :(

This was the issue where in a graph f1 -> f2, if you were to rm f2 &&
cat f2, then f2 would not come back because we didn't poke upwards to
refresh the timestamp. Unfortunately this adds another bug which we
solve in a later patch.
2016-01-12 04:20:47 -05:00
James Shubin
48eddc3721 Catch a different form of etcd disconnect 2016-01-10 04:09:28 -05:00
James Shubin
8ea8ef8d0e Simplify converge checker
Not sure why I didn't write it this way before...
2016-01-10 02:40:31 -05:00
James Shubin
1c49bbc487 Clean up the distributed example for clarity 2016-01-10 02:30:05 -05:00
James Shubin
ebc1c60063 The noop type is not useful in this example 2016-01-10 01:42:42 -05:00
James Shubin
590394b2be Clean up better 2016-01-10 01:42:25 -05:00
James Shubin
97664c3b13 Fix effective off-by-one error in dependency processing
Graph vertices have initial values of 0 for their timestamps, which led
to the need of a >= comparison instead.
2016-01-09 22:16:37 -05:00
James Shubin
ea7fd76f93 Add exec type and fix up a few other things
* Add exec type
* Switch erroneous use of fmt to log instead
* Check for edge existence for safety before using
* Avoid recalling etcd channel maker
* Clean up logging output
2016-01-09 21:50:21 -05:00
James Shubin
45ff3b6aa4 Merge type comparison into a single function call 2016-01-08 04:13:42 -05:00
James Shubin
d769309cc0 Hello 2016! 2016-01-08 02:43:38 -05:00
James Shubin
d2bcfdc7aa Fix go vet error 2016-01-07 00:52:42 -05:00
James Shubin
72525d30b1 Refactor etcd into object and add exit timers
This refactors my etcd use into a struct (object) wrapper, which makes
it easier to add an exit on converged timer.
2016-01-06 19:40:09 -05:00
James Shubin
95489b9c07 Add information on which libraries are being used 2016-01-05 03:14:22 -05:00
James Shubin
0bbfd1d071 Add missing stringer dependency
This is used during the `go generate` pre-processor.
2016-01-05 03:03:30 -05:00
James Shubin
904ace8027 Fix up go vet errors and integrate with ci 2016-01-04 21:02:22 -05:00
James Shubin
d8cbeb56f9 Support N distributed agents
This is the third main feature of this system. The code needs a bunch of
polish, but it actually all works :)

I've tested this briefly with N <= 3.

Currently you have to build your own etcd cluster. It's quite easy, just
run `etcd` and it will be ready. I usually run it in a throw away /tmp/
dir so that I can blow away the stored data easily.
2016-01-04 21:00:13 -05:00
James Shubin
72a8027b7f Update README 2015-12-29 01:45:26 -05:00
James Shubin
39f7c305f1 Ira deserves to be mentioned in the THANKS list 2015-12-29 01:23:48 -05:00
James Shubin
1ba6be2957 Add graphviz generation and visualization
This requires graphviz to be installed on your machine. If you run the
command with sudo, it will create the files with the original user
ownership to make it easier to remove them without root.
2015-12-29 01:04:03 -05:00
James Shubin
6b4fa21074 Mega patch
This is still a dirty prototype, so please excuse the mess. Please
excuse the fact that this is a mega patch. Once things settle down this
won't happen any more.

Some of the changes squashed into here include:
* Merge vertex loop with type loop
(The file watcher seems to cache events anyways)
* Improve pgraph library
* Add indegree, outdegree, and topological sort with tests
* Add reverse function for vertex list
* Tons of additional cleanup!

Amazingly, on my first successful compile, this seemed to run!

A special thanks to Ira Cooper who helped me talk through some of the
algorithmic decisions and for his help in finding better ones!
2015-12-21 03:27:25 -05:00
James Shubin
0ea6f30ef2 Reorganize testing for developer efficiency 2015-10-12 19:26:58 -04:00
James Shubin
4f6605b3d1 Don't format or check omv.yaml syntax
Different versions of ruby format differently, so don't do this check
since it will invariably fail for someone. If there is a general
deterministic fix, please let me know :)
2015-10-10 18:14:05 -04:00
James Shubin
e44da9578e Add equals sign to pass in variables
This is something that is required in future go versions.
2015-10-06 23:56:45 -04:00
James Shubin
dd3759ae38 Update gofmt test to allow version 1.5 2015-10-06 20:34:56 -04:00
James Shubin
3e4709d9da Add tag script 2015-10-02 11:05:19 -04:00
James Shubin
66e030a175 Add more shields! 2015-09-29 03:47:58 -04:00
James Shubin
451fb35f93 Add missing watch event for files
If a file was supposed to exist in a directory, and it didn't exist yet,
when it gets created, we should notice, and cause an event so that we
wake up and actually see about then creating that file!
2015-09-26 03:28:05 -04:00
James Shubin
8dbca80853 Add omv support 2015-09-26 00:25:41 -04:00