Commit Graph

417 Commits (1784f3c83acf7c7fec26b08e1d849fb7c86980e7)
 

Author SHA1 Message Date
David Wilson 7467fc2b0b Allow CALL_FUNCTION from non-master context.
Just ensure CALL_FUNCTION return value is sent back to src_id/reply_to
rather than 0/reply_to.
7 years ago
David Wilson 73c82415aa Log the FD for I/O to avoid expose swaparoos
Wasted some time tracking down swapped stdin/stdout.
7 years ago
David Wilson 6bd8fda1d4 Route unknown context ID messages upstream
This propagates messages up the tree until they encounter a node that
knows how to forward them back downstream. As a consequence for invalid
context IDs, a 'no route' message will always be logged by the master.
7 years ago
David Wilson 93abc0aa92 fakessh: Split Channel into Sender and Receiver. 7 years ago
David Wilson faf50585a4 Add econtext.parent_id constant too 7 years ago
David Wilson 15d3508331 Add examples section to docs. 7 years ago
David Wilson 06d65ac6ac howitworks additions 7 years ago
David Wilson fd5e962cb3 Handlers no longer depend on src_id
Now there is a single handle namespace in each context, indpendent of
the source of the message. Update module forwarder etc. to cope with
that.

This is to support slave contexts communicating without the master's
intercession.
7 years ago
David Wilson ad182bc128 Default log level should be INFO 7 years ago
David Wilson 9ed7934994 Shorten slave context logger name. 7 years ago
David Wilson c37a11fb99 Add Router.local() mostly for testing. 7 years ago
David Wilson b1d0c569f6 Add TODO 7 years ago
David Wilson 88eea78282 Kindof working graceful shutdown again. 7 years ago
David Wilson 9d356736ca Reduce os.read/os.write cutpaste. 7 years ago
David Wilson 1f49d24cd6 fakessh: Make ExternalContext.main() more flexible
- Allow specifying non-default in/out FDs
- Allow not passing econtext.core source code FD
- Allow starting directly without a first stage
- Allow disabling stdio redirection
7 years ago
David Wilson 69737701f6 Remove debug junk. 7 years ago
David Wilson 174b3242fc Support building Channels from existing handle, make .get() interruptible. 7 years ago
David Wilson 30d838edf9 Add econtext.master.Context.call_async(). 7 years ago
David Wilson 6c33d251df Reduce src_id/dst_id to 16 bits. 7 years ago
David Wilson 6a164adb22 Preserve sys.executable after first stage. 7 years ago
David Wilson 628a08e339 Update preamble_size.py for recent API changes. 7 years ago
David Wilson 7a50fa724e Defer stream naming until after connect, so PID can be included. 7 years ago
David Wilson e2dbd3a44e Update docstring. 7 years ago
David Wilson b70803a763 Update numbers. 7 years ago
David Wilson 39e70fe50c Typo. 7 years ago
David Wilson 37934f8b5a Document GET_MODULE in a slave context. 7 years ago
David Wilson 4b2170dc81 Wire up ModuleForwarder; closes #3 7 years ago
David Wilson e8b1ebc434 issue #3: Teach core.py the difference between its parent context and the master context.
Needed to allow GET_MODULE calls to reach the parent rather than the
master, when they are not the same context.
7 years ago
David Wilson c7b619a50a It's safe for Waker.on_receive() to drain all bytes.
By the the time Waker.wake() writes to the pipe, any shared state that
would trigger action on the Broker thread has already been updated, so
reading subsequent bytes caused by later Waker.wake() can't miss
anything.

This avoids spewing tons of logs messages every time there is a storm of
user-generated log messages.
7 years ago
David Wilson 821c9dfcb6 Generalize ECONNRESET, EIO handling. 7 years ago
David Wilson 0aff1d82c6 Reads more neatly. 7 years ago
David Wilson 17c2fe68f2 Add Router.enable_debug() rather than cutpasting snippets constantly. 7 years ago
David Wilson a76d871a70 issue #3: Initial ModuleForwarder implementation.
Not wired up yet.
7 years ago
David Wilson fcd3f42f9e Quieten noisy logging 7 years ago
David Wilson a87194a9b8 Uniformly call Context.on_disconnect(), not just for parent. 7 years ago
dmw 64f628d590 fix crash during on_shutdown 7 years ago
dmw 92a4a61f11 Generate context IDs like handles. 7 years ago
David Wilson f9df857a57 Tidy up API. 7 years ago
David Wilson 4969d7ba61 Fix various bits of bad logging and hard-wired timeouts. 7 years ago
David Wilson 2d92455103 Update example. 7 years ago
David Wilson 0d0c87f910 Get routing working well. 7 years ago
David Wilson 0a0a060492 Introduce econtext.core.Router, refactor everything
* Header now contains (src, dst) context IDs for routing.
* econtext.context_id now contains current process' context ID.
* Now do 16kb-sized reads rather than 4kb.
* econtext package is uniformly imported in econtext/core.py in slave
  and master.
* Introduce econtext.core.Message() to centralize pickling policy, and
  various function interfaces, may rip it out again later.
* Teach slave/first stage to preserve the copy of econtext.core sent to
  it, so that it can be used for subsequent slave-of-slave bootstraps.
* Disconnect Stream from Context, and teach Context to send messages via
  Router. In this way the Context class works identically for slaves
  directly connected via a Stream, or those for whom other slaves are
  acting as proxies.
* Implement Router, which knows a list of contexts reachable via a
  Stream. Move context registry out of Broker and into Router.
* Move _invoke crap out of stream and into Context.
* Try to avoid pickling on the Broker thread wherever possible.
* Delete connection-specific fields from Context, they live on the
  associated Stream subclass now instead.
* Merge alloc_handle() and add_handle_cb() into add_handler().
* s/enqueue/send/
* Add a hacky guard to prevent send_await() deadlock from Broker thread.
* Temporarily break shutdown logic: graceful shutdown is broken since
  Broker doesn't know about which contexts exist any more.
* Handle EIO in iter_read() too. Also need to support ECONNRESET in here.
* Make iter_read() show last 100 bytes on failure.
* econtext.master.connect() is now econtext.master.Router.connect(),
  move most of the context/stream construction cutpaste into a single
  function, and Stream.construct().
* Stop using sys.executable, since it is the empty string when Python
  has been started with a custom argv[0]. Hard-wire python2.7 for now.
* Streams now have names, which are used as the default name for the
  associated Context during construction. That way Stream<->Context
  association is still fairly obviously and Stream.repr() prints
  something nice.
7 years ago
David Wilson 0c8e486891 Clarify. 7 years ago
David Wilson e374f85888 Fix module loader deadlock
Stop using cPickle on the broker thread where it is not known whether
the pickle data would cause the import machinery to be invoked, which
currently relies on blocking calls. Huge mess but it works.

This is due to:

        context.call(some.module.func, another.module.func)

We stringify ("some.module", "func"), but the reference to
another.module.func is passed into the pickle machinery, and there's no
way to generically stringify all function references in user data for
reification on the main thread, without doing something like this
instead.
7 years ago
David Wilson 48b4ac17b7 Revert "Fix messed up font on desktop."
This reverts commit 82257c2c37.
8 years ago
David Wilson f3cf9a5501 Format string error. 8 years ago
David Wilson 2150f82af0 Remove junk, fix context name. 8 years ago
David Wilson 808af10754 Add sudo to module list. 8 years ago
David Wilson 6c8be56c63 Move write_all() to where it's used. 8 years ago
David Wilson 669cc4fdb6 Docstring for econtext.sudo.connect 8 years ago