Files
galaxy/scripts/celery_shell.py
T
mvdbeek 0091d37469 Add interactive shell for celery tasks
That's pretty useful for developing new tasks or just running one-off
tasks.
2021-11-29 10:34:01 +01:00

33 lines
774 B
Python

"""
Run this script from galaxy's root with
```
ipython -i scripts/celery_shell.py -- -c config/galaxy.yml
```
"""
import logging
import os
WARNING_MODULES = ['parso', 'asyncio', 'galaxy.datatypes']
for mod in WARNING_MODULES:
logger = logging.getLogger(mod)
logger.setLevel('WARNING')
from scripts.db_shell import config
os.environ['GALAXY_CONFIG_FILE'] = os.environ.get('GALAXY_CONFIG_FILE', config['config_file'])
from galaxy.celery import get_galaxy_app
from galaxy.celery import tasks # noqa: F401
HELP = """
============
Run celery tasks interactively.
tasks are collected in task module.
To run recalculate_user_disk_usage for user 1 in a celery worker
type
>>> tasks.recalculate_user_disk_usage.deley(user_id=1)
"""
app = get_galaxy_app()
print(HELP)