Tuesday, October 6, 2015

Re: Python Multiprocessing With Django

My program trigger some regression file in a remote host for that I used paramiko module.
 But I want to trigger same kinda file to different machines parallel-ly.
I am using django so that people can use this as web app.
I am using url-view-template model. How can use I multi threading in the views function? If you come up with a solution please let me know.
It requires the( if "__name__"="main": ).How can I do that?

On Friday, 6 March 2009 20:37:33 UTC+5:30, Vitaly Babiy wrote:
I have a management command that that starts up a few process to process a request: http://dpaste.com/7925/.

But every so offen I get a exception say mysql went a way, but it didn't.
Process PoolWorker-3:
Traceback (most recent call last):
 File "/usr/lib/python2.5/site-
packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/process.py", line 236, in _bootstrap
   self.run()
 File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/process.py", line 93, in run
   self._target(*self._args, **self._kwargs)
 File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/pool.py", line 71, in worker
   put((job, i, result))
 File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/queues.py", line 353, in put
   return send(obj)
PicklingError: Can't pickle <class 'http_tracker.models.DoesNotExist'>: attribute lookup http_tracker.models.DoesNotExist failed
Traceback (most recent call last):
 File "/home/vbabiy/projects/git-projects/howsthedotcom/manage.py", line 11, in <module>
   execute_manager(settings)
 File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 350, in execute_manager
   utility.execute()
 File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 295, in execute
   self.fetch_command(subcommand).run_from_argv(self.argv)
 File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 195, in run_from_argv
   self.execute(*args, **options.__dict__)
 File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 222, in execute
   output = self.handle(*args, **options)
 File "/home/vbabiy/projects/git-projects/howsthedotcom/tracker/management/commands/tracker.py", line 37, in handle
   res = p.map(check_site, sites)
 File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/pool.py", line 148, in map
   return self.map_async(func, iterable, chunksize).get()
 File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/pool.py", line 422, in get
   raise self._value
_mysql_exceptions.OperationalError: (2013, 'Lost connection to MySQL server during query')

Any one got any idea why this is happening?

Vitaly Babiy

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/238229f3-bf8c-41d4-a964-e2f4c1e0b517%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment