You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/12/17 23:52:51 UTC

[GitHub] stale[bot] closed pull request #2794: [AIRFLOW-1822] Add gaiohttp and gthread gunicorn worker class to webserver cli

stale[bot] closed pull request #2794: [AIRFLOW-1822] Add gaiohttp and gthread gunicorn worker class to webserver cli
URL: https://github.com/apache/incubator-airflow/pull/2794
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/bin/cli.py b/airflow/bin/cli.py
index 6d012935a4..1002c69db5 100755
--- a/airflow/bin/cli.py
+++ b/airflow/bin/cli.py
@@ -728,7 +728,10 @@ def webserver(args):
             '-p', str(pid),
             '-c', 'python:airflow.www.gunicorn_config'
         ]
-
+        
+        if args.workerclass == 'gthread':
+            run_args += ['--threads', str(args.threads)]
+            
         if args.access_logfile:
             run_args += ['--access-logfile', str(args.access_logfile)]
 
@@ -1342,10 +1345,15 @@ class CLIFactory(object):
             default=conf.get('webserver', 'WORKERS'),
             type=int,
             help="Number of workers to run the webserver on"),
+        'threads': Arg(
+            ("--threads",),
+            default=conf.get('webserver', 'THREADS'),
+            type=int,
+            help="Number of workers threads for handling webserver requests"),
         'workerclass': Arg(
             ("-k", "--workerclass"),
             default=conf.get('webserver', 'WORKER_CLASS'),
-            choices=['sync', 'eventlet', 'gevent', 'tornado'],
+            choices=['sync', 'eventlet', 'gevent', 'tornado', 'gaiohttp', 'gthread'],
             help="The worker class to use for Gunicorn"),
         'worker_timeout': Arg(
             ("-t", "--worker_timeout"),
@@ -1571,7 +1579,7 @@ class CLIFactory(object):
         }, {
             'func': webserver,
             'help': "Start a Airflow webserver instance",
-            'args': ('port', 'workers', 'workerclass', 'worker_timeout', 'hostname',
+            'args': ('port', 'workers', 'workerclass', 'worker_timeout', 'threads','hostname',
                      'pid', 'daemon', 'stdout', 'stderr', 'access_logfile',
                      'error_logfile', 'log_file', 'ssl_cert', 'ssl_key', 'debug'),
         }, {
diff --git a/airflow/config_templates/default_airflow.cfg b/airflow/config_templates/default_airflow.cfg
index fd78253f18..ea79af0257 100644
--- a/airflow/config_templates/default_airflow.cfg
+++ b/airflow/config_templates/default_airflow.cfg
@@ -192,6 +192,10 @@ secret_key = temporary_key
 # Number of workers to run the Gunicorn web server
 workers = 4
 
+# Number of worker threads for handling requests
+# This setting only affects the Gthread worker type
+threads = 1
+
 # The worker class gunicorn should use. Choices include
 # sync (default), eventlet, gevent
 worker_class = sync
diff --git a/docs/installation.rst b/docs/installation.rst
index b4fb126aab..8d35056a04 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -83,6 +83,8 @@ Here's the list of the subpackages and what they enable:
 +---------------+----------------------------------------------+-------------------------------------------------+
 |  slack        | ``pip install apache-airflow[slack]``        | ``SlackAPIPostOperator``                        |
 +---------------+----------------------------------------------+-------------------------------------------------+
+|  aiohttp      | ``pip install apache-airflow[aiohttp]``      | Gaiohttp worker class for gunicorn              |
++---------------+----------------------------------------------+-------------------------------------------------+
 |  vertica      | ``pip install apache-airflow[vertica]``      | Vertica hook                                    |
 |               |                                              | support as an Airflow backend                   |
 +---------------+----------------------------------------------+-------------------------------------------------+
diff --git a/setup.py b/setup.py
index e9d68b3bae..aa3b6b7a19 100644
--- a/setup.py
+++ b/setup.py
@@ -99,6 +99,9 @@ def write_version(filename=os.path.join(*['airflow',
     with open(filename, 'w') as a:
         a.write(text)
 
+aiohttp = [
+    'aiohttp>=0.21.5'
+]
 async = [
     'greenlet>=0.4.9',
     'eventlet>= 0.9.7',
@@ -244,6 +247,7 @@ def do_setup():
         extras_require={
             'all': devel_all,
             'all_dbs': all_dbs,
+            'aiohttp': aiohttp,
             'async': async,
             'azure': azure,
             'celery': celery,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services