[Checkins] SVN: zopyx.smartprintng.server/branches/multiprocessing/zopyx/smartprintng/server/ savepoint
Andreas Jung
andreas at andreas-jung.com
Thu Oct 8 12:23:53 EDT 2009
Log message for revision 104943:
savepoint
Changed:
U zopyx.smartprintng.server/branches/multiprocessing/zopyx/smartprintng/server/models.py
U zopyx.smartprintng.server/branches/multiprocessing/zopyx/smartprintng/server/run.py
-=-
Modified: zopyx.smartprintng.server/branches/multiprocessing/zopyx/smartprintng/server/models.py
===================================================================
--- zopyx.smartprintng.server/branches/multiprocessing/zopyx/smartprintng/server/models.py 2009-10-08 16:16:27 UTC (rev 104942)
+++ zopyx.smartprintng.server/branches/multiprocessing/zopyx/smartprintng/server/models.py 2009-10-08 16:23:53 UTC (rev 104943)
@@ -19,7 +19,9 @@
import mail_util
from zopyx.convert2.convert import Converter
+from pool import POOL
+
class Server(object):
""" SmartPrintNG Server Core Implementation """
@@ -155,7 +157,7 @@
""" Process html-file + images within a ZIP archive """
self.countRequest()
- zip_out, output_filename = self._processZIP(zip_archive, converter_name)
+ zip_out, output_filename = POOL.apply_async(self._processZIP, (zip_archive, converter_name))
encoded_result = base64.encodestring(file(zip_out, 'rb').read())
shutil.rmtree(os.path.dirname(zip_out))
return encoded_result
@@ -165,7 +167,7 @@
self.countRequest()
- zip_out, output_filename = self._processZIP(zip_archive, converter_name)
+ zip_out, output_filename = POOL.apply_async(self._processZIP, (zip_archive, converter_name))
mail_util.send_email(sender, recipient, subject, body, [output_filename])
shutil.rmtree(os.path.dirname(zip_out))
return True
Modified: zopyx.smartprintng.server/branches/multiprocessing/zopyx/smartprintng/server/run.py
===================================================================
--- zopyx.smartprintng.server/branches/multiprocessing/zopyx/smartprintng/server/run.py 2009-10-08 16:16:27 UTC (rev 104942)
+++ zopyx.smartprintng.server/branches/multiprocessing/zopyx/smartprintng/server/run.py 2009-10-08 16:23:53 UTC (rev 104943)
@@ -4,16 +4,11 @@
##########################################################################
import os
-import multiprocessing
from repoze.bfg.router import make_app
import mail_util
from views import have_authentication
-POOL_SIZE = 3
-POOL = multiprocessing.Pool(processes=4)
-
-
def app(global_config, **kw):
""" This function returns a repoze.bfg.router.Router object. It
is usually called by the PasteDeploy framework during ``paster
@@ -25,6 +20,7 @@
from models import root
from logger import LOG
import zopyx.convert2
+ import pool
if 'mail_config' in global_config:
mail_config = os.path.abspath(global_config['mail_config'])
@@ -33,7 +29,7 @@
LOG.info('Using email configuration at %s' % mail_config)
LOG.info(config)
LOG.info('SmartPrintNG server started')
- LOG.info('Process pool size: %d' % POOL_SIZE)
+
LOG.info('Temp directory: %s' % root.temp_directory)
LOG.info('Spool directory: %s' % root.spool_directory)
LOG.info('Available converters: %s' % ', '.join(zopyx.convert2.registry.availableConverters()))
More information about the checkins
mailing list