Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Daemonized daemon runners through circus #1217

Merged
merged 24 commits into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
debd687
[wip] begin adding new daemon cmd
DropD Feb 26, 2018
1c179d6
prepare daemon click cmd group
DropD Feb 28, 2018
45b1354
verdi daemon start works (multiple profiles)
DropD Feb 28, 2018
4407abf
replace old daemon commands using circus.
DropD Mar 1, 2018
a410e72
add circus as a dependency
DropD Mar 2, 2018
69c4d2d
fix profile creation.
DropD Mar 2, 2018
eeac6b9
Fix the logging of the new circus daemon
sphuber Mar 2, 2018
f0ca6a9
Remove the concept of 'process' in profile configuration
sphuber Mar 2, 2018
e7a539c
Add the configuration migration for the PROFILE_UUID and CIRCUS_PORT …
sphuber Mar 2, 2018
d97263f
Add the config migration for the removal of profile 'process' concept
sphuber Mar 2, 2018
c507ec6
Remove vestigial parts of the old daemon
sphuber Mar 2, 2018
1e144da
Centralize the profile specific RabbitMQ and daemon settings
sphuber Mar 2, 2018
5990756
Update all migration testing reference and input files
sphuber Mar 2, 2018
ffb9fc9
Adapt the Travis tests to the new daemon
sphuber Mar 3, 2018
4114052
Separate a ProfileDaemonClient from the ProfileConfig construct
sphuber Mar 3, 2018
383c9ba
Remove the old daemon logic and configuration, including migrations
sphuber Mar 3, 2018
a07f202
Remove the remnants of the daemon user concept
sphuber Mar 3, 2018
6571ecb
Remove celery from requirements, its dependencies and all references
sphuber Mar 3, 2018
235b992
Move daemonize call after building the arbiter_config
sphuber Mar 6, 2018
2ad669d
Implement the '--reset' option for verdi daemon restart
sphuber Mar 6, 2018
e6f988a
Fix the messages for verdi daemon stop
sphuber Mar 6, 2018
4da6cf8
Factor out a private _start_circus entry point for verdi daemon
sphuber Mar 6, 2018
20583da
Make the default for 'stop' and 'restart' to wait
sphuber Mar 6, 2018
5927768
Temporarily restrict the version of tornado to 4.5.3
sphuber Mar 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove celery from requirements, its dependencies and all references
Celery is no longer necessary now that the daemon is daemonized
by the circus library
  • Loading branch information
sphuber committed Mar 6, 2018
commit 6571ecb224c78b457a1fa5c15fa77bfcaf2cdd5b
10 changes: 6 additions & 4 deletions .travis-data/test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import sys
import time
from aiida.common.exceptions import NotExistent
from aiida.daemon.client import ProfileDaemonClient
from aiida.orm import DataFactory
from aiida.orm.data.int import Int
from aiida.work.launch import run_get_node, submit
Expand All @@ -25,12 +26,13 @@
number_workchains = 8 # Number of workchains to submit

def print_daemon_log():
home = os.environ['HOME']
print "Output of 'cat {}/.aiida/daemon/log/celery.log':".format(home)
profile_daemon_client = ProfileDaemonClient()
daemon_log = profile_daemon_client.daemon_log_file

print "Output of 'cat {}':".format(daemon_log)
try:
print subprocess.check_output(
["cat", "{}/.aiida/daemon/log/celery.log".format(home)],
stderr=subprocess.STDOUT,
['cat', '{}'.format(daemon_log)], stderr=subprocess.STDOUT,
)
except subprocess.CalledProcessError as e:
print "Note: the command failed, message: {}".format(e.message)
Expand Down
3 changes: 1 addition & 2 deletions aiida/backends/djsite/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@

# Usual Django settings starts here.............

# Keep it to False! Otherwise every query is stored
# in memory and looks like a memory leak with celery
# Keep it to False! Otherwise every query is stored in memory
DEBUG = False
TEMPLATE_DEBUG = DEBUG

Expand Down
6 changes: 3 additions & 3 deletions aiida/common/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ def configure_logging(daemon=False, daemon_log_file=None):
"""
Setup the logging by retrieving the LOGGING dictionary from aiida and passing it to
the python module logging.config.dictConfig. If the logging needs to be setup for the
daemon running a task for one of the celery workers, set the argument 'daemon' to True
and specify the path to the log file. This will cause a 'daemon_handler' to be added
to all the configured loggers, that is a RotatingFileHandler that writes to the log file.
daemon, set the argument 'daemon' to True and specify the path to the log file. This
will cause a 'daemon_handler' to be added to all the configured loggers, that is a
RotatingFileHandler that writes to the log file.

:param daemon: configure the logging for a daemon task by adding a file handler instead
of the default 'console' StreamHandler
Expand Down
10 changes: 5 additions & 5 deletions aiida/common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,12 +852,12 @@ class _NoDefaultValue(object):
"Minimum level to log to the console",
"WARNING",
["CRITICAL", "ERROR", "WARNING", "REPORT", "INFO", "DEBUG"]),
"logging.celery_loglevel": (
"logging_celery_log_level",
"logging.circus_loglevel": (
"logging_circus_log_level",
"string",
"Minimum level to log to the file ~/.aiida/daemon/log/aiida_daemon.log "
"for the 'celery' logger",
"WARNING",
"Minimum level to log to the circus daemon log file"
"for the 'circus' logger",
"INFO",
["CRITICAL", "ERROR", "WARNING", "REPORT", "INFO", "DEBUG"]),
"logging.db_loglevel": (
"logging_db_log_level",
Expand Down
3 changes: 0 additions & 3 deletions docs/requirements_for_rtd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ SQLAlchemy==1.0.12
Sphinx==1.5.2
aldjemy==0.6.0
alembic==0.9.6
amqp==1.4.9
anyjson==0.3.3
billiard==3.3.0.23
celery==3.1.25
circus>=0.14.0
click-plugins
click-spinner
Expand Down
5 changes: 0 additions & 5 deletions docs/source/developer_guide/database_schema.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ highlighted with light green and the columns that participate to an index

We will now briefly describe some of the database tables.

.. note:: the ``kombu_queue`` and the ``kombu_message`` tables are generated by
the celery and not by the AiiDA. In AiiDA the celery is used by daemon to
handle the distributed task queue and real-time messaging. To know
more about celery please refer `celery documentation <http://docs.celeryproject.org/en/latest/>`_.

db_dbnode
---------
This table contains the information about all the Node instances stored in
Expand Down
2 changes: 0 additions & 2 deletions docs/source/install/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ For Mac OS X systems, the path to add is usually ``~/Library/Python/2.7/bin``::

export PATH=~/Library/Python/2.7/bin:${PATH}

To verify if this is the correct path to add, navigate to this location and you should find the executable ``supervisord``, or ``celeryd``, in the directory.

After updating your ``PATH`` you can check if it worked in the following way:

* type ``verdi`` on your terminal, and check if the program starts (it should
Expand Down
12 changes: 7 additions & 5 deletions docs/source/troubleshooting/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ Increasing the debug level
==========================

By default, the logging level of AiiDA is minimal to avoid filling logfiles.
Only warnings and errors are logged (to the
``~/.aiida/daemon/log/aiida_daemon.log`` file), while info and debug
Only warnings and errors are logged to the daemon log files, while info and debug
messages are discarded.

If you are experiencing a problem, you can change the default minimum logging
level of AiiDA messages (and celery messages -- celery is the library that we
level of AiiDA messages (and circus messages -- circus is the library that we
use to manage the daemon process) using, on the command line, the two
following commands::

verdi devel setproperty logging.celery_loglevel DEBUG
verdi devel setproperty logging.circus_loglevel DEBUG
verdi devel setproperty logging.aiida_loglevel DEBUG

For each profile that runs a daemon, there will be two unique logfiles, one for
AiiDA log messages and one from the circus daemonizer. These files can be found
in the ``.aiida`` log folder, which by default can be found at ``~/.aiida/daemon/log/aiida_daemon.log``.
After rebooting the daemon (``verdi daemon restart``), the number of messages
logged will increase significantly and may help in understanding
the source of the problem.
Expand All @@ -38,7 +40,7 @@ the source of the problem.
.. note:: When the problem is solved, we suggest to bring back the default
logging level, using the two commands::

verdi devel delproperty logging.celery_loglevel
verdi devel delproperty logging.circus_loglevel
verdi devel delproperty logging.aiida_loglevel

to avoid to fill the logfiles.
Expand Down
3 changes: 0 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
alabaster==0.7.10
aldjemy==0.6.0
alembic==0.9.6
amqp==1.4.9
aniso8601==2.0.0
anyjson==0.3.3
ase==3.12.0
Expand All @@ -12,9 +11,7 @@ Babel==2.5.3
backports.functools-lru-cache==1.4
backports.shutil-get-terminal-size==1.0.0
bcrypt==3.1.4
billiard==3.3.0.23
cached-property==1.3.1
celery==3.1.25
certifi==2018.1.18
cffi==1.11.4
chardet==3.0.4
Expand Down
14 changes: 0 additions & 14 deletions setup_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@
'six==1.11.0',
'future==0.16.0',
'pathlib2==2.3.0',
# We need for the time being to stay with an old version
# of celery, including the versions of the AMQP libraries below,
# because the support for a SQLA broker has been dropped in later
# versions... Actually, this might be source or problems with
# SQLA for us... probably switch to using rabbitmq?
# Note that however this requires a new server process.
# We also need to fix the celery version because support for Django 1.7
# was dropped from celery 3.2
'celery==3.1.25',
# The next two are internal dependencies of celery, but since
# in the past we had version mismatch problems, we freeze them
# as well
'billiard==3.3.0.23',
'amqp==1.4.9',
'anyjson==0.3.3',
'psutil==5.4.0',
'meld3==1.0.0',
Expand Down