<commit_before># coding=utf-8

import time

from task.trigger import simple_trigger
from task.trigger import cron_trigger
from task import task
from task import task_container

import my_job

container = task_container.TaskContainer()

_job = my_job.MyJob()

_trigger = simple_trigger.SimpleTrigger(50, 3)
_trigger.set_delay(5, 0)
_task = task.Task('Task', _job, _trigger)

container.add_task(_task)

container.start_all()

time.sleep(10)

container.pasuse_all()

time.sleep(30)

container.start_all()

time.sleep(60)

container.stop_all()

time.sleep(10)

container.remove_task('Task')

_trigger = cron_trigger.CronTrigger('0-59/5 48,50,52 * 28 MAY * 2015')
_task = task.Task('Task2', _job, _trigger)

container.add_task(_task)

container.start_all()<commit_msg>更新测试用例<commit_after># coding=utf-8

import time

from task import task
from task import task_container

import my_job

container = task_container.TaskContainer()

from task.trigger import simple_trigger
def test_simple_trigger():
    _job = my_job.MyJob()
    
    _trigger = simple_trigger.SimpleTrigger(50, 3)
    _trigger.set_delay(5, 0)
    _task = task.Task('Task', _job, _trigger)
    
    container.add_task(_task)
    
    print '---------Start Simple Trigger---------'
    container.start_all()
    time.sleep(10)
    
    print '---------Pause---------'
    container.pasuse_all()
    time.sleep(30)
    
    print '---------Restart---------'
    container.start_all()
    time.sleep(60)
    
    print '---------Stop---------'
    container.stop_all()
    time.sleep(10)
    
    print '---------Remove---------'
    container.remove_task('Task')

from task.trigger import cron_trigger
def test_cron_trigger():
    _job = my_job.MyJob()
    _trigger = cron_trigger.CronTrigger('0-59/5 10,15,20 * * MAY * 2015')
    _task = task.Task('Task2', _job, _trigger)
    
    container.add_task(_task)

    print '---------Start Cron Trigger---------'
    container.start_all()
    
test_simple_trigger()
time.sleep(30)
test_cron_trigger()
{'fraction_non_alphanumeric': 0.15556635877491493, 'fraction_numerical': 0.030140982012639768, 'mean_word_length': 2.8324022346368714, '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': '7362733', 'n_tokens_mistral': 746, 'n_tokens_neox': 685, 'n_words': 137}