Fl0v0
Fl0v0

Reputation: 980

PyCLIPS: How to recover from errors

I'm using PyCLIPS to integrate CLIPS in a program that should act as a ECA-Server (event-conditon-action). There are incoming events that, together with the system state, may or may not trigger rules that then emit actions on a message bus.

The system state manifests itself in form of instances whose slots are being modified depending on the incoming events.

The software is intended to be a long-lived service, but when an error occurs during the execution of a rule for example through a misnamed handler:

ERROR: [MSGFUN1] No applicable primary message-handlers found for event-handler.
[PRCCODE4] Execution halted during the actions of defrule event-rule.

The clips session becomes unresponsive to new messages. Slots are no longer updated using:

clips_instance.Send(event, event_args)

There is nothing happening in clips even with clips.DebugConfig.WatchAll() there is no debug output.

Example:

>>> import clips
>>> clips.Build("(defclass POINT (is-a USER) (slot x) (slot y))")
>>> clips_instance = clips.BuildInstance("p1","POINT","(x 3) (y 5)")
>>> clips_instance.Send("get-x","")
<Integer 3>
>>> clips_instance.Send("get-z","")
<Symbol 'FALSE'>
>>> clips_instance.Send("get-y","")
<Symbol 'FALSE'>
>>> 

Is there any possibility to avoid this or recover from this state?

Upvotes: 1

Views: 136

Answers (0)

Related Questions