Re: Missing a method for resetting the PySystemState

Indra Talip <[email protected]>
Newsgroups gmane.comp.lang.jython.devel
Message-ID <CAE+gEVeGHMuR=ue3q5xxVt49PDTJ--78BvnXuyyjgoBV1eCuZQ@mail.gmail.com>
G'day Ivan,
I have done similar (but no longer have access to the code in question) and
used a combination of keeping track of the PySystemState associated with a
particular script and an import hook that kept track of file modification
times so that if the script changed it could be reloaded. This worked quite
well and I mentioned it in a previous email to the Jython Users list here:
http://sourceforge.net/p/jython/mailman/message/32323250/

The import hook for automatically reloading scripts was cribbed from
https://gist.github.com/aliles/2730798

Cheers
Indra

On 28 August 2015 at 22:22, Ivan Ponomarev <[email protected]> wrote:

> Hello,
>
> We develop an open source project, using Jython as a script
> interpretation tool. Our application uses a pool of PythonInterpreter
> objects to facilitate multi-user work in web application.
>
> After upgrading to Jython version 2.7 we faced the following critical
> problem. In version 2.5, in order to create new PythonInterpreter each
> time we needed one more we used the following:
>
>     new PythonInterpreter(null, new PySystemState())
>
> Due to changes in version 2.7 we had to change to
>
>     new PythonInterpreter(null, Py.getSystemState())
>
> as previous method failed to work properly (random packages were
> reported as missing).
>
> Now the problem is that each time we change a Jython script file it is
> not enough to clear a pool of PythonInterpreters anymore to get things
> work the new way. We need to restart the whole Java application because
> PySystemState returned by Py.getSystemState() apparently caches the
> previous version of compiled byte code. Restarting the application takes
> up to several minutes, but we have to change the scripts 'on the fly'.
>
> If we had a proper method of resetting PySystemState it would have
> solved our problem. But we don't have one, e. g. see an open issue
> http://bugs.jython.org/issue2053. Could you comment, if you are going to
> solve the problem.  Maybe we could help you to solve it.
>
> Regards,
>
> Ivan Ponomarev, PhD
>
>
> Course-IT LLC.
>
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Jython-dev mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jython-dev
>



-- 
Indra Talip

------------------------------------------------------------------------------

_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.