Commit Graph

570 Commits

Author SHA1 Message Date
dw d708405126
Merge pull request #82 from moreati/imported-via-the-scenic-route
Fix TypeError while initiliazing ImporterMixin
2018-02-15 05:26:05 +05:45
dw 9d1859796c
Merge pull request #83 from moreati/msg-in-a-jar
Fix lingering references to mitogen.core.Receiver.get_data()
2018-02-15 05:24:58 +05:45
dw fdb379ba0b
Merge pull request #81 from moreati/django-unfound
FIx syntax error in FindRelatedImportsTest.test_django_db_models
2018-02-15 05:24:49 +05:45
David Wilson 0d57afc914 master: use queue-like Latch in Select() too. 2018-02-15 05:23:48 +05:45
Alex Willmer 3bf204f8d6 docs: Fix out of date get_data() snippets
As of adc8fe3aed Receiver objects do not
have a get_data() method and Receiver.get() does not unpickle the
message.
2018-02-14 23:30:25 +00:00
Alex Willmer c1e29783fb Fix AttributeError in mitogen.core.Context.send_await()
As of adc8fe3aed Receiver objects do not
have a get_data() method and Receiver.get() does not unpickle the
message.
2018-02-14 23:27:54 +00:00
David Wilson 371a259a5e ansible: remove hard-wired UNIX socket path. 2018-02-15 04:55:56 +05:45
David Wilson a6324aaeb1 Latch v2: combined queue + one self-pipe-per-thread
Turns out it is far too easy to burn through available file descriptors,
so try something else: self-pipes are per thread, and only temporarily
associated with a Lack that wishes to sleep.

Reduce pointless locking by giving Latch its own queue, and removing
Queue.Queue() use in some places.

Temporarily undo merging of of Waker and Latch, let's do this one step
at a time.
2018-02-15 04:52:29 +05:45
Alex Willmer 83c0111b51 Fix TypeError while initiliazing ImporterMixin
Since f44356af32 mitogen.core.Importer()
takes a Router instance.
2018-02-14 23:04:10 +00:00
Alex Willmer 49b6c586e3 FIx syntax error in FindRelatedImportsTest.test_django_db_models 2018-02-14 22:54:00 +00:00
David Wilson 8121530144 core: replace Queue with Latch
On Python 2.x, operations on pthread objects with a timeout set actually
cause internal polling. When polling fails to yield a positive result,
it quickly backs off to a 50ms loop, which results in a huge amount of
latency throughout.

Instead, give up using Queue.Queue.get(timeout=...) and replace it with
the UNIX self-pipe trick. Knocks another 45% off my.yml in the Ansible
examples directory against a local VM.

This has the potential to burn a *lot* of file descriptors, but hell,
it's not the 1940s any more, RAM is all but infinite. I can live with
that.

This gets things down to around 75ms per playbook step, still hunting
for additional sources of latency.
2018-02-15 02:06:21 +05:45
David Wilson 1c6e529458 ansible: delete old needless host_vars directory 2018-02-15 01:03:28 +05:45
David Wilson bb662a1a0b master: helper functions to force disconnect everything 2018-02-15 00:45:09 +05:45
David Wilson 4a431a1a85 service: initial version 2018-02-15 00:44:31 +05:45
David Wilson d3e79fc240 ansible: support become:True and become_user 2018-02-15 00:27:23 +05:45
David Wilson 2efb790a2f ansible: add become test case 2018-02-15 00:27:05 +05:45
David Wilson 3a96389d08 ansible: automatically configure connection plug-in. 2018-02-15 00:14:38 +05:45
David Wilson 8598ff07b3 ansible: restructure to avoid intermediate imports 2018-02-14 22:30:35 +05:45
David Wilson 1a119cb08b ansible: import example playbook 2018-02-14 22:29:02 +05:45
David Wilson 715e42a714 ansible: connection plugin v2
Now featuring one roundtrip per module invocation.
2018-02-14 22:17:42 +05:45
David Wilson 7819819188 core: CALL_FUNCTION should check auth_id, not src_id 2018-02-14 22:00:51 +05:45
David Wilson 5a04fbb694 ansible: Merge module runner into helpers.py. 2018-02-14 21:27:14 +05:45
David Wilson 1d5de9017f Remove old TCP draft. 2018-02-14 21:02:54 +05:45
David Wilson 3dd062bc18 issue #40: mitogen.unix initial implementation. 2018-02-14 21:02:43 +05:45
David Wilson aa1d58c9a3 fakessh: restore unpickle() semantics. 2018-02-14 20:25:53 +05:45
David Wilson dadee5dc05 docs: add Message documentation 2018-02-14 20:24:39 +05:45
David Wilson 424879dfb4 core: Message.reply() helper function 2018-02-14 20:13:30 +05:45
David Wilson 0a4711bce9 core: Don't crash if a stream is missing a side. 2018-02-14 19:46:30 +05:45
David Wilson 43c673b230 core: Restore behaviour of unpickling Router-specific Context subclass 2018-02-14 19:45:46 +05:45
David Wilson 8ef87bea6a select: clean up API. 2018-02-14 19:45:22 +05:45
David Wilson adc8fe3aed core: de-munge Message.unpickle() vs. Receiver.get(). 2018-02-14 19:36:00 +05:45
David Wilson c9affbaf50 core: add auth_id field. 2018-02-14 09:16:27 +05:45
David Wilson 01c607cc67 core: remove unused SecurityError. 2018-02-14 06:42:12 +05:45
David Wilson ddf4a21bac Add mitogen.main() decorator mainly for docs and demo use. 2018-02-13 20:00:13 +05:45
David Wilson 4121e9b35a issue #68: replace sets with lists
Fix a MyPy warning by only passing lists to select.select(). At least on
Python 2.x, select.select() was internally converting the sets to lists
anyway.

By the time lists become inefficient here, it is likely that
select.select() itself will also be inefficient, and need replaced with
.poll() or similar.

No discernible performance different when transferring django.db.models
to a local VM.
2018-02-13 18:49:03 +05:45
David Wilson 6897227a31 utils: support log_to_file(usec=True) 2018-02-13 15:53:18 +05:45
David Wilson 593e6e3261 importer: warn on duplicate request, simplify preload logic
* Children should never generate a request for a module that has already
  been sent, however there are a variety of edge cases where, e.g.
  asynchronous calls are made into unloaded modules in a set of
  children, causing those children to request modules (and deps) in a
  different order, which might break deduplication. So add a warning to
  catch when this happens, so we can figure out how to handle it.
  Meanwhile it's only a warning since in the worst case, this just adds
  needless latency.

* Don't bother treating sent packages separately, there doesn't seem to
  be any need for this (after docs are updated to match how preloading
  actually works now).
2018-02-13 15:49:25 +05:45
David Wilson 8765f761c9 importer: fix glaring bug in find_related()
Overwriting 'fullname' variable caused basically nonsensical filtering.
Result was including the module being searched in the list of
dependencies, which was causing ModuleResponder to send it early, which
was causing contexts to start importing the module before preloading of
dependencies had completed.
2018-02-13 15:47:38 +05:45
David Wilson e3d170904e importer: warn once about missing source and cache negative hit 2018-02-13 15:46:34 +05:45
David Wilson a19102a143 core: fix profiling
* SIGTERM safety net prevents profiler from writing results, so disable
  it when profiling is active.
* fix warning corrupting stream when profiling=True
2018-02-13 15:44:36 +05:45
David Wilson 4d31300dd0 Split up parent and master modules
Knocks 4kb off network footprint for a proxy connection.
2018-02-12 15:49:18 +05:45
David Wilson a8ad096d06 importer: always refuse builtins and __builtin__. 2018-02-12 13:39:31 +05:45
David Wilson b194e46d35 docs: reorder sections 2018-02-12 12:55:34 +05:45
David Wilson 0a2a483298 importer: new format to signal ImportError
Previously we'd send just None in GET_MODULE reply, but now since there
is no single request-reply structure, we must include the fullname in
the LOAD_MODULE response and make all of its data fields None to
indicate the same.
2018-02-12 12:41:26 +05:45
David Wilson 1acb068fb6 docs: remove obsolete warning 2018-02-12 12:32:18 +05:45
David Wilson bf5fbc9719 Merge branch 'wip-module-loader' 2018-02-12 12:30:36 +05:45
David Wilson 6715a1b150 importer: semi-functional preloader
Doesn't yet implement the rules in the docs, but I think the doc rules
could maybe change to match this. Needs lots of cleanup work and
thorough testing, but this is a great start.
2018-02-12 12:29:20 +05:45
David Wilson 76e4683ef1 docs: sphinx-autobuild default target. 2018-02-12 11:16:05 +05:45
David Wilson 3f86347edc docs: fix typo 2018-02-12 10:38:26 +05:45
David Wilson e930099755 docs: vastly simplify importer concurrency docs 2018-02-12 10:30:11 +05:45