示例#1
0
def initjob():

    Id1 = Id + "-1"
    tname1 = "jobs/GreenCaseJob/绿网入库配置文件.xlsx"  # 模版文件
    trigger1, kwargs1, _ = getConfig(tname1)  # @UnusedVariable

    @AutoReportGlobals.Scheduler.scheduled_job(trigger1,
                                               id=Id1,
                                               name="绿网案例入库",
                                               **kwargs1)
    def job_green_case_in():
        try:
            process = Process(target=globals()["green_case_in"], args=(Id1, ))
            process.start()
            process.join()
        except SystemExit:
            pass
        except Exception as e:
            traceback.print_exc()
            logger = initLogger("datas/logs/" + Id1, Id1)
            logger.error("任务执行失败: " + str(e))

    Id2 = Id + "-2"
    tname2 = "jobs/GreenCaseJob/绿网监控配置文件.xlsx"  # 模版文件
    trigger2, kwargs2, _ = getConfig(tname2)

    @AutoReportGlobals.Scheduler.scheduled_job(trigger2,
                                               id=Id2,
                                               name="绿网案例监控",
                                               **kwargs2)
    def job_green_case_mi():
        try:
            process = Process(target=globals()["green_case_mi"], args=(Id2, ))
            process.start()
            process.join()
        except SystemExit:
            pass
        except Exception as e:
            traceback.print_exc()
            logger = initLogger("datas/logs/" + Id2, Id2)
            logger.error("任务执行失败: " + str(e))
示例#2
0
def initjob():
    Id0 = Id + "-0"
    tname0 = "jobs/Reports/FourthJob/岁末营销日报.xlsx"
    trigger0, kwargs0, config0 = getConfig(tname0)  # @UnusedVariable

    @AutoReportGlobals.Scheduler.scheduled_job(trigger0, id=Id0, name=Subject + Id0, **kwargs0)
    def job_broad_band():
        try:
            process = Process(
                target=globals()["broad_band"], args=(Id0, tname0))
            process.start()
            process.join()
        except Exception as e:
            traceback.print_exc()
            logger = initLogger("datas/logs/" + Id0, Id0)
            logger.error("任务执行失败: " + str(e))
示例#3
0
def initjob():
    tname = "jobs/WBotMonitorJob/微信机器人配置文件.xlsx"  # 模版文件
    trigger, kwargs, config = getConfig(tname)  # @UnusedVariable

    # 初始日志文件
    logger = initLogger("datas/logs/" + Id, Id)
    wbmjob = WBotMonitor(logger, config, Id)  # 涉及到类全局变量,需要放在外面初始化

    @AutoReportGlobals.Scheduler.scheduled_job(trigger,
                                               id=Id,
                                               name=Subject,
                                               misfire_grace_time=86400,
                                               **kwargs)
    def job():
        try:
            wbmjob.start()
        except Exception as e:
            traceback.print_exc()
            logger.error("任务执行失败: " + str(e))
示例#4
0
def initjob():
    tname = "jobs/EmailMonitorJob/邮件监控配置文件.xlsx"  # 模版文件
    trigger, kwargs, config = getConfig(tname)  # @UnusedVariable

    # 初始日志文件
    logger = initLogger("datas/logs/" + Id, Id)
    emailjob = EmailMonitor(logger)  # 涉及到类全局变量,需要放在外面初始化

    # minutes -- 每1分钟监听一次
    # seconds -- 每40秒监听一次
    # @AutoReportGlobals.Scheduler.scheduled_job("interval", id=Id, name="邮件监听", minutes=1)
    # 修改为每天早上8点开始到下午19点每隔1分钟
    # @AutoReportGlobals.Scheduler.scheduled_job("cron", id=Id, name="邮件监听", minute="0-59", hour="8-19")
    @AutoReportGlobals.Scheduler.scheduled_job(trigger,
                                               id=Id,
                                               name=Subject,
                                               **kwargs)
    def job_email_monitor():
        try:
            emailjob.start()
        except Exception as e:
            traceback.print_exc()
            logger.error("任务执行失败: " + str(e))
示例#5
0
def initjob():

    Id0 = Id + "0830"
    tname0 = "jobs/MmsCollectionJob/经分提取配置文件0830.xlsx"  # 模版文件
    trigger0, kwargs0, _ = getConfig(tname0)
    # 初始日志文件

    @AutoReportGlobals.Scheduler.scheduled_job(trigger0, id=Id0, name=Subject + Id0, **kwargs0)
    def job_mms_collection0():
        try:
            process = Process(
                target=globals()["mms_collection"], args=(Id0, tname0))
            process.start()
            process.join()
        except Exception as e:
            traceback.print_exc()
            logger = initLogger("datas/logs/" + Id0, Id0)
            logger.error("任务执行失败: " + str(e))

    Id1 = Id + "1320"
    tname1 = "jobs/MmsCollectionJob/经分提取配置文件1320.xlsx"  # 模版文件
    trigger1, kwargs1, _ = getConfig(tname1)
    # 初始日志文件

    @AutoReportGlobals.Scheduler.scheduled_job(trigger1, id=Id1, name=Subject + Id1, **kwargs1)
    def job_mms_collection1():
        try:
            process = Process(
                target=globals()["mms_collection"], args=(Id1, tname1))
            process.start()
            process.join()
        except Exception as e:
            traceback.print_exc()
            logger = initLogger("datas/logs/" + Id1, Id1)
            logger.error("任务执行失败: " + str(e))

    Id2 = Id + "1620"
    tname2 = "jobs/MmsCollectionJob/经分提取配置文件1620.xlsx"  # 模版文件
    trigger2, kwargs2, _ = getConfig(tname2)
    # 初始日志文件

    @AutoReportGlobals.Scheduler.scheduled_job(trigger2, id=Id2, name=Subject + Id2, **kwargs2)
    def job_mms_collection2():
        try:
            process = Process(
                target=globals()["mms_collection"], args=(Id2, tname2))
            process.start()
            process.join()
        except Exception as e:
            traceback.print_exc()
            logger = initLogger("datas/logs/" + Id2, Id2)
            logger.error("任务执行失败: " + str(e))

    Id3 = Id + "1830"
    tname3 = "jobs/MmsCollectionJob/经分提取配置文件1830.xlsx"  # 模版文件
    trigger3, kwargs3, _ = getConfig(tname3)
    # 初始日志文件

    @AutoReportGlobals.Scheduler.scheduled_job(trigger3, id=Id3, name=Subject + Id3, **kwargs3)
    def job_mms_collection3():
        try:
            process = Process(
                target=globals()["mms_collection"], args=(Id3, tname3))
            process.start()
            process.join()
        except Exception as e:
            traceback.print_exc()
            logger = initLogger("datas/logs/" + Id3, Id3)
            logger.error("任务执行失败: " + str(e))

    Id4 = Id + "xiagnzhen"
    tname4 = "jobs/MmsCollectionJob/乡镇经分提取配置文件.xlsx"  # 模版文件
    trigger4, kwargs4, _ = getConfig(tname4)
    # 初始日志文件

    @AutoReportGlobals.Scheduler.scheduled_job(trigger4, id=Id4, name=Subject + Id4, **kwargs4)
    def job_mms_collection4():
        try:
            process = Process(
                target=globals()["mms_collection"], args=(Id4, tname4))
            process.start()
            process.join()
        except Exception as e:
            traceback.print_exc()
            logger = initLogger("datas/logs/" + Id4, Id4)
            logger.error("任务执行失败: " + str(e))
示例#6
0
def broad_band(Id, tname):
    trigger, kwargs, config = getConfig(tname)  # @UnusedVariable
    Subject = "岁末营销日报" + \
        (datetime.now() + timedelta(days=-2)).strftime(" - %Y%m%d")
    fdjob = FileDaily(Id, config, tname, Subject)
    fdjob.start()
示例#7
0
def initjob():
    Id0 = Id + "-0"
    tname0 = "jobs/Reports/FourthJob/岁末营销日报.xlsx"
    trigger0, kwargs0, config0 = getConfig(tname0)  # @UnusedVariable

    @AutoReportGlobals.Scheduler.scheduled_job(trigger0, id=Id0, name=Subject + Id0, **kwargs0)
    def job_broad_band():
        try:
            process = Process(
                target=globals()["broad_band"], args=(Id0, tname0))
            process.start()
            process.join()
        except Exception as e:
            traceback.print_exc()
            logger = initLogger("datas/logs/" + Id0, Id0)
            logger.error("任务执行失败: " + str(e))


def init():
    if not Enable:
        return
    initjob()  # 初始任务


if __name__ == "__main__":
    tname = "岁末营销日报.xlsx"
    trigger, kwargs, config = getConfig(tname)
    initLogger("../../../datas/logs/" + Id, Id)
    fdjob = FileDaily(Id, config, tname, Subject)
    fdjob.start()
示例#8
0
def green_case_in(Id):  # 入库
    tname = "jobs/GreenCaseJob/绿网入库配置文件.xlsx"  # 模版文件
    trigger, kwargs, config = getConfig(tname)  # @UnusedVariable
    gcsjob = GreenCaseStorage(Id, config, tname)
    gcsjob.start()