source: out/production/media_conv/media_conv/__init__.py @ 4698

Last change on this file since 4698 was 4698, checked in by Sander.Maijers@mpi.nl, 10 years ago

Horizontal showcase WebMAUS:
media_conv component

Documentation: https://trac.clarin.eu/media_conv

As deployed on: http://infra.clarin.eu/app/media_conv

File size: 1.1 KB
Line 
1# -*- coding: utf-8 -*-
2
3__all__ = ["cache", "connectivity", "conversion", "tests", "views"]
4
5import logging
6
7logger = logging.getLogger('waitress')
8
9from resource import setrlimit, RLIMIT_NPROC
10
11from getpass import getuser
12
13unix_username = getuser()
14
15import pprint
16
17
18
19try:
20    from pyramid.config import Configurator
21    from pyramid.settings import asbool
22
23    #for handler in logger.handlers:
24    #    handler.setLevel(logging.INFO)
25    #logger.setLevel(logging.INFO)
26
27    def main(global_config,
28             **settings):
29
30        settings.get('max_n_threads')
31        setrlimit(RLIMIT_NPROC, (MAX_N_THREADS, MAX_N_THREADS))
32
33
34        settings['caching'] = asbool(settings.get('caching'))
35
36        config = Configurator(settings=settings)
37
38        config.add_route("media_conv",
39                         "/media_conv")
40
41        config.scan()
42
43        return config.make_wsgi_app()
44except BlockingIOError as e:
45    logger.critical("System resource limit for RLIMIT_NPROC (set to)  is being exceeded for current user '{1}'! {2}"
46        .format(resource., unix_username, pprint.pformat(e)))
47    raise
Note: See TracBrowser for help on using the repository browser.