[PEAK] Trellis: tasks and discrete sensors

Sergey Schetinin maluke at gmail.com
Thu Oct 9 15:22:45 EDT 2008


On Thu, Oct 9, 2008 at 20:21, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 08:03 PM 10/9/2008 +0300, Sergey Schetinin wrote:
>>
>> This test shows that @task rules never get to see discrete values. It
>> prints 'waiting' twice, so they are triggered, but sensor value is
>> None both times.
>
> This is a documented limitation, or at least it should be documented.  :)
>
> Tasks can't read discrete values because a task step cannot be "undone".
>  This is why they are only run from the system event loop.  If you need to
> communicate discrete events to a task, you will need to write them to a list
> or something of that sort, and then have the task read and remove them.

It makes sense, but it wasn't obvious, after all Performers can't be
undone, but they do see discrete value changes. The tasks aren't
read-only, so that makes the difference, but it would take quite some
time to figure out on my own. I also checked the docs, and it seems
that this isn't documented.

Anyway, I've changed the code according to your advice and it now
seems more architecturally correct too. This happens rather often when
I have to change something to adhere to some Trellis requirements,
rather than being a nuisance it often lead to overall better
solutions. A wonderful library, thanks a lot!



More information about the PEAK mailing list