Skip to content

Commit

Permalink
Remove celery
Browse files Browse the repository at this point in the history
  • Loading branch information
d-mo committed Jul 2, 2021
1 parent 2cd408c commit 4b6b795
Show file tree
Hide file tree
Showing 61 changed files with 828 additions and 1,298 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
**/.gitignore
**/.dockerignore
**/.gitlab-ci.yml
celerybeat-schedule.dir
celerybeat-schedule.pag
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ exclude =
./libcloud/,
./paramiko/,
./run_script/,
./celerybeat-mongo/,
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ target/
# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule
celerybeat-schedule-py3.db

# SageMath parsed files
*.sage.py

Expand Down Expand Up @@ -108,9 +104,5 @@ ENV/
/src/mist/api/templates/landing.pt
/src/mist/api/templates/manage.pt

# Celerybeat files
/celerybeat-schedule.dir
/celerybeat-schedule.pag

# openapi spec
/openapi/spec.yml
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ flake8:
before_script:
- cd /mist.api
script:
- flake8 --ignore=E402,E722,F632,F841,W504,W605 --exclude=v2,paramiko,celerybeat-mongo,libcloud,run_script
- flake8 --ignore=E402,E722,F632,F841,W504,W605 --exclude=v2,paramiko,libcloud,run_script

uniq:
stage: test
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[submodule "paramiko"]
path = paramiko
url = ../../mistio/paramiko.git
[submodule "celerybeat-mongo"]
path = celerybeat-mongo
url = ../../mistio/celerybeat-mongo.git
[submodule "v2"]
path = v2
url = ../mist-api-v2.git
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM mist/python3:latest

# Install libvirt which requires system dependencies.
RUN apk add --update --no-cache g++ gcc libvirt libvirt-dev libxml2-dev libxslt-dev gnupg ca-certificates wget mongodb-tools
RUN apk add --update --no-cache g++ gcc libvirt libvirt-dev libxml2-dev libxslt-dev gnupg ca-certificates wget mongodb-tools libmemcached-dev

RUN wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.4-static_linux_amd64.tar.gz && \
tar xvfz influxdb-1.8.4-static_linux_amd64.tar.gz && rm influxdb-1.8.4-static_linux_amd64.tar.gz
Expand All @@ -21,13 +21,11 @@ COPY requirements.txt /requirements-mist.api.txt
WORKDIR /mist.api/

COPY paramiko /mist.api/paramiko
COPY celerybeat-mongo /mist.api/celerybeat-mongo
COPY libcloud /mist.api/libcloud
COPY v2 /mist.api/v2

RUN pip install --no-cache-dir -r /mist.api/requirements.txt && \
pip install -e paramiko/ && \
pip install -e celerybeat-mongo/ && \
pip install -e libcloud/ && \
pip install -e v2/ && \
pip install --no-cache-dir -r v2/requirements.txt
Expand Down
7 changes: 0 additions & 7 deletions bin/apscheduler

This file was deleted.

44 changes: 0 additions & 44 deletions bin/beat

This file was deleted.

64 changes: 0 additions & 64 deletions bin/celery

This file was deleted.

9 changes: 0 additions & 9 deletions bin/celery-deployments

This file was deleted.

9 changes: 0 additions & 9 deletions bin/celery-gevent

This file was deleted.

7 changes: 0 additions & 7 deletions bin/celery-prefork

This file was deleted.

43 changes: 0 additions & 43 deletions bin/cilia

This file was deleted.

1 change: 0 additions & 1 deletion bin/docker-init
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ if [ ! -e clean ]; then
echo "{\"sha\":\"$VERSION_SHA\",\"name\":\"$VERSION_NAME\",\"repo\":\"$VERSION_REPO\",\"modified\":true}" > /mist-version.json
pip install -e $DIR/../paramiko/
pip install -e $DIR/../libcloud/
pip install -e $DIR/../celerybeat-mongo/
pip install -e $DIR/../src/
set +e
diff /requirements-mist.api.txt $DIR/../requirements.txt
Expand Down
44 changes: 36 additions & 8 deletions bin/dramatiq
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,36 @@
import os
import importlib


os.system("pip install -U 'dramatiq[rabbitmq]'")
from mist.api import config

BROKER = 'mist.api.dramatiq_app'
QUEUES = ['dramatiq_create_machine',
'dramatiq_post_deploy_steps',
'dramatiq_ssh_tasks',
'dramatiq_mappings',
'dramatiq_schedules']
QUEUES = os.getenv('QUEUES', '').split(',') or [
'default',
'provisioning',
'scripts',
'schedules',
'rules',
'polling',
'mappings',
'ping_probe',
'ssh_probe']

POSSIBLE_MODULES = [] # 'mist.api.dramatiq_tasks', 'mist.rbac.dramatiq_tasks']

for root, dirs, files in os.walk("src"):
for file in files:
if file.endswith('tasks.py'):
module = os.path.join(
root, file[:-3]).split('src/')[1].replace('/', '.')
POSSIBLE_MODULES.append(module)
print(module)

for root, dirs, files in os.walk("/opt"):
for file in files:
if file.endswith('tasks.py'):
print('.'.join(os.path.join(root, file[:-3]).split('/')[3:]))


POSSIBLE_MODULES = ['mist.api.dramatiq_tasks', 'mist.rbac.dramatiq_tasks']
modules = []

for module in POSSIBLE_MODULES:
Expand All @@ -23,6 +42,15 @@ for module in POSSIBLE_MODULES:
modules.append(module)
print(f" * {module}")

for plugin in config.PLUGINS:
module = 'mist.' + plugin + '.tasks'
try:
importlib.import_module(module)
except ModuleNotFoundError:
continue
modules.append(module)
print(f" * {module}")

print(f"Will execute command: dramatiq {BROKER} {' '.join(modules)} -Q {' '.join(QUEUES)}")

os.system(f"dramatiq {BROKER} {' '.join(modules)} -Q {' '.join(QUEUES)}")
48 changes: 0 additions & 48 deletions bin/poller

This file was deleted.

Loading

0 comments on commit 4b6b795

Please sign in to comment.