Thread: [Pydev-code] threaded jython completion server and console.
Brought to you by:
fabioz
From: Kostas G. <geo...@gm...> - 2010-01-26 07:44:00
|
Hi, i would like to digg into pydev code for creating the option of having a threaded jython interpreter for the interactive console and for the completion server. So I think instead of firing a process we could start a thread monitoring a stream or caliing one's another method. this could only be a choice for jython as it is java. Last time, some time ago, I checked the source code, the completion server was in pycompletionserver.py, as it was universal for all implementations of python. So which files you think I should check?? The problem with this approach is more on console, as it has to be one specific version of jython interpreter enabled every time. Maybe in completion it can be overcome. But as far as I am concerned I don't care about different versions. So are you interested in such a feature? Probably the console and completion will be a lot faster as a thread, don't you think? Best regards Kostas |
From: Fabio Z. <fa...@gm...> - 2010-01-26 10:24:44
|
Hi Kostas, On Tue, Jan 26, 2010 at 5:43 AM, Kostas Georgiou <geo...@gm...> wrote: > Hi, > i would like to digg into pydev code for creating the option of having a > threaded jython interpreter for the interactive console and for the > completion server. So I think instead of firing a process we could start a > thread monitoring a stream or caliing one's another method. this could only > be a choice for jython as it is java. Last time, some time ago, I checked > the source code, the completion server was in pycompletionserver.py, as it > was universal for all implementations of python. So which files you think I > should check?? > > The problem with this approach is more on console, as it has to be one > specific version of jython interpreter enabled every time. Maybe in > completion it can be overcome. But as far as I am concerned I don't care > about different versions. So are you interested in such a feature? Probably > the console and completion will be a lot faster as a thread, don't you > think? > > So, that would be more for speed right? I must say that I'm not sure that this approach is feasible because when you're gathering completions, you actually want to use a different Python or Jython interpreter (and not embed all into the Eclipse VM), and making it a Thread you wouldn't have access to that. What do you think? Cheers, Fabio |
From: Kostas G. <geo...@gm...> - 2010-01-26 14:38:06
|
Hi again, >So, that would be more for speed right? yessss. Probably it will get some speed up, don't you think? >I must say that I'm not sure that >this approach is feasible because when you're gathering completions, you >actually want to use a different Python or Jython interpreter (and not embed >all into the Eclipse VM), putting it in a thread with different classloader (equinox magic) is making it actually a different interpreter, or not?? Is just that you should do all the initialization of package additions manually (addJar, addDir, etc). >and making it a Thread you wouldn't have access to that. can you explain it a bit more please. The communication could be done through a shared variable, a pipe stream, asychronous method invocation or something else. >What do you think? thinking.... :-)So you think is difficult? Regards, Kostas |
From: Kostas G. <geo...@gm...> - 2010-01-29 12:06:26
|
Hello again, I would appreciate it if you could comment on this subject. I also wanted some help on pointing out the classes that implement the client-server functionality of completion and console, to investigate the possibility of implementing it. Thanx in advance Kostas Hi again, > >So, that would be more for speed right? > yessss. Probably it will get some speed up, don't you think? > > >I must say that I'm not sure that > >this approach is feasible because when you're gathering completions, you > >actually want to use a different Python or Jython interpreter (and not > embed > >all into the Eclipse VM), > putting it in a thread with different classloader (equinox magic) is making > it actually a different interpreter, or not?? Is just that you should do all > the initialization of package additions manually (addJar, addDir, etc). > > >and making it a Thread you wouldn't have access to that. > can you explain it a bit more please. The communication could be done > through a shared variable, a pipe stream, asychronous method invocation or > something else. > > >What do you think? > thinking.... :-)So you think is difficult? > > Regards, > Kostas > |
From: Fabio Z. <fa...@es...> - 2010-02-01 00:08:04
|
On Fri, Jan 29, 2010 at 10:06 AM, Kostas Georgiou <geo...@gm...>wrote: > Hello again, > I would appreciate it if you could comment on this subject. > I also wanted some help on pointing out the classes that implement the > client-server functionality of completion and console, to investigate the > possibility of implementing it. > > Thanx in advance > Kostas > > > Hi again, >> >So, that would be more for speed right? >> yessss. Probably it will get some speed up, don't you think? >> >> >I must say that I'm not sure that >> >this approach is feasible because when you're gathering completions, you >> >actually want to use a different Python or Jython interpreter (and not >> embed >> >all into the Eclipse VM), >> putting it in a thread with different classloader (equinox magic) is >> making it actually a different interpreter, or not?? Is just that you should >> do all the initialization of package additions manually (addJar, addDir, >> etc). >> >> >and making it a Thread you wouldn't have access to that. >> can you explain it a bit more please. The communication could be done >> through a shared variable, a pipe stream, asychronous method invocation or >> something else. >> >> >What do you think? >> thinking.... :-)So you think is difficult? >> >> Regards, >> Kostas >> > > Hi Kostas, I don't think it's difficult, but I do think that it should still be a spawned shell and not the same process as Eclipse because client code (which you'll import to do the completions) could end up halting the Eclipse VM (which doesn't seem like a nice thing for me). Thoughts? Cheers, Fabio p.s.: The communication for the completions is currently done in the AbstractShell class. |
From: Kostas G. <geo...@gm...> - 2010-02-01 19:28:05
|
Hello Fabio, I don't know about its efficiency, but if it is implemented as a worker thread (like swingworker in swing) do you think that the halting will still be possible?? I understand that generally this would be a second choice, or second citizen, but probably it could boost the jython part. In every case I would appreciate any help if I decide to go this route. thanx kostas 2010/1/29 Kostas Georgiou <geo...@gm...> > Hello again, > I would appreciate it if you could comment on this subject. > I also wanted some help on pointing out the classes that implement the > client-server functionality of completion and console, to investigate the > possibility of implementing it. > > Thanx in advance > Kostas > > > Hi again, >> >So, that would be more for speed right? >> yessss. Probably it will get some speed up, don't you think? >> >> >I must say that I'm not sure that >> >this approach is feasible because when you're gathering completions, you >> >actually want to use a different Python or Jython interpreter (and not >> embed >> >all into the Eclipse VM), >> putting it in a thread with different classloader (equinox magic) is >> making it actually a different interpreter, or not?? Is just that you should >> do all the initialization of package additions manually (addJar, addDir, >> etc). >> >> >and making it a Thread you wouldn't have access to that. >> can you explain it a bit more please. The communication could be done >> through a shared variable, a pipe stream, asychronous method invocation or >> something else. >> >> >What do you think? >> thinking.... :-)So you think is difficult? >> >> Regards, >> Kostas >> > > |
From: Fabio Z. <fa...@gm...> - 2010-02-02 23:32:35
|
On Mon, Feb 1, 2010 at 5:27 PM, Kostas Georgiou <geo...@gm...> wrote: > Hello Fabio, > I don't know about its efficiency, but if it is implemented as a worker > thread (like swingworker in swing) do you think that the halting will still > be possible?? > I understand that generally this would be a second choice, or second > citizen, but probably it could boost the jython part. In every case I would > appreciate any help if I decide to go this route. > thanx > kostas It's possible to halt it (and really simple): E.g.: if the user goes on and writes: while True: print 'something' and you import that module while it has that logic, you won't regain control over it (and that Thread would be lost and would keep one of your processors busy until eclipse exits -- as a separate process it can still be killed without any further problems in the Eclipse VM). The class where the logic for handling communication with the shell is the AbstractShell.java (so, that's the place you'd change). Cheers, Fabio |
From: Kostas G. <geo...@gm...> - 2010-02-08 09:38:05
|
Hello again, Now I see, it is the java no capable of stopping a thread problem. This would need an external monitor of threads (maybe some wrapping of jconsole :-)) For now maybe is better of having the editor's completion server on a thread. What do you think? Could you point me to the class implementing it? Also what I would like to do is to have control over the spawned jython process, like the executable and the vm arguments. Do you think is it possible to construct the java command from inside pydev? I want to run a custom configured jython process. Regards Kostas PS. The interpreters should have an internal mechanism of cancelling a halted or deadlocked command when in interactive mode ( like on Flash Actionscript or Matlab I think). >It's possible to halt it (and really simple): > >E.g.: if the user goes on and writes: > >while True: >print 'something' > >and you import that module while it has that logic, you won't regain >control over it (and that Thread would be lost and would keep one of >your processors busy until eclipse exits -- as a separate process it >can still be killed without any further problems in the Eclipse VM). > >The class where the logic for handling communication with the shell is >the AbstractShell.java (so, that's the place you'd change). |
From: Fabio Z. <fa...@es...> - 2010-02-10 23:10:13
|
On Mon, Feb 8, 2010 at 7:37 AM, Kostas Georgiou <geo...@gm...> wrote: > Hello again, > Now I see, it is the java no capable of stopping a thread problem. This > would need an external monitor of threads (maybe some wrapping of jconsole > :-)) > For now maybe is better of having the editor's completion server on a > thread. What do you think? Could you point me to the class implementing it? > Also what I would like to do is to have control over the spawned jython > process, like the executable and the vm arguments. Do you think is it > possible to construct the java command from inside pydev? I want to run a > custom configured jython process. > Regards > Kostas > PS. The interpreters should have an internal mechanism of cancelling a > halted or deadlocked command when in interactive mode ( like on Flash > Actionscript or Matlab I think). Hi Kostas, The java-side class that handles it is AbstractShell.java and in the Python/Jython side it's pycompletionserver.py Cheers, Fabio p.s. please don't top-post |