[kepler-dev] Python actor as class issue

Christopher Brooks cxh at eecs.berkeley.edu
Thu May 29 14:59:32 PDT 2008


Hi Norbert,
I can replicate the problem of using the Python actor inside an
actor oriented class.

I've attached a Ptolemy specific test case, which is now in the tree
in ptII/ptolemy/actor/lib/python/test/auto/testPythonClass.xml

Usually, these problems are caused by cloning bugs.  We've been
discussing these bugs lately and I have tests checked in that
identify PythonScript._model as not properly being cloned.

ptolemy/configs/test/allConfigs.tcl runs the Configuration.check()
method which checks the actors in the configuration.
One of the errors is:

The _class org.python.core.PyClass field the clone of 
"ptolemy.actor.lib.python.PythonScript" does not point to an object 
distinct from the master.
The clone(Workspace) method should have a line like:
  newObject._class = (ptolemy.actor.lib.python.PythonScript)newObject
      /* Get the object method or null?  */ _class;

Unfortunately, my test above is not complete, since not just _class,
but other private variables need to be added to
PythonScriptclone(Workspace)

However, when I add all the private variables, then the
test passes.  So, if you do a cvs update of ptII, the problem
should be fixed

Thanks for pointing this out.  I'm working on the other clone
problems, but there are plenty of them and I'm still refining
the test.

Once I get the test working, it will be easy to run it on the Kepler
actors via the about:copyright facility.  Then we can identify
Kepler actors that need clone(Workspace) methods.  The only
real problem caused by an incomplete clone(Workspace) method
is that Actor Oriented Classes become disoriented :-)

_Christopher

Chad Berkley wrote:
> Hey Norbert,
> 
> I have no experience with the jython actor, so I guess I'm not the guy 
> to ask.  I know dan higgins (higgins at nceas.ucsb.edu) has done a bunch 
> with it.  He might know.
> 
> chad
> 
> 
> Norbert Podhorszki wrote:
>> Hi Christopher and Chad,
>>
>> I am seemingly getting used to the jython actor. I have now two of them.
>> I have tried to make a class from a jython actor and to use instances 
>> in the
>> workflow but it seems not to work: only one of them (the latest instance)
>> works. Here is a simple pass-it-on actor made to be a class with two
>> instances. You will see that only the second instance produces output.
>>
>> If you change the PN director to SDF, you get exception for the buffer 
>> size
>> at the first instance, so it looks it is not fired by SDF at all.
>>
>> Do you have any idea why the "classification" does not work with
>> PythonScript?
>>
>> Currently, I have copies of the actor in the workflow and it works 
>> that way.
>>
>> Thanks
>> Norbert
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testPythonClass.xml
Type: text/xml
Size: 12097 bytes
Desc: not available
Url : http://mercury.nceas.ucsb.edu/ecoinformatics/pipermail/kepler-dev/attachments/20080529/8e370556/attachment-0001.xml 


More information about the Kepler-dev mailing list