restructured code

This commit is contained in:
Marvin Zhang
2019-03-06 10:11:07 +08:00
parent 6b9c0581c2
commit a473aef621
45 changed files with 153 additions and 7 deletions

View File

@@ -1,16 +0,0 @@
import os
import sys
import subprocess
# make sure the working directory is in system path
file_dir = os.path.dirname(os.path.realpath(__file__))
root_path = os.path.abspath(os.path.join(file_dir, '..'))
sys.path.append(root_path)
from config import BROKER_URL
if __name__ == '__main__':
p = subprocess.Popen(['celery', 'flower', '-b', BROKER_URL], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in iter(p.stdout.readline, 'b'):
if line.decode('utf-8') != '':
print(line.decode('utf-8'))

View File

@@ -1,20 +0,0 @@
import sys
import os
from celery import Celery
# make sure the working directory is in system path
file_dir = os.path.dirname(os.path.realpath(__file__))
root_path = os.path.abspath(os.path.join(file_dir, '..'))
sys.path.append(root_path)
from tasks.celery import celery_app
# import necessary tasks
import tasks.spider
import tasks.deploy
if __name__ == '__main__':
if sys.platform == 'windows':
celery_app.start(argv=['tasks', 'worker', '-P', 'eventlet', '-E', '-l', 'INFO'])
else:
celery_app.start(argv=['tasks', 'worker', '-E', '-l', 'INFO'])

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env bash
celery flower --broker=mongodb://localhost:27017