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)

Project Task Page: Axon ThreadedComponent API Change

Status: Completed
Current Developers: MH
Current "inflight" dev location: /branches/private_MH_axon_threads
Start Date: 13 April 2006
Expected End Date: n/a
End Date: 4 May 2006
Date this page last updated: 22 February 2007
Estimated effort so far: 15


Description

To change the design of ThreadedComponent so that when writing a component based on it, it is almost identical to writing a normal component (just leaving out the yield statements).

The existing design required the component writer to access queue objects to send and receive data, rather than use the self.dataReady(), self.send and self.recv() methods they would use for a normal component.

In the process, thread safety should also be improved, and the ability to add and remove inboxes and outboxes on the fly (ala AdaptiveCommsComponent) should be implemented.

Benefits:

Inputs

Task Sponsor: Michael (MS)

Task Owner: Matt (MH)

Developers involved: Matt (development), Michael (merging)

Users: Matt, Michael

Interested third parties: none

Requirements

Just like for a normal component, when writing a threaded one...

MUST be thread safe for:

SHOULD be able to trap exceptions and throw them back to the main thread so an Axon system can correctly terminate.

Relevant Influencing factors:

Outputs

Expected

Actual

Code:

CVS branch: private_MH_axon_threads

Mainline code: /Code/Python/Axon/Axon/

Mainline code: /Code/Python/Axon/Axon/Tests

Updated components to use new API:

Realistic possibilities arising as a result of activity on this task

Need to make access to CAT threadsafe too.

Task Log

Discussion

Distinction between activity-creators and non activity-creator components removed (the scheduler would stop if there wasn't at least one activity-creator microprocess running). This was no longer necessary as there was no longer a postman microprocess (a non activity-creator). Removing support for this from the scheduler simplified things, making implementing support for the new design threaded components (and later quiescence optimisations) easier.

-- Matt Hammond, 22 February 2007