Page MenuHomePhabricator

webservice for tool.spiarticleanalyzer: 404 Error
Closed, ResolvedPublic

Description

https://tools.wmflabs.org/spiarticleanalyzer displays a 404 error. Tried the following (run from (virtualenv)tools.spiarticleanalyzer@tools-bastion-03:~/repo/SPIArticleAnalyzer$):

webservice --backend=gridengine uwsgi-python start (output: Starting webservice.)
webservice --backend=gridengine uwsgi-python stop (output: Your webservice is not running)
jsub webservice --backend=gridengine uwsgi-python start (output: Your job 994717 ("webservice") has been submitted)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
bd808 subscribed.

Do you have your code in ~/www/python/src? Have you checked for error logs?

Have you read https://wikitech.wikimedia.org/wiki/Help:Tool_Labs/Web#Python_2_.28uWSGI.29 ?

@bd808 ~/www/python/src currently symlinks to ~/repo/SPIArticleAnalyzer. I have checked uwsgi.log in ~. See below (from foot of uwsgi.log)

Traceback (most recent call last):
  File "app.py", line 21, in <module>
    import mwoauth
ImportError: No module named mwoauth
unable to load app 0 (mountpoint='') (callable not found or import error)
mounting /data/project/spiarticleanalyzer/www/python/src/app.py on /spiarticleanalyzer
Traceback (most recent call last):
  File "/data/project/spiarticleanalyzer/www/python/src/app.py", line 21, in <module>
    import mwoauth
ImportError: No module named mwoauth

Tried pip uninstall mwoauth.

Same traceback.

Tried pip install mwoauth.

Same traceback.

@bd808 Entire uwsgi.log file:

*** Starting uWSGI 1.9.17.1-debian (64bit) on [Fri Feb 10 04:28:46 2017] ***
compiled with version: 4.8.2 on 23 March 2014 17:15:32
os: Linux-3.13.0-100-generic #147-Ubuntu SMP Tue Oct 18 16:48:51 UTC 2016
nodename: tools-webgrid-generic-1402
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /mnt/nfs/labstore-secondary-tools-project/spiarticleanalyzer
detected binary path: /usr/bin/uwsgi-core
your processes number limit is 63705
your process address space limit is 4294967296 bytes (4096 MB)
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :56801 fd 3
Python version: 2.7.6 (default, Oct 26 2016, 20:33:43)  [GCC 4.8.4]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0xac2280
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 363960 bytes (355 KB) for 4 cores
*** Operational MODE: preforking ***
Traceback (most recent call last):
  File "app.py", line 21, in <module>
    import mwoauth
ImportError: No module named mwoauth
unable to load app 0 (mountpoint='') (callable not found or import error)
mounting /data/project/spiarticleanalyzer/www/python/src/app.py on /spiarticleanalyzer
Traceback (most recent call last):
  File "/data/project/spiarticleanalyzer/www/python/src/app.py", line 21, in <module>
Python version: 2.7.6 (default, Oct 26 2016, 20:33:43)  [GCC 4.8.4]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0xac2280
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 363960 bytes (355 KB) for 4 cores
*** Operational MODE: preforking ***
Traceback (most recent call last):
  File "app.py", line 21, in <module>
    import mwoauth
ImportError: No module named mwoauth
unable to load app 0 (mountpoint='') (callable not found or import error)
mounting /data/project/spiarticleanalyzer/www/python/src/app.py on /spiarticleanalyzer
Traceback (most recent call last):
  File "/data/project/spiarticleanalyzer/www/python/src/app.py", line 21, in <module>
    import mwoauth
ImportError: No module named mwoauth

Also, to note, I tried the following:

source $HOME/www/python/virtualenv/bin/activate (activating virtualenv)

pip install mwoauth
webservice --backend=gridengine uwsgi-python start

Traceback.

webservice --backend=gridengine uwsgi-python stop
pip uninstall mwoauth
webservice --backend=gridengine uwsgi-python start

Traceback.

webservice --backend=gridengine uwsgi-python stop

exit (to get out of virtualenv)
become spiarticleanalyzer (to get out of virtualenv)

pip install mwoauth
webservice --backend=gridengine uwsgi-python start

Traceback.

webservice --backend=gridengine uwsgi-python stop
pip uninstall mwoauth
webservice --backend=gridengine uwsgi-python start

Traceback.

webservice --backend=gridengine uwsgi-python stop

Traceback = the uwsgi.log posted above.

To note, error.log in ~ reads

[uWSGI] getting INI configuration from /data/project/spiarticleanalyzer/www/python/uwsgi.ini

Another fundamental issue here seems to be that webservice --backend=gridengine uwsgi-python stop yields Your webservice is not running (did leave a substantial amount of time between entering webservice --backend=gridengine uwsgi-python start and webservice --backend=gridengine uwsgi-python stop.

tools.spiarticleanalyzer@tools-bastion-03:~$ webservice --backend=gridengine uwsgi-python start
Starting webservice.
tools.spiarticleanalyzer@tools-bastion-03:~$ webservice --backend=gridengine uwsgi-python stop
Your webservice is not running

service.log in ~ reads

2017-02-10T04:53:32.970522 No running webservice job found, attempting to start it
2017-02-10T04:54:13.081591 No running webservice job found, attempting to start it

service.manifest in ~ reads

# This file is used by toollabs infrastructure.
# Please do not edit manually at this time.
backend: gridengine
version: 2
web: uwsgi-python

I was told that some of the libraries, such as basemap, might not work in gridengine. Might that be an issue perhaps?

Also, to note, I tried the following:

source $HOME/www/python/virtualenv/bin/activate (activating virtualenv)

Read https://wikitech.wikimedia.org/wiki/Help:Tool_Labs/Web#Python_2_.28uWSGI.29:

Create a virtualenv in $HOME/www/python/venv (virtualenv $HOME/www/python/venv). This should be created on a trusty bastion as the code will be run on a trusty instance.

Removed previous venv. Rebuilt venv per above. Installed pip install -r requirements.txt. requirements.txt in ~/repo/SPIArticleAnalyzer reads

flask
geoip2
pyyaml
mwoauth
wtforms
numpy
matplotlib
setuptools
requests
pyicu

Ran webservice --backend=gridengine uwsgi-python start. uwsgi.log reads

*** Starting uWSGI 1.9.17.1-debian (64bit) on [Fri Feb 10 05:28:40 2017] ***
compiled with version: 4.8.2 on 23 March 2014 17:15:32
os: Linux-3.13.0-100-generic #147-Ubuntu SMP Tue Oct 18 16:48:51 UTC 2016
nodename: tools-webgrid-generic-1402
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /mnt/nfs/labstore-secondary-tools-project/spiarticleanalyzer
detected binary path: /usr/bin/uwsgi-core
your processes number limit is 63705
your process address space limit is 4294967296 bytes (4096 MB)
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :53919 fd 3
Python version: 2.7.6 (default, Oct 26 2016, 20:33:43)  [GCC 4.8.4]
Set PythonHome to /data/project/spiarticleanalyzer/www/python/venv
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1d0d3a0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 363960 bytes (355 KB) for 4 cores
*** Operational MODE: preforking ***
Traceback (most recent call last):
  File "app.py", line 25, in <module>
    from getAllUsers import *
  File "./getAllUsers.py", line 20, in <module>
    from mpl_toolkits.basemap import Basemap
ImportError: No module named basemap
unable to load app 0 (mountpoint='') (callable not found or import error)
mounting /data/project/spiarticleanalyzer/www/python/src/app.py on /spiarticleanalyzer
Traceback (most recent call last):
  File "/data/project/spiarticleanalyzer/www/python/src/app.py", line 25, in <module>
    from getAllUsers import *
  File "./getAllUsers.py", line 20, in <module>
    from mpl_toolkits.basemap import Basemap
ImportError: No module named basemap

Seems related to T157744 at this point.

JustBerry changed the task status from Open to Stalled.Feb 10 2017, 1:36 PM

Pending update from T157744.

JustBerry claimed this task.