Skip to content

Commit

Permalink
Use our util functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kami committed Apr 20, 2016
1 parent dcc831a commit fa3feaf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
10 changes: 2 additions & 8 deletions st2api/st2api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
# limitations under the License.

import os
import sys

import eventlet
import pecan
from oslo_config import cfg
from pecan.middleware.static import StaticFileMiddleware

from st2api import config as st2api_config
from st2common import hooks
from st2common import log as logging
from st2common.util.monkey_patch import monkey_patch
from st2common.constants.system import VERSION_STRING
from st2common.service_setup import setup as common_setup

Expand Down Expand Up @@ -57,12 +56,7 @@ def setup_app(config=None):
# Note: We need to perform monkey patching in the worker. If we do it in
# the master process (gunicorn_config.py), it breaks tons of things
# including shutdown
eventlet.monkey_patch(
os=True,
select=True,
socket=True,
thread=False if '--use-debugger' in sys.argv else True,
time=True)
monkey_patch()

st2api_config.register_opts()
# This should be called in gunicorn case because we only want
Expand Down
11 changes: 2 additions & 9 deletions st2auth/st2auth/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import eventlet
import pecan
from oslo_config import cfg

from st2auth import config as st2auth_config
from st2common import hooks
from st2common import log as logging
from st2common.util.monkey_patch import monkey_patch
from st2common.constants.system import VERSION_STRING
from st2common.service_setup import setup as common_setup

Expand Down Expand Up @@ -50,12 +48,7 @@ def setup_app(config=None):
# Note: We need to perform monkey patching in the worker. If we do it in
# the master process (gunicorn_config.py), it breaks tons of things
# including shutdown
eventlet.monkey_patch(
os=True,
select=True,
socket=True,
thread=False if '--use-debugger' in sys.argv else True,
time=True)
monkey_patch()

# This should be called in gunicorn case because we only want
# workers to connect to db, rabbbitmq etc. In standalone HTTP
Expand Down
13 changes: 5 additions & 8 deletions st2stream/st2stream/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@
"""

import os
import sys

import eventlet
import pecan
from oslo_config import cfg

from st2stream import config as st2stream_config
from st2common import hooks
from st2common import log as logging
from st2common.util.monkey_patch import monkey_patch
from st2common.constants.system import VERSION_STRING
from st2common.service_setup import setup as common_setup

Expand All @@ -58,12 +57,10 @@ def setup_app(config=None):

is_gunicorn = getattr(config, 'is_gunicorn', False)
if is_gunicorn:
eventlet.monkey_patch(
os=True,
select=True,
socket=True,
thread=False if '--use-debugger' in sys.argv else True,
time=True)
# Note: We need to perform monkey patching in the worker. If we do it in
# the master process (gunicorn_config.py), it breaks tons of things
# including shutdown
monkey_patch()

st2stream_config.register_opts()
# This should be called in gunicorn case because we only want
Expand Down

0 comments on commit fa3feaf

Please sign in to comment.