<commit_before># -*- coding: utf-8 -*-

import datetime
from apscheduler.scheduler import Scheduler
from apscheduler.events import EVENT_JOB_ERROR, EVENT_JOB_MISSED
import logging


logger = logging.getLogger('default')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)


sched = Scheduler(daemonic=False)


def err_listener(ev):
    if ev.exception:
        logger.fatal('%s error.', str(ev.job), exc_info=True)
    else:
        logger.info('%s miss', str(ev.job))


@sched.cron_schedule(second='1')
def job():
    logger.debug(datetime.datetime.now())
    pass


if __name__ == '__main__':
    sched.add_listener(err_listener, EVENT_JOB_ERROR | EVENT_JOB_MISSED)
    sched.start()
<commit_msg>自动备份的一个解决方案<commit_after># -*- coding: utf-8 -*-

import datetime
from apscheduler.scheduler import Scheduler
from apscheduler.events import EVENT_JOB_ERROR, EVENT_JOB_MISSED
import logging

from yunbk.yunbk import YunBK
from yunbk.backend.local import LocalBackend


logger = logging.getLogger('default')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)

sched = Scheduler(daemonic=False)
ybk = YunBK()
bk_backend = LocalBackend('/data/release/backup/')


def err_listener(ev):
    if ev.exception:
        logger.fatal('%s error.', str(ev.job), exc_info=True)
    else:
        logger.info('%s miss', str(ev.job))


@sched.cron_schedule(second='1')
def job():
    logger.debug(datetime.datetime.now())
    ybk.backup(bk_backend, '/Users/zny2008/gitdata/yunbk')
    pass


if __name__ == '__main__':
    sched.add_listener(err_listener, EVENT_JOB_ERROR | EVENT_JOB_MISSED)
    sched.start()

{'fraction_non_alphanumeric': 0.1301160659743433, 'fraction_numerical': 0.004886988393402566, 'mean_word_length': 4.7073170731707314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6497977', 'n_tokens_mistral': 588, 'n_tokens_neox': 569, 'n_words': 106}