Commit Graph

473 Commits (58e30cd117a0322a4493b6462e27df42eac242fa)
 

Author SHA1 Message Date
David Wilson a8cd86420a Rename to avoid module name conflict. 8 years ago
David Wilson fd9f5e6e60 Ansible example. 8 years ago
David Wilson 9d6d342af1 Add CallError to the permitted classes list. 8 years ago
David Wilson 3de06ca559 "Ansible compatible" module loader.
Since all Ansible modules ever written are using worst practice Python,
the module loader must be rewritten to cope with their horrors.

Ansible is woeful software:

* AnsibleModule argument declarations appear within the main() function,
  so they can't be introspected prior to execution.

* No if __name__ == '__main__' guard means they can't be introspected
  without triggering execution.

* By default the main() function attempts to read from stdin, hanging
  our IO thread.

* So much unspeakable crap.

This rewrites the module loader to avoid actually running a module if it
can possibly be avoided. The downside is that the new loader must be
aware of far more details of the Python module mechanism. For example
with the new importer, namespace packages are broken at the very least.

On the plus side, now the module loader will be able to cope with
Django.
8 years ago
David Wilson 088d053a4e Fix Waker repr. 8 years ago
David Wilson 2225ee2923 Convert CallError received on channel into exception. 8 years ago
David Wilson e7c4736b78 Better handle unpicklable objects. 8 years ago
David Wilson 82401c7274 Catch _run_on_thread crashes. 8 years ago
David Wilson 762bf0722a Drama 8 years ago
David Wilson a26a6bd66e More docs. 8 years ago
David Wilson ec21caa098 IOLOG re. 8 years ago
David Wilson a49fe26bb8 TODO entry. 8 years ago
David Wilson ba3a0b6c48 Fix line numbers. 8 years ago
David Wilson fea12a6030 Many updates: graceful shutdown, docs, threading
* Start splitting docs up into internals.rst / api.rst
* Docs for lots more of econtext.core.
* Get rid of _update_stream() and has_output(), replace with individual
  functions called as state changes.
* Add Broker.on_thread() and remove Stream._lock: simply call
  on_thread() to ensure buffer management is linearized.
* Rename read_side/write_side to receive_side/transmit_side like event
  handler names.
* Clean up some more repr / debug logs.
* Move handle cleanup to Context.on_shutdown where it belongs.
* Make wake() a noop when called from broker thread.
* Replace graceful_count crap with Side.graceful attribute, add
  Broker.keep_alive() to check whether any registered readers want to
  be kept alive for graceful shutdown() or any child contexts with a
  connected stream exist.
* Make master.Broker timeout slightly longer than slave broker.
* Add generic on_thread() to allow running code on the IO thread.
8 years ago
David Wilson f83c7c4802 Don't bury EBADF errors. 8 years ago
David Wilson 5cc60b4bb3 log_to_file() sets econtext.io log level too. 8 years ago
David Wilson 54b97b12ac Remove pointless _put_reply wrapper. 8 years ago
David Wilson 7c80ca37fd Replace Context lock with code that always runs under GIL 8 years ago
David Wilson a8928b8e05 Remove completely pointless _update_stream lock. 8 years ago
David Wilson 9b4183ddc4 Fix another race.
on_transmit() buffer mutation must be linearized with enqueue() buffer
mutation.
8 years ago
David Wilson 0e38d1f3e3 Remove needless long prefix. 8 years ago
David Wilson d6bd906e5c Python 2.4 compat in setup.py. 8 years ago
David Wilson ac2a52587b s/wait/join/ 8 years ago
David Wilson 54b0a0aed7 Gracefully handle callback crashes. 8 years ago
David Wilson 2703e444ef Module importer fixes.
* Use TLS to track whether importer is currently running. Avoids
  needing to maintain an ignore stack.

* Print more debugging around cases where Importer skips a module.

* If a module is part of a package, import the package and examine its
  __loader__. If we are not the loader, refuse to load it.
8 years ago
David Wilson e422dedab8 Replace private lock with global importer lock. 8 years ago
David Wilson f88b0a11e9 Python 2.4 fixes. 8 years ago
David Wilson 1bc8681cb4 More doc updates. 8 years ago
David Wilson 1f27872eda Many docs updates. 8 years ago
David Wilson 6a01ae03e3 Replace SHUTDOWN with Channel.send(_DEAD) 8 years ago
David Wilson 25d651f494 Fix Sphinx config. 8 years ago
David Wilson 95902d94b0 Python 2.5 fix: Logger.getChild() does not exist there. 8 years ago
David Wilson da4e457247 More docs, move call/call_with_deadline to econtext.master. 8 years ago
David Wilson a00cb1d6d2 More drama bold. 8 years ago
David Wilson e87b44a703 Hyperlinks. 8 years ago
David Wilson c607831561 SlaveModuleImporter->Importer, enable intersphinx, finish howitworks.rst. 8 years ago
David Wilson b05f949a17 Tidy. 8 years ago
David Wilson 598e75be1d Initial .gitignore. 8 years ago
David Wilson c82ddeb0f7 More howitworks.rst. 8 years ago
David Wilson 3af67f4008 Fix figure layout. 8 years ago
David Wilson 737d095ffc More docs. 8 years ago
David Wilson 753544c104 Add wtf.gif. 8 years ago
David Wilson 62520b1bcb Write history section. 8 years ago
David Wilson 63ee222406 Many docs updates. 8 years ago
David Wilson 8ba5fbf27f Get rid of CorruptMessageError. 8 years ago
David Wilson 73c418ef4b Rename ContextError -> Error. 8 years ago
David Wilson 052c96d7ee Allow importing master's __main__. 8 years ago
David Wilson a174c32d22 Remove comma 8 years ago
David Wilson 8afa1327fb Move wait() to correct location. 8 years ago
David Wilson 1bafeb4434 Doc updates. 8 years ago