Commit Graph

1045 Commits (master)

Author SHA1 Message Date
David Wilson ffa063cc01 docs: annother barriage of cross-reference fixes. 6 years ago
David Wilson 7f3a58d514 core: Remove unused on_shutdown attribute. 6 years ago
David Wilson c9daa2ff30 docs: move fakessh docs into Sphinx. 6 years ago
David Wilson 6a10ab605e docs: move mitogen.utils docs to Sphinx. 6 years ago
David Wilson ec66152e37 docs: better io_op doc, move Side docs to Sphinx. 6 years ago
David Wilson 0767abf26f docs: move BasicStream docs into Sphinx. 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 3285fc2f75 Implement test_aborted_on_local_context_disconnect 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 2454dcc990 core: loosen assertion to allow fakessh_test to succeed. 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 815f23bddd Sense of block= parameter was inverted. 6 years ago
David Wilson c4d9f124c6 Document Sender and Receiver classes. 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 48bf987570 issue #20: fix queue.get() parameter list. 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 9de1fca3bf issue #9: ensure messages arrive on the expected stream
If no ADD_ROUTE message has been received from the master associating a
stream with a particular context ID, then it is expected messages
originating from that context ID can only be routed via the parent.
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 dd8271f061 Fix stale references to m.master.connect & m.ssh.connect
I'm fairly sure these updates are correct, but I'm not able to run the
test suite to confirm.
6 years ago
Alex Willmer d706b7d6b8 Update lingering references to with_broker & run_with_broker
A previous commit renamed run_with_broker() and with_broker() to
run_with_router() and with_router() respctively. Some references were
missed.
6 years ago
Alex Willmer dc26460a28 Add missing LOG import
Fixes an undefined variable error found by pylint
6 years ago
Alex Willmer 3b24314a8b Use fully qualified Context
Fixes an undefined variable error found by pylint
6 years ago
Alex Willmer 57a0aa26bf Add missing import of AnsibleError
Found with pylint
6 years ago
Alex Willmer f2ea38a963 Add missing auth_incorrect_msg used to in exception message
Found using pylint
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 01729b18a5 core: use an output deque rather than string to improve worst case perf
This probably worsens performance in the common case, but it prevents
runaway producers (see e.g. issue #36) from spending all their CPU
copying around huge strings.

It's also a small step towards a solution to issue #6, which will
replace the output buffer with some sort of fancier queue anyway.

This reduces a particular 40 second run of rsync to 1.5 seconds.
6 years ago
David Wilson eb060e1a0e Document Router.profiling. 6 years ago
David Wilson effe4117e1 Treat EPIPE as disconnect too; needed for fakessh. 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 b827ee1bc7 Delete mitogen.utils.log_to_tmp() 6 years ago
David Wilson 400c971f4a fakessh: SSH server uses user's shell to parse command line. 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 750e9fab24 Make log_to_file accept string level rather than logging package constant
Saves an import, pain in the ass to type all the time.
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 769ece2514 fakessh: improve logging slightly.
Makes it easier to match up reads/writes across log files by using
message byte count
6 years ago
David Wilson fb9ce1054c core: set O_NONBLOCK on every side. Closes #33
The last time I tested set_nonblock() as a fix for the rsync hang, I
used F_SETFD rather than F_SETFL, which resulted in no error, but also
did not set O_NONBLOCK. Turns out missing O_NONBLOCK was the problem.

The rsync hang was due to every context blocking in os.write() waiting
for either a parent or child buffer to empty, which was exacerbated by
rsync's own pipelining, that allows writes from both sides to proceed
even while reads aren't progressing. The hang was due to os.write() on a
blocking fd blocking until buffer space is available to complete the
write. Partial writes are only supported when O_NONBLOCK is enabled.
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 76d1e66790 fakessh: use decorators rather than call_with_deadline(with_context=..) 6 years ago
David Wilson e4c832685d core: synchronize Stream._output_buf by deferring send()
Previously _output_buf was racy. This may or may not be cheaper than
simply using a lock, but it requires much less code, so I prefer it for
now.
6 years ago
David Wilson ead67de883 core: make Side.write() return None rather than crash if side already closed. 6 years ago
David Wilson 74b31bbe47 core: better Message.__repr__. 6 years ago
David Wilson 2a365aa9b0 Replace `with_context` parameter with mitogen.core.takes_econtext decorator 6 years ago
David Wilson 8d4005c264 fakessh: fix non-master context ID allocation. 6 years ago
David Wilson bd8001d481 fakessh: Fix NameError. 6 years ago
David Wilson e7c70127bf fakessh: return child exit status 6 years ago
David Wilson 77b8d28c68 fakessh: Use local process's sys.executable. 6 years ago
David Wilson 175fe7a4e1 fakessh: IoPump() doesn't need Process reference. 6 years ago
David Wilson 8dad396e27 Make subsystem requests die with a useful error. 6 years ago
David Wilson 4244a4609c Reduce CHUNK_SIZE to paper over a hang with rsync 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 e796487cca core: allow sending 0-byte messages. 6 years ago
David Wilson 78d5575d4e Fix proxy connection: pickling changes broke it. 6 years ago
David Wilson b809d43865 Move more docstrings out of core.py. 6 years ago
David Wilson 918edf5145 Add TODO 6 years ago
David Wilson 502266f115 Fix Channel constructor and add simple test; closes #32 6 years ago
David Wilson 4f50707b82 core: support takes_econtext and takes_router decorators. 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 38a9482860 Add hacks to allow Mock to be imported. 6 years ago
David Wilson 1f99dcb435 fix unbelievably dumb variable shadowing 6 years ago
David Wilson 4e8b9ecb27 ssh: Support disabling strict host key checking. 6 years ago
David Wilson 559b88ff12 ssh: Support specifying the port too. 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