Re: Work between multiple processes

2017-01-11 Thread Irmen de Jong
On 10-1-2017 23:57, Patrick Zhou wrote:
> Hi Irmen,
> 
> I have successfully got it to work with both side as python but so far having 
> trouble with pyrolite.jar which is downloaded from 
> https://mvnrepository.com/artifact/net.razorvine/pyrolite/4.4
> 
> 

[...]

> 
> which "getDst" works on Java but hangs on handshake() in the call function. 
> 
> Any thought? Thanks. -P
> 

Yeah, don't use the oldest version of the library available, use the newest ;-)
https://mvnrepository.com/artifact/net.razorvine/pyrolite/4.15


Irmen

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Work between multiple processes

2017-01-10 Thread Patrick Zhou
Hi Irmen,

I have successfully got it to work with both side as python but so far having 
trouble with pyrolite.jar which is downloaded from 
https://mvnrepository.com/artifact/net.razorvine/pyrolite/4.4


Having simple codes as:

public static void main(String[] args) {
//System.out.println("Hello world");

try {
String uri = 
"PYRO:obj_12a65b09f95f4ee9bec5958f819ced45@localhost:64404";
PyroURI pyURI = new PyroURI(uri);
PyroProxy pyroP = new PyroProxy(pyURI);

Object result = pyroP.call("getDst");
String message = (String) result;
System.out.println("result message=" + message);
pyroP.close();
}
catch (IOException e1) {
System.out.println(e1.getMessage());
}
catch (PickleException e2)
{
System.out.println(e2.getMessage());
}
catch (PyroException e3)
{
System.out.println(e3.getMessage());
}
}

which "getDst" works on Java but hangs on handshake() in the call function. 

Any thought? Thanks. -P
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Work between multiple processes

2017-01-06 Thread Irmen de Jong
On 4-1-2017 23:14, zxpat...@gmail.com wrote:
> Hi everyone,
>
> I ran into a case that I need to create a work process of an application
(Jython so has to call using java.exe) which will collect the data based on 
what main process indicates.
>
> (1) I tried multiprocessing package, no luck. Java.exe can't be called from
Process class?
>
> (2) I tried subprocess. subprocess.communicate function will wait for the
work process to terminate so to return.
>
>
> either (1) or (2) doesn't work out well. Please suggest.  Global system
queue?
>
> Thanks,
> Patrick.
>


Is it a requirement that the workdf process is also Jython?

If not: you could spawn a Python subprocess that hosts a Pyro4 daemon. 
Utilizing the Pyrolite java client library you can call methods in it from the 
java/jython side.  (Unfortunately it is not yet possible (due to jython 
incompatibilities) to use the full Pyro4 library on the Jython side as well). 
Not sure if it meets your set of requirements but have a look at 
http://pythonhosted.org/Pyro4/
http://pythonhosted.org/Pyro4/pyrolite.html


Irmen

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Work between multiple processes

2017-01-06 Thread Patrick Zhou
On Thursday, January 5, 2017 at 5:49:46 PM UTC-5, Irmen de Jong wrote:
> On 4-1-2017 23:14, zxpat...@gmail.com wrote:
> > Hi everyone,
> > 
> > I ran into a case that I need to create a work process of an application 
> > (Jython so has to call using java.exe) which will collect the data based on 
> > what main process indicates. 
> > 
> > (1) I tried multiprocessing package, no luck. Java.exe can't be called from 
> > Process class?
> > 
> > (2) I tried subprocess. subprocess.communicate function will wait for the 
> > work process to terminate so to return.
> > 
> >  
> > either (1) or (2) doesn't work out well. Please suggest.  Global system 
> > queue?
> > 
> > Thanks,
> > Patrick.
> > 
> 
> 
> Is it a requirement that the workdf process is also Jython?
> 
> If not: you could spawn a Python subprocess that hosts a Pyro4 daemon.
> Utilizing the Pyrolite java client library you can call methods in it from the
> java/jython side.  (Unfortunately it is not yet possible (due to jython
> incompatibilities) to use the full Pyro4 library on the Jython side as well).
> Not sure if it meets your set of requirements but have a look at
> http://pythonhosted.org/Pyro4/
> http://pythonhosted.org/Pyro4/pyrolite.html
> 
> 
> Irmen


Thanks Irmen. I think that could be the solution I am looking for. The main 
process will be native python so it can be used to host a pyro daemon even with 
lock. The jython will be a subprocess that takes the daemon's uri and use the 
pyrolite library to make the communication. The only trouble is that I will 
have to involve two more java libraries but I don't think it is a big of deal. 
Will try it and post the source code if possible.
-- 
https://mail.python.org/mailman/listinfo/python-list


Work between multiple processes

2017-01-06 Thread zxpatric
Hi everyone,

I ran into a case that I need to create a work process of an application 
(Jython so has to call using java.exe) which will collect the data based on 
what main process indicates.

(1) I tried multiprocessing package, no luck. Java.exe can't be called from 
Process class?

(2) I tried subprocess. subprocess.communicate function will wait for the work 
process to terminate so to return.


either (1) or (2) doesn't work out well. Please suggest.  Global system queue?

Thanks,
Patrick.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Work between multiple processes

2017-01-05 Thread Irmen de Jong
On 4-1-2017 23:14, zxpat...@gmail.com wrote:
> Hi everyone,
> 
> I ran into a case that I need to create a work process of an application 
> (Jython so has to call using java.exe) which will collect the data based on 
> what main process indicates. 
> 
> (1) I tried multiprocessing package, no luck. Java.exe can't be called from 
> Process class?
> 
> (2) I tried subprocess. subprocess.communicate function will wait for the 
> work process to terminate so to return.
> 
>  
> either (1) or (2) doesn't work out well. Please suggest.  Global system queue?
> 
> Thanks,
> Patrick.
> 


Is it a requirement that the workdf process is also Jython?

If not: you could spawn a Python subprocess that hosts a Pyro4 daemon.
Utilizing the Pyrolite java client library you can call methods in it from the
java/jython side.  (Unfortunately it is not yet possible (due to jython
incompatibilities) to use the full Pyro4 library on the Jython side as well).
Not sure if it meets your set of requirements but have a look at
http://pythonhosted.org/Pyro4/
http://pythonhosted.org/Pyro4/pyrolite.html


Irmen

-- 
https://mail.python.org/mailman/listinfo/python-list


Work between multiple processes

2017-01-04 Thread zxpatric
Hi everyone,

I ran into a case that I need to create a work process of an application 
(Jython so has to call using java.exe) which will collect the data based on 
what main process indicates. 

(1) I tried multiprocessing package, no luck. Java.exe can't be called from 
Process class?

(2) I tried subprocess. subprocess.communicate function will wait for the work 
process to terminate so to return.

 
either (1) or (2) doesn't work out well. Please suggest.  Global system queue?

Thanks,
Patrick.
-- 
https://mail.python.org/mailman/listinfo/python-list