Add timeout to WaitForOneFromTask

We should never wait forever for anything.

Change-Id: Icaa61febbf4745206abbe5bf9255c9401f341e71
Persistence cleanup part one

- Convert the various functions that take a task detail into
  ones that take atom details (since this is now the generic
  type they should take).
- Don't expose the detail type strings as part of the atom
  detail api, leave those as private hidden strings and provide
  conversion functions from string<->class instead.
- Have the logbook objects contain the following new methods
  to reduce the dependence on persistence_utils to do the same.
  - to_dict() which converts the current object into a dict
  - from_dict() which converts the provided dict into a object
  - merge() which merges a incoming objects data with the current
    objects
- Have the persistence backends + storage + action engine use these
  new methods instead of there current usage.
- Don't compare to logbook.RETRY_DETAIL or logbook.TASK_DETAIL since
  python has the isinstance function just use it (ideally we should
  fix the code so that this isn't even needed, usage of isinstance
  means something is not designed/structured right).
- In storage tests we can't assume that failures will be non-lossy
  since under certain backends when a failure is stored information
  about the internally held exc_info is lost, so take this into
  account when testing by using matches() where applicable.

Change-Id: Ie8a274cfd4cb4e64e87c355dc99d466d74a4e82c
Merge "Add timeout to WaitForOneFromTask"
Should be greater or equal to zero and not greater than

Change-Id: I7897f847598133cbc1ed425847f2a708e4f6d195
Fix spelling mistake

Change-Id: Ic3ae069565f0f9e25f243eead105e1b97fe437fc
Merge "Fix spelling mistake"
tests: Discover absence of zookeeper faster

It turns out that when no zookeeper server is available for tests
python ./setup.py test spends almost half of it's running time
looking for it. This change addresses that and makes unit tests
run roughly two times faster on my zookeeperless machine:

- client starting timeout reduced from default 15 seconds to 3 seconds,
  which should be more than enough to connect to localhost;
- zookeeper availability is checked only once, on module import,
  and then saved for later re-use.

Change-Id: I11932e7cca12436cde0bcf0a20cb2adb96fbb27a
Move 'inputs and outputs' to developers docs

Change-Id: Id4385c234f78ef179c43b23d5eb93cf448059498
Merge "Move 'inputs and outputs' to developers docs"
Set logbook/flowdetail/atomdetail meta to empty dict

Instead of setting to none, and then later setting to
a dictionary just by default set it to an empty dict
which makes it more clear what the intended usage of
the meta attribute is for.

Change-Id: Ic42c423d104f369a43227c4ef4563f1f99635fa0
Fix race in worker-based executor result processing

When worker-based engine receives event it should first remove
request from cache and then call request.set_result. Otherwise,
another thread waiting the request to complete might schedule
another request with same uuid (e.g. reversion of failed task),
which will replace current request in cache and then will
be deleted, thus leading to engine hang.

Related-bug: #1297668
Change-Id: Icbbca58067ee22fe45c63e1f69d189ea56697d20
Merge "Persistence cleanup part one"
Exception when scheduling task with invalid state

Since GraphAnalyzer checks for tasks and retries to be scheduled we
have to raise an exception when it tries to schedule a task with
invalid state.

Change-Id: Ib9eb1ffaf7d0d1b3fd6a9b49504ef508778dd3ee
Test retry fails on revert

Change-Id: Ie2b85fe228ae746b76b70d5c9cc01a0cdf53d8f8
Merge "Set logbook/flowdetail/atomdetail meta to empty dict"
Merge "Exception when scheduling task with invalid state"
Merge "Test retry fails on revert"
Rework documentation of notifications

- move notifications docs from inputs and outputs to separate page;
- listeners and TransitionNotifier documented;
  - docstrings improved, missing docstrings added;
  - documentation put to notifications page;
- inputs and outputs page edited.

Change-Id: Ib283836173a806fbec81aa07b3292e2672bf6483
Removed unused TIMED_OUT state

Change-Id: Ifca2ba5fc3e5d032ef4ab6a142b1468cde435efc
Raise error if atom asked to schedule with unknown intention

Instead of returning none from the schedule task/retry method
if a unknown atom intention is declared (this will cause later
failures) raise a execution failure when this happens to denote
that this is a problematic & exceptional case.

Change-Id: Id0e3211389e22459c5381f4a19d80d8d0baf1e25