Re: [Twisted-Python] sharing a dict between child processes

2019-11-06 Thread Waqar Khan
:52 GMT Waqar Khan wrote: > > Hi Barry, > > Thanks for the response. Where can I read more about (1). It > seems > > like that is something I need to explore. > > As we already have (2) (cache for each process). > > Thanks again for your help. > > We use

Re: [Twisted-Python] sharing a dict between child processes

2019-11-06 Thread Waqar Khan
:22 GMT Maarten ter Huurne wrote: > > On Wednesday, 6 November 2019 07:19:56 CET Waqar Khan wrote: > > > Hi, > > > So, I am writing a twisted server. This server spawn multiple child > > > processes using reactor spawnProcess that initializes a process > >

Re: [Twisted-Python] sharing a dict between child processes

2019-11-06 Thread Waqar Khan
9 at 6:22 AM Maarten ter Huurne wrote: > On Wednesday, 6 November 2019 07:19:56 CET Waqar Khan wrote: > > Hi, > > So, I am writing a twisted server. This server spawn multiple child > > processes using reactor spawnProcess that initializes a process > > protocol. >

[Twisted-Python] sharing a dict between child processes

2019-11-05 Thread Waqar Khan
Hi, So, I am writing a twisted server. This server spawn multiple child processes using reactor spawnProcess that initializes a process protocol. Now, each of the childprocess receives some REST requests. Each process has a dict that acts as cache. Now, I want to share dict across processes. In ge

Re: [Twisted-Python] In memory cache in twisted

2019-09-26 Thread Waqar Khan
eally just getting started with twisted. Thanks for all the help. On Thu, Sep 26, 2019 at 11:40 PM Maarten ter Huurne wrote: > On Friday, 27 September 2019 04:38:46 CEST Waqar Khan wrote: > > Hi, > > What's a good way to use a simple dictionary as a cache in twisted > &

Re: [Twisted-Python] In memory cache in twisted

2019-09-26 Thread Waqar Khan
Good point. Thanks for responding. But, is the above way of using dictionary as cache correct? Or is there a "deffered" way of doing this? All I want is an inmemory cache that is compatible with this async paradigm? On Thu, Sep 26, 2019 at 10:45 PM Gelin Yan wrote: > Hi > > I don't see any r

[Twisted-Python] In memory cache in twisted

2019-09-26 Thread Waqar Khan
Hi, What's a good way to use a simple dictionary as a cache in twisted framework? Basically, I have this callback chain where I ultimately make a rest call (in non-blocking way using treq) to fetch some data. But before I make the call, I am using a dictionary to see if the value is available or

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-05 Thread Waqar Khan
To add on this.. Glpyh's suggestion was to not call `request.close()` if notifyFinish() deferred has been fired. But I am not sure how do I check if that deffered is available or not. On Mon, Aug 5, 2019 at 2:26 PM Waqar Khan wrote: > Hi Jean, > Yeah, actually that is the exa

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-05 Thread Waqar Khan
return future def handle_cancel(failure, d): d.cancel() print(failure.getTraceback()) On Mon, Aug 5, 2019 at 2:21 PM Jean-Paul Calderone < exar...@twistedmatrix.com> wrote: > On Mon, Aug 5, 2019 at 2:15 PM Waqar Khan wrote: > >> False alarm. Seem

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-05 Thread Waqar Khan
re whether the notifyFinish error deferred has been fired or not. Could I have like a vanilla "HelloWorld" example? Thanks On Mon, Aug 5, 2019 at 2:24 AM Waqar Khan wrote: > Hi Glyph, > I am not sure I understand. > > Is there a method/variable in request which keeps a

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Waqar Khan
nish has been called before calling finish? On Mon, Aug 5, 2019 at 1:56 AM Glyph wrote: > > > On Aug 4, 2019, at 9:04 PM, Waqar Khan wrote: > > Ah yes.. That is true.. > > If I comment out request.finish() (Here is the doc which I tried to > followed: > https://twis

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Waqar Khan
just stuck.. In [491]: requests.get("http://0.0.0.0:/test with params " ) It just stays stuck :( I do want to convey my thanks for the help. Really appreciate it. On Sun, Aug 4, 2019 at 11:55 PM Glyph wrote: > > > > On Aug 4, 2019, at 8:43 PM, Waqar Khan wrote: &g

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Waqar Khan
, Aug 4, 2019 at 11:26 PM Waqar Khan wrote: > Hi Glyph, >Here is the minimal version > > > class FooResource(resource.Resource): >def render_GET(request): > future = asyncio.ensure_future(self.fetch_response(request)) > // some async await fun

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Waqar Khan
ost; "\nbuiltins.RuntimeError: Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.\n' On Sun, Aug 4, 2019 at 10:36 PM Glyph wrote: > > > > On Aug 4, 2019, at 5:57 PM, Waqar Khan wrote: > > > > Hi Glyp

Re: [Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-04 Thread Waqar Khan
cio community? Thanks for all the help. Regards, Waqar On Sat, Aug 3, 2019 at 3:56 PM Glyph wrote: > > > On Aug 2, 2019, at 4:31 PM, Waqar Khan wrote: > > Hi, > I have a twisted server. And I have been seeing this annoying issue. > Normally. when i develop and test it

[Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

2019-08-02 Thread Waqar Khan
Hi, I have a twisted server. And I have been seeing this annoying issue. Normally. when i develop and test it out. everything is fine.. But then I try to loadtest is via https://locust.io/ Again, everything is fine.. until I "stop" the test. Then, I see this 'Traceback (most recent call last):\n

Re: [Twisted-Python] Twisted tips for designing highly concurrent twisted REST API

2019-07-13 Thread Waqar Khan
Hi, Thank you all for your kind response. So, I am trying to use treq library import treq @defer.inlinecallbacks def long_computation(rec_type, data): # some long computation *defer.returnValue(recs)* @defer.inlinecallbacks def fetch_data(user_id): r = yield treq.get('url/t

Re: [Twisted-Python] Twisted tips for designing highly concurrent twisted REST API

2019-06-25 Thread Waqar Khan
ype] = rec defer.returnValue(recs) On Tue, Jun 25, 2019 at 11:48 PM Waqar Khan wrote: > Hello folks, > I recently stumbled upon twisted and was wondering if it could suit my > needs. On one hand, I want to use python but on another hand there are all > these scalability concerns wi

[Twisted-Python] Twisted tips for designing highly concurrent twisted REST API

2019-06-25 Thread Waqar Khan
Hello folks, I recently stumbled upon twisted and was wondering if it could suit my needs. On one hand, I want to use python but on another hand there are all these scalability concerns with this language so, I though I would pick the brains of the community. So.. a flask based app would look som