Hi Tomer,
any suggestions regarding my previous post?
thanks
On Sunday, December 23, 2012 3:03:41 PM UTC+2, ben wrote:
>
> Hi Tomer,
>
> please accept my appology, was not trying to be rude.
>
> thanks for the reply, the obtain/deliver methods looks really promising,
> although i am unable to get them to work as yet (possibly because i am not
> using the classic mode but rather the service mode)
>
> on the server i am creating a list of objects and trying to pass them back
> to the client, and be able to have some form of access to them after the
> connection has been terminated.
>
> connection code:
>
> @contextmanager
> def connection_to_root(self):
> conn = connect(self._agent_host, self._agent_port,
> config = {"allow_all_attrs" : True,
> 'allow_pickle' : True})
> conn.root.setup(*self._args, **self._kwargs)
> yield conn.root.root
> conn.close()
>
> from the client, i then use code like:
> with Client(ip).connection_to_root() as c:
> return [SomeLocalClass(x) for x in xrange(5)]
>
> Obviously, as soon as i leave the context, my "weakly referenced" object
> are no longer available. and when i try to deepcopy them, i get the error
> above with the lock.
>
> how would i use the obtain/deliver to get what i need, everything i passed
> to it so far as the connection complains that it does not have the modules
> attribute required to execute the following line:
> return conn.modules["rpyc.lib.compat"].pickle.loads(pickle.dumps(localobj))
>
> again, appologies for the rudeness
>
>
> On Sunday, December 23, 2012 2:28:19 PM UTC+2, Tomer Filiba wrote:
>>
>> and even though you're rude, try looking at rpyc.classic.obtain/deliver
>>
>> https://github.com/tomerfiliba/rpyc/blob/master/rpyc/utils/classic.py#L251
>>
>> -----------------------------------------------------------------
>>
>> *Tomer Filiba*
>> tomerfiliba.com <http://www.facebook.com/tomerfiliba>
>> <http://il.linkedin.com/in/tomerfiliba>
>>
>>
>> On Sun, Dec 23, 2012 at 2:17 PM, Tomer Filiba <[email protected]> wrote:
>>
>>> how about you post a code snippet ???
>>>
>>> -----------------------------------------------------------------
>>>
>>> *Tomer Filiba*
>>> tomerfiliba.com <http://www.facebook.com/tomerfiliba>
>>> <http://il.linkedin.com/in/tomerfiliba>
>>>
>>>
>>> On Sun, Dec 23, 2012 at 2:15 PM, ben <[email protected]> wrote:
>>>
>>>> yet, when i try to make a deepcopy of an object after allowing
>>>> pickling, i get the following error:
>>>>
>>>> File "/auto/sw_tools/root/lib/python2.7/copy.py", line 182, in deepcopy
>>>> rv = reductor(2)
>>>> File
>>>> "/auto/sw_tools/root/lib/python2.7/site-packages/rpyc-3.2.1-py2.7.egg/rpyc/core/netref.py",
>>>>
>>>> line 176, in __reduce_ex__
>>>> return pickle.loads, (syncreq(self, consts.HANDLE_PICKLE, proto),)
>>>> File
>>>> "/auto/sw_tools/root/lib/python2.7/site-packages/rpyc-3.2.1-py2.7.egg/rpyc/core/netref.py",
>>>>
>>>> line 71, in syncreq
>>>> return conn.sync_request(handler, oid, *args)
>>>> File
>>>> "/auto/sw_tools/root/lib/python2.7/site-packages/rpyc-3.2.1-py2.7.egg/rpyc/core/protocol.py",
>>>>
>>>> line 433, in sync_request
>>>> raise obj
>>>> *cPickle.PicklingError: Can't pickle <type 'thread.lock'>: attribute
>>>> lookup thread.lock failed*
>>>>
>>>> (I am running a Treaded server...)
>>>>
>>>> ???
>>>>
>>>> On Monday, October 8, 2012 9:17:40 PM UTC+2, Tomer Filiba wrote:
>>>>
>>>>> See allow_pickle at http://rpyc.sourceforge.net/**
>>>>> api/core_protocol.html#api-**protocol<http://rpyc.sourceforge.net/api/core_protocol.html#api-protocol>
>>>>>
>>>>> https://github.com/**tomerfiliba/rpyc/blob/master/**
>>>>> rpyc/core/protocol.py#L547<https://github.com/tomerfiliba/rpyc/blob/master/rpyc/core/protocol.py#L547>
>>>>>
>>>>> I have no idea where you got thread safety issues from
>>>>> On Oct 8, 2012 9:02 PM, "samovar" <[email protected]> wrote:
>>>>>
>>>>>> Running as a service and trying to write a pickle file on the remote,
>>>>>> I get:
>>>>>>
>>>>>> ValueError: pickling is disabled
>>>>>>
>>>>>> I read that pickling is disabled because it is not thread safe.
>>>>>>
>>>>>> Of course it's not thread safe. No one who is capable to use Rpyc
>>>>>> would think it is.
>>>>>> Static class data and @classmethod are not thread safe either. Should
>>>>>> these also be disallowed? There not.
>>>>>>
>>>>>> I will use a locking mechanism to deal with thread safety issues for
>>>>>> pickle. I should be able to do this.
>>>>>> Making it totally unavailable is wrong.
>>>>>>
>>>>>> Am I wrong?
>>>>>>
>>>>>>
>>>>>>
>>>
>>