cvondrick / vatic

Efficiently Scaling Up Video Annotation with Crowdsourced Marketplaces. IJCV 2012
http://mit.edu/vondrick/vatic/
MIT License
607 stars 255 forks source link

MySQL Connection Breaks the System #93

Open ulfet opened 6 years ago

ulfet commented 6 years ago

Before this error, I was receiving error related to /var/www/.python-eggs. After fixing that, I receive the following error.

Steps: 1) Restarted the server 2) Checked the status of turkic by issuing command: "turkic status"

Configuration:
  Sandbox:     False
  Database:    mysql://root:PASSWORD@localhost/vatic
  Localhost:   http://localhost/

/usr/local/lib/python2.7/dist-packages/SQLAlchemy-1.2.0b3-py2.7-linux-x86_64.egg/sqlalchemy/dialects/mysql/base.py:1723: Warning: '@@tx_isolation' is deprecated and will be removed in a future release. Please use '@@transaction_isolation' instead
Status:
  Available:   4
  Published:   0
  Completed:   0
  Compensated: 0
  Remaining:   0

Server is offline.

2) connected to mysql server using the command with success, no problem: mysql -u root -p 3) Hit the address: "localhost" or "http://localhost/?id=5&hitId=offline"

This breaks everything in the system. After this,

4) Issuing "mysql -u root -p" leads to the following error message: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

5) Issuing "turkic status" leads to the following error:

Configuration:
  Sandbox:     False
  Database:    mysql://root:PASSWORDHERE@localhost/vatic
  Localhost:   http://localhost/

Traceback (most recent call last):
  File "/usr/local/bin/turkic", line 4, in <module>
    __import__('pkg_resources').run_script('turkic==0.2.5', 'turkic')
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1504, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/turkic-0.2.5-py2.7.egg/EGG-INFO/scripts/turkic", line 16, in <module>
    turkic.cli.main()
  File "/usr/local/lib/python2.7/dist-packages/turkic-0.2.5-py2.7.egg/turkic/cli.py", line 147, in main
    handler(args[1:])
  File "/usr/local/lib/python2.7/dist-packages/turkic-0.2.5-py2.7.egg/turkic/cli.py", line 47, in __init__
    self(parser.parse_args(args))
  File "/usr/local/lib/python2.7/dist-packages/turkic-0.2.5-py2.7.egg/turkic/cli.py", line 280, in __call__
    self.serverstatus(session)
  File "/usr/local/lib/python2.7/dist-packages/turkic-0.2.5-py2.7.egg/turkic/cli.py", line 207, in serverstatus
    available = session.query(HIT).filter(HIT.ready == True).count()
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/query.py", line 3110, in count
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/query.py", line 2864, in scalar
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/query.py", line 2835, in one
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/query.py", line 2805, in one_or_none
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/query.py", line 2876, in __iter__
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/query.py", line 2897, in _execute_and_instances
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/query.py", line 2906, in _get_bind_args
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/query.py", line 2888, in _connection_from_session
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py", line 1029, in connection
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py", line 1034, in _connection_for_bind
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py", line 403, in _connection_for_bind
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 2123, in contextual_connect
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 2162, in _wrap_pool_connect
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1476, in _handle_dbapi_exception_noconnection
  File "build/bdist.linux-x86_64/egg/sqlalchemy/util/compat.py", line 203, in raise_from_cause
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 2158, in _wrap_pool_connect
  File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 402, in connect
  File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 781, in _checkout
  File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 531, in checkout
  File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 1185, in _do_get
  File "build/bdist.linux-x86_64/egg/sqlalchemy/util/langhelpers.py", line 66, in __exit__
  File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 1182, in _do_get
  File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 349, in _create_connection
  File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 476, in __init__
  File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 666, in __connect
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/strategies.py", line 105, in connect
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/default.py", line 410, in connect
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 204, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")

Searched for some time about both of the error messages, but to no avail.

Any recommendations?

JulianoJuSilva commented 6 years ago

Dear ulfet, I had a lot of problem installing the Vatic, but after some trial and error I've accomplished successfully. Below is the step-by step, I hope that can help you.

My OS is Ubuntu 16.04 LTS server

MySQL - must set root password during instalation

sudo apt-get install mysql-server mysql-client
mysql -u root -p
create database vatic;
exit

Requirements

sudo apt-get install python2.7
sudo apt-get install python-pip
sudo apt-get install ffmpeg
sudo apt-get install -y git python-setuptools python-dev libavcodec-dev libavformat-dev libswscale-dev libjpeg62 libjpeg62-dev libfreetype6 libfreetype6-dev apache2 libapache2-mod-wsgi libmysqlclient-dev gfortran
sudo easy_install -U cython==0.20
sudo easy_install -U SQLAlchemy wsgilog Pillow mysql-python munkres parsedatetime argparse
sudo easy_install -U numpy

Install Vatic dependencies (turkic, pyvision and vatic)

mkdir ~/workspace/vatic_base && cd ~/workspace/vatic_base
git clone https://github.com/cvondrick/turkic.git
git clone https://github.com/cvondrick/pyvision.git
git clone https://github.com/cvondrick/vatic.git

cd turkic
sudo python setup.py install
cd ..

cd pyvision
sudo python setup.py install
cd ..

Apache

sudo cp /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/000-default.conf.backup
sudo cp /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled
sudo vi /etc/apache2/sites-enabled/000-default.conf
    WSGIDaemonProcess www-data
    WSGIProcessGroup www-data

    <VirtualHost *:80>
        ServerName localhost
        DocumentRoot /home/user/workspace/vatic_base/vatic/public

        <Location />
            Require all granted
        </Location>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        WSGIScriptAlias /server /home/user/workspace/vatic_base/vatic/server.py
    </VirtualHost>

sudo vi /etc/apache2/apache2.conf
    #Added "ServerName localhost" to the first line

sudo mkdir /var/www/.python-eggs/
sudo chown www-data:www-data /var/www/.python-eggs/
sudo apache2ctl graceful

Setting up Vatic

cd vatic_base/vatic
cp config.py-example config.py
# Change DB password in config.py
    database = "mysql://root:PASSwoRD@localhost/vatic" 
turkic setup --database
turkic setup --public-symlink
turkic status --verify
    #Testing access to database server... OK
    #Testing access to web server... OK

Using Vatic

Extract video's frames

turkic extract ~/workspace/vatic/videos/VIDEO.avi ~/workspace/vatic/videos/out/ --no-resize

Import video in order to perform annotation

turkic load VIDEO_LABEL ../videos/out/ Person ~Walking ~Running --offline

Check the status of the video annotation

turkic status

Publish video to the web server

turkic publish --offline

Open the URLs returned and annotate the events on browser

http://localhost/?id=1&hitId=offline
http://localhost/?id=2&hitId=offline
http://localhost/?id=3&hitId=offline


Export the annotations

turkic dump VIDEO_LABEL -o output.txt

Visualise tracks

turkic visualize identifier /tmp --merge

Delete a video

turkic delete identifier --force

References

https://github.com/cvondrick/vatic https://gitlab.com/EAVISE/publicwiki/wikis/install-vatic

Meowu commented 6 years ago

fuck, that cover my system config after your instructions.

ulfet commented 6 years ago

You may want to look at BeaverDam. That is what I did. https://github.com/antingshen/BeaverDam