August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)

Kamaelia.File.UnixProcess

UnixProcess

Launch another unix process and communicate with it via its standard input and output, by using the "inbox" and "outbox" of this component.

Example Usage

The purpose behind this component is to allow the following to occur:

Pipeline(
  dataSource(),
  UnixProcess("command", *args),
  dataSink(),
).run()

How to use it

More specificaly, the longer term interface of this component will be:

UnixProcess:

  • inbox - data recieved here is sent to the program's stdin
  • outbox - data sent here is from the program's stdout
  • control - at some point we'll define a mechanism for describing control messages - these will largely map to SIG* messages though. We also need to signal how we close our writing pipe. This can happen using the normal producerFinished message.
  • signal - this will be caused by things like SIGPIPE messages. What this will look like is yet to be defined. (Let's see what works first.

Python and platform compatibility

This code is only really tested on Linux.

Initially this will be python 2.4 only, but it would be nice to support older versions of python (eg 2.2.2 - for Nokia mobiles).

For the moment I'm going to send STDERR to dev null, however things won't stay that way.


Kamaelia.File.UnixProcess.UnixProcess

class UnixProcess(Axon.Component.component)

Inboxes

  • control : We receive shutdown messages here
  • stdinready : We're notified here when we can write to the sub-process
  • inbox : Strings containing data to send to the sub process
  • stderrready : We're notified here when we can read errors from the sub-process
  • stdoutready : We're notified here when we can read from the sub-process

Outboxes

  • outbox : data from the sub command is output here
  • signal : not used
  • selectorsignal : To send control messages to the selector
  • selector : We send messages to the selector here, requesting it tell us when file handles can be read from/written to

Methods defined here

Warning!

You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.

__init__(self, command)

main(self)

openSubprocess(self)

Feedback

Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!

Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.

-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT