示例#1
0
 def set_periodically():
     print("定时")
     uwsgi.register_signal(SIG_REBUILD_INDEX, 'workers',
                           rebuild_periodically)
     # uwsgi.add_timer(SIG_REBUILD_INDEX, 5)
     #每周周一晚上一点重建索引
     uwsgi.add_cron(SIG_REBUILD_INDEX, 0, 1, -1, -1, 1)
示例#2
0
    def execute_async(self):
        if not uwsgi:
            return

        self.register_signal(self.signal_handler)

        minute = self.setup.get('minute')
        hour = self.setup.get('hour')
        day = self.setup.get('day')
        month = self.setup.get('month')
        dayweek = self.setup.get('dayweek')

        uwsgi.add_cron(self.signal_id, minute, hour, day, month, dayweek)
示例#3
0
    def execute_async(self):
        if not uwsgi:
            return

        self.register_signal(self.signal_handler)

        minute = self.setup.get('minute')
        hour = self.setup.get('hour')
        day = self.setup.get('day')
        month = self.setup.get('month')
        dayweek = self.setup.get('dayweek')

        uwsgi.add_cron(
            self.signal_id,
            minute,
            hour,
            day,
            month,
            dayweek
        )
示例#4
0
   os.path.abspath(os.path.join(os.path.dirname(__file__), '../../application/website')),
   os.path.abspath(os.path.join(os.path.dirname(__file__), '../../application')),
   os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')),
   )

for path in paths:
   sys.path.insert(0,path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'application.settings.xsf_stage2'

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()


#################### Test uWSGI Cron begin ############################
## uwsgi.add_cron(signal, minute, hour, day, month, weekday)
## uwsgi.add_timer(signal, sec)

import uwsgi

from scripts.cron_job import *

for job_id, job in enumerate(jobs):
    uwsgi.register_signal(job_id, "", job['name'])
    if len(job['time']) == 1:
        uwsgi.add_timer(job_id, job['time'][0])
    else:
        uwsgi.add_cron(job_id, job['time'][0], job['time'][1], job['time'][2], job['time'][3], job['time'][4])

#################### Test uWSGI Cron end ############################
示例#5
0
 def __call__(self, f):
     uwsgi.register_signal(self.num, self.target, f)
     uwsgi.add_cron(self.num, self.minute, self.hour,
         self.day, self.month, self.dayweek)
     return f
示例#6
0
 def add_cron(self):
     for args in self.get_matrix():
         logger.debug(f'{self.caller} add cron : {args} '
                      f'signal {self.caller.signal_number}')
         uwsgi.add_cron(self.caller.signal_number, *args)
"""
WSGI config for NewRaPo project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""

import os

import uwsgi
from app.blog_lab.proxy.method import get_proxy, check_proxy
from app.blog_lab.proxy.huiyuan import play

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "NewRaPo.settings.produce")

from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()

uwsgi.register_signal(82, "", get_proxy)
uwsgi.add_cron(82, 0, -1, -1, -1, -1)
uwsgi.register_signal(84, "", check_proxy)
uwsgi.add_cron(84, 30, -1, -1, -1, -1)
uwsgi.register_signal(86, "", play)
uwsgi.add_cron(86, 0, 8, -1, -1, -1)
"""
WSGI config for NewRaPo project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""

import os

import uwsgi
from app.blog_lab.proxy.method import get_proxy, check_proxy
from app.blog_lab.proxy.huiyuan import play

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "NewRaPo.settings.produce")

from django.core.wsgi import get_wsgi_applicationß

application = get_wsgi_application()

uwsgi.register_signal(82, "", get_proxy)
uwsgi.add_cron(82, 0, -1, -1, -1, -1)
uwsgi.register_signal(84, "", check_proxy)
uwsgi.add_cron(84, 30, -1, -1, -1, -1)
uwsgi.register_signal(86, "", play)
uwsgi.add_cron(86, 0, 8, -1, -1, -1)
示例#9
0
文件: suwsgi.py 项目: sbyinin/Alinone
import os
import uwsgi
from CronOrder.ele import *
from CronOrder.ordermig import *
from CronOrder.method import *
from ProxyWork.method import *
import sys
reload(sys)
sys.setdefaultencoding('utf8')

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SeaSite.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

uwsgi.register_signal(80, "", resetToken)
uwsgi.add_timer(80, 1800)
uwsgi.register_signal(82, "", getproxy)
uwsgi.add_cron(82, 0, 10, -1, -1, -1)
uwsgi.register_signal(84, "", getproxy)
uwsgi.add_cron(84, 0, 15, -1, -1, -1)
uwsgi.register_signal(86, "", checkproxy)
uwsgi.add_cron(86, 0, 9, -1, -1, -1)
uwsgi.register_signal(88, "", checkproxy)
uwsgi.add_cron(88, 0, 16, -1, -1, -1)
uwsgi.register_signal(90, "", migrateorder)
uwsgi.add_cron(90, 0, 0, -1, -1, -1)
示例#10
0
# coding: utf-8
from __future__ import unicode_literals

import uwsgi
from django.core.management import call_command


def every_day_tasks(num):
    try:
        call_command('clearsessions')
    except RuntimeError:
        pass


uwsgi.register_signal(90, '', every_day_tasks)
uwsgi.add_cron(90, 0, 0, -1, -1, -1)


def execute_every_day_at_9am(num):
    try:
        call_command('sendmailtosubscribers')
    except RuntimeError:
        pass


uwsgi.register_signal(91, '', execute_every_day_at_9am)
uwsgi.add_cron(91, 0, 9, -1, -1, -1)


def execute_every_5_minutes(num):
    try: