コード例 #1
0
ファイル: test_mysql.py プロジェクト: HLD666/Seashell
    def setUp(self) -> None:
        self.app = create_app('testing')
        self.app_context = self.app.app_context()
        self.app_context.push()
        db.create_all()

        self.insert_test_task_in_spider_task_table()
コード例 #2
0
 def setUp(self) -> None:
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     # db.create_all()
     self.client = self.app.test_client()
     g.cur_ps = {}
     g.cur_ps.update({1: {"handle": "nothing"}})
コード例 #3
0
ファイル: test_ celery_task.py プロジェクト: HLD666/Seashell
    def setUp(self) -> None:
        self.app = create_app('testing')
        self.app_context = self.app.app_context()
        self.app_context.push()

        self.celery_app = make_celery(self.app)
        self.celery_app.conf.update(CELERY_ALWAYS_EAGER=True)

        celery_start_argv = [
            'worker', '-B', '-s', 'celery_schedule_bak/celery_schedule'
        ]
        self.celery_process = Process(target=self.celery_app.worker_main,
                                      args=(celery_start_argv, ))
        self.celery_process.start()
        self.create_the_result_table()
コード例 #4
0
import sys
sys.path.append("..")

from common.log import log
from node.app import create_app
from node.core.kill_task import kill_task_with_task_id
from node.core.global_parameter import current_task_list

from node.config import db_config
from dotenv import load_dotenv

dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
    load_dotenv(dotenv_path)

flask_app = create_app(os.getenv('FLASK_CONFIG') or 'default')
# celery_app = make_celery(flask_app)


@atexit.register
def perform_the_exit_func():
    # update all the task status
    task_list = copy.copy(current_task_list)
    for task_id in task_list.keys():
        kill_task_with_task_id(task_id)

    print(f"Process normally exit. pid[{os.getpid()}]")
    log.info(f"Process normally exit. pid[{os.getpid()}]")


@flask_app.cli.command()
コード例 #5
0
 def setUp(self) -> None:
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
コード例 #6
0
    def setUp(self) -> None:
        self.app = create_app('testing')
        self.app_context = self.app.app_context()
        self.app_context.push()

        self.create_the_result_table()