Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 June 18, 2010 19:17:26

a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How do I update a global variable?


In my django application I have a global variable 'gv' which is
accessed by different requests coming from the end users.

Now 'gv' holds a data of 2 MB size which needs to be update at regular
interval, pulling 2 MB data from the database for every request
doesn't make sense.

For this I have planned to use celery as a scheduler which will do the
update but looks like it runs as a different process and can't access
'gv'!
What could be possible ways where celery can update 'gv'? I can think
of calling a url from celery which updates 'gv' but not sure if this
is the right way of doing it.

Appreciate your responses

Thanks
Vishal

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 18, 2010 22:23:50

Daniel R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How do I update a global variable?


On Jun 18, 7:17 pm, aurphir <ranavis...@gmail.com> wrote:
> In my django application I have a global variable 'gv' which is
> accessed by different requests coming from the end users.
>
> Now 'gv' holds a data of 2 MB size which needs to be update at regular
> interval, pulling 2 MB data from the database for every request
> doesn't make sense.
>
> For this I have planned to use celery as a scheduler which will do the
> update but looks like it runs as a different process and can't access
> 'gv'!
> What could be possible ways where celery can update 'gv'? I can think
> of calling a url from celery which updates 'gv' but not sure if this
> is the right way of doing it.
>
> Appreciate your responses
>
> Thanks
> Vishal

I'm having trouble thinking of any use case that would require the
keeping of a 2mb global variable in memory, but no doubt you have your
reasons.

You probably want something like memcached, which both Django and
celery can talk to directly through the caching framework.
--
DR.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 19, 2010 04:14:28

Stefan F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How do I update a global variable?


Please rethink your design! There is certainly no need for a globalvariable. There is may be a way to implement your requirement as asingleton that is being able to deliver the huge bag of data in a muchmore smarter way.Am 18.06.2010 um 20:17 schrieb aurphir <ranavis...@gmail.com>:In my django application I have a global variable 'gv' which is
accessed by different requests coming from the end users.

Now 'gv' holds a data of 2 MB size which needs to be update at regular
interval, pulling 2 MB data from the database for every request
doesn't make sense.

For this I have planned to use celery as a scheduler which will do the
update but looks like it runs as a different process and can't access
'gv'!
What could be possible ways where celery can update 'gv'? I can think
of calling a url from celery which updates 'gv' but not sure if this
is the right way of doing it.

Appreciate your responses

Thanks
Vishal

--You received this message because you are subscribed to the GoogleGroups "Django users" group.To post to this group, send email to django-us...@googlegroups.com.To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 18th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support