Commit Graph

212 Commits (master)

Author SHA1 Message Date
David Wilson 3cbe9baf6d issue #70: remove redundant 'raise SystemExit'
Either execvp succeeds, in which case the process image is replaced, or
execvp throws an exception, in which case control flow exits the frame
anyway.
6 years ago
David Wilson 326886832e Add license text everywhere. 6 years ago
David Wilson f1f36cec35 Simplify the API, make Broker optional and auto-shutdown on main thread exit. 6 years ago
David Wilson c09dcd82a7 Fix Python 3 fix :/ closes #57 6 years ago
David Wilson b3491b190c master: Lazy-format more logging arguments, minor 3.x compat increments 6 years ago
Alex Willmer 0e7cc55e33 first stage: Remove/dedent else block
Since the above if block ends in a call to os.execv() this block will
only ever run when the if condition was false. Hence putting it in an
else clause is unnecessary.
6 years ago
Alex Willmer d1c10f64a5 first stage: Use string concatenation 6 years ago
Alex Willmer b490cde604 first stage: eliminate whitespace 6 years ago
Alex Willmer c7c0266e99 first stage: single letter variables 6 years ago
David Wilson 3d0e8c36d2 issue #49: 2.x/3.x compatible decode.
Much uglier command line, but it works across major Python releases.
6 years ago
David Wilson db9bec8720 Implement Alex's awesome idea of zlibbing the first stage too! Closes #49 6 years ago
David Wilson 828f60351b importer: Delete _get_module_via_parent entirely
Can't figure out what it's supposed to do any more, and can't find a
version of Ansible before August 2016 (when I wrote that code) that
seems to need it.

Add some more mitigations to avoid sending dylibs.
6 years ago
David Wilson b7a9aa46cf core: More robust shutdown
Now there is a separate SHUTDOWN message that relies only on being
received by the broker thread, the main thread can be hung horribly and
the process will still eventually receive a SIGTERM.
6 years ago
David Wilson 690ee6dbe2 Fix select_test failure, remove crap old timing_test. 6 years ago
David Wilson 15bf0f54e2 Beginnings of module_finder_test 6 years ago
David Wilson 9b13a4cc61 Fix 2 call_function_test failures. 6 years ago
David Wilson 79dd00db5a master: hack to avoid executing __main__. 6 years ago
David Wilson 6f5d4882da We don't support sets, so don't use them in module loader(!) 6 years ago
David Wilson ecd39e4f2a add missing IOLOG, fixes _iter_read/SshTest. 6 years ago
David Wilson 451fb347d0 master: include related modules in ModuleResponder response 6 years ago
David Wilson 4af920094a iter_read: also treat 0-byte read as disconnection 6 years ago
David Wilson d169b55d64 select: fix typo 6 years ago
David Wilson af6812b458 Fix context naming for sudo and via=. 6 years ago
David Wilson f1d82c7284 More API documentation. 6 years ago
David Wilson b7f95e558f Better document Router API and constructors. 6 years ago
David Wilson 849ccebe04 receiver: only permit one notify callback
There is no point spamming a list for every function call, there is no
use case where multiple notify callbacks would be useful.
6 years ago
David Wilson 1be10575a1 importer: Don't respond to non-.py[co] imports. 6 years ago
David Wilson f869e088f8 issue #20: tests and fixes for mitogen.master.Select(). 6 years ago
David Wilson e3d967ebeb issue #20: initial implementation of mitogen.master.Select(). 6 years ago
David Wilson 14783c75e8 issue #9: log warning when a cross-sibling CALL_FUNCTION occurs
First step to making it a fatal error.
6 years ago
David Wilson 4de321a3b0 Adjust get_boot_command to match _first_stage change
inspect module includes the staticmethod decorator added by
a8d1dc6730
6 years ago
David Wilson c810f66bcc issue #19: whoops, implement sliding window properly 6 years ago
David Wilson 43ccbf0459 issue #19: second attempt at import scanner
This version is based on the modulefinder standard library module,
pruned back just to handle modules we know have been loaded already, and
to scan module-level imports only, rather than imports occurring in
class and function scope (crappy heuristic, but assume they are lazy
imports).

The ast and compiler modules were far too slow, whereas this version can
bytecode compile and scan all the imports for django.db.models (58
modules) in around 200ms.. 3.4ms per dependency, it's probably not going
to get much faster than that.
6 years ago
David Wilson 175abee2c9 Fix inverted logic. 6 years ago
David Wilson 8054fa867a Only import compiler when necessary, it's not available in 3.x. 6 years ago
Alex Willmer aa817f1b83 Handle failure to import the ast module 6 years ago
Alex Willmer 1f955fc655 Declare self-less method as static
Found using pylint
6 years ago
Alex Willmer 36754254b2 Add missing imports: ast, compiler
Found using pylint
6 years ago
David Wilson eb060e1a0e Document Router.profiling. 6 years ago
David Wilson 9c4bf37cfc Remove final vestiges of context.key. 6 years ago
David Wilson 05cc74d142 core: Support profiling 6 years ago
David Wilson 04ea5306e9 Document a bunch of mitogen.master and move more docstrings into Sphinx. 6 years ago
David Wilson b2f13f1fa4 master: propagate routes for IDs allocated via ALLOCATE_ID
needed for inter-child rsync.
6 years ago
David Wilson a9387b0504 core: remove pointless eval() of ARGV0 environment variable. 6 years ago
David Wilson 1411790f56 master: make write_all() handle O_NONBLOCK and deadlines. 6 years ago
David Wilson 2ee7309378 master: send_await() always unpickles now. 6 years ago
David Wilson db225638f0 core: Make iter_read() handle deadline (and non-blocking IO) properly 6 years ago
David Wilson 7a60b20dc6 core: Generalize/duplicate the call/send_await code using Receiver. 6 years ago
David Wilson 76d35df889 master: use decorators rather than call_with_deadline(with_context=..) 6 years ago
David Wilson 2a365aa9b0 Replace `with_context` parameter with mitogen.core.takes_econtext decorator 6 years ago
David Wilson c67119501b Keep allocate_id() in the enhanced router class. 6 years ago
David Wilson 02a37d2339 Fix format string. 6 years ago
David Wilson 4720eb1c55 core: add ALLOCATE_ID message for fakessh. 6 years ago
David Wilson 78d5575d4e Fix proxy connection: pickling changes broke it. 6 years ago
David Wilson 76e476dcfa Tidy up logging of command lines for easier cutpaste. 6 years ago
David Wilson e66590f098 Initial version of ModuleFinder, but it's slooooow. 6 years ago
David Wilson 53467d394d Log forwarded events just as the docs suggest they're logged. 6 years ago
David Wilson dc446f9042 ssh: Learn to type passwords and supply pubkeys.
Now ssh requires a tty allocation. This presents a scalability problem,
a future version could selectively allocate a tty only if typing
passwords is desired.

Sudo's tty handling is now moved into mitogen.master.
6 years ago
David Wilson be9e55fe8c pickle: support Context(), use same unpickler everywhere.
* Support passing Context() objects in function calls and return values.
  Now the fakessh demo from the documentation index would work
  correctly.

* Since slaves can communicate with each other now, they should also use
  the same approach to unpickling as the master already used. Collapse
  away all the unpickle extension crap and hard-wire just the 3 types
  that support unpickling.
6 years ago
David Wilson 11acc031a9 pickle: Prevent access to the _Dead and CallError constructors
This should be pretty much identical the same behaviour as before, but
the extra assertion makes me feel happier.
6 years ago
David Wilson e75f1d8579 Add call_function_test, fix various exception bugs. 6 years ago
David Wilson e7ff6259a3 Initial commit. 6 years ago