Browse Source

Added a "uwsgi-workers" argument for the instances deployment

Roland Haroutiounian 7 years ago
parent
commit
d0f0c6c945
4 changed files with 11 additions and 5 deletions
  1. 1
    0
      plugins/webui/confspec.py
  2. 5
    4
      plugins/webui/main.py
  3. 1
    1
      progs/mass_deploy.sh
  4. 4
    0
      progs/slim/slim.py

+ 1
- 0
plugins/webui/confspec.py View File

@@ -15,6 +15,7 @@ CONFSPEC = {
15 15
         'uwsgicmd': ('/usr/bin/uwsgi', SettingValidator('dummy')),
16 16
         'cookie_secret_key': ('ConfigureYourOwnCookieSecretKey', SettingValidator('dummy')),
17 17
         'cookie_session_id': ('lodel', SettingValidator('dummy')),
18
+        'uwsgi_workers': (2, SettingValidator('int'))
18 19
     },
19 20
     'lodel2.webui.sessions': {
20 21
         'directory': (  '/tmp',

+ 5
- 4
plugins/webui/main.py View File

@@ -36,21 +36,22 @@ def uwsgi_fork(hook_name, caller, payload):
36 36
             
37 37
         if standalone.lower() == 'true':
38 38
             cmd='{uwsgi} --plugin python3 --http-socket {addr}:{port} --module \
39
-plugins.webui.run --socket {sockfile} --logto {logfile}'
39
+plugins.webui.run --socket {sockfile} --logto {logfile} -p {uwsgiworkers}'
40 40
             cmd = cmd.format(
41 41
                         addr = Settings.webui.listen_address,
42 42
                         port = Settings.webui.listen_port,
43 43
                         uwsgi= Settings.webui.uwsgicmd,
44 44
                         sockfile=sockfile,
45
-                        logfile = logfile)
45
+                        logfile = logfile,
46
+                        uwsgiworkers = Settings.webui.uwsgi_workers)
46 47
             if Settings.webui.virtualenv is not None:
47 48
                 cmd += " --virtualenv %s" % Settings.webui.virtualenv
48 49
 
49 50
         elif Settings.webui.standalone == 'uwsgi':
50 51
             cmd = '{uwsgi} --plugin python3 --ini ./plugins/webui/uwsgi/uwsgi.ini \
51
---socket {sockfile} --logto {logfile}'
52
+--socket {sockfile} --logto {logfile} -p {uwsgiworkers}'
52 53
             cmd = cmd.format(uwsgi = Settings.webui.uwsgicmd, 
53
-                sockfile = sockfile, logfile = logfile)
54
+                sockfile = sockfile, logfile = logfile, uwsgiworkers=Settings.webui.uwsgi_workers)
54 55
         
55 56
         try:
56 57
             args = shlex.split(cmd)

+ 1
- 1
progs/mass_deploy.sh View File

@@ -112,7 +112,7 @@ for i in $(seq $ninstance)
112 112
 do
113 113
 	iname="${random_name}_$(printf "%05d" $i)"
114 114
 	slim -n $iname -c
115
-	slim -n $iname -s --interface web --static-url 'http://127.0.0.1/static'
115
+	slim -n $iname -s --interface web --static-url 'http://127.0.0.1/static' --uwsgi-workers 2
116 116
 	slim -n $iname -m
117 117
 
118 118
 	#Mongo db database creation

+ 4
- 0
progs/slim/slim.py View File

@@ -100,6 +100,8 @@ def set_conf(name, args):
100 100
 Selected interface is not the web iterface")
101 101
         if 'lodel.webui' in config:
102 102
             del(config['lodel2.webui'])
103
+        if args.uwsgi_workers is not None:
104
+            config['lodel2.webui']['uwsgi_workers'] = int(args.uwsgi_workers)
103 105
 
104 106
     if args.datasource_connectors is not None:
105 107
         darg = args.datasource_connectors
@@ -489,6 +491,8 @@ to 1 instance")
489 491
         help="Select the password name to connect the datasource")
490 492
     confs.add_argument('--db_name', type=str,
491 493
         help="Select the database name on which datasource will be connect")
494
+    confs.add_argument('-p', '--uwsgi-workers', type=str, default='2',
495
+                       help="Number of workers to spawn at the start of uwsgi")
492 496
     return parser
493 497
 
494 498
 if __name__ == '__main__':

Loading…
Cancel
Save