当前位置: 首页>>代码示例>>Python>>正文


Python Plan.script方法代码示例

本文整理汇总了Python中plan.Plan.script方法的典型用法代码示例。如果您正苦于以下问题:Python Plan.script方法的具体用法?Python Plan.script怎么用?Python Plan.script使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plan.Plan的用法示例。


在下文中一共展示了Plan.script方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_cron_script

# 需要导入模块: from plan import Plan [as 别名]
# 或者: from plan.Plan import script [as 别名]
def add_cron_script(plan_name, script, interval):
    cron = Plan(plan_name,
                path=os.path.dirname(os.path.realpath(script)),
                environment=_environment)

    output = {
        'stdout': '/tmp/%s.stdout.log' % (os.path.basename(script)),
        'stderr': '/tmp/%s.stderr.log' % (os.path.basename(script))
    }

    if interval == 'hourly':
        cron.script(os.path.abspath(script),
                    every='1.hour',
                    at='minute.5 minute.15 minute.30 minute.45',
                    output=output)

    elif interval == 'daily':
        cron.script(os.path.abspath(script),
                    every='1.day',
                    at='0:05 4:00 8:00 12:00 16:00 20:00',
                    output=output)

    elif interval == 'weekly':
        cron.script(os.path.abspath(script),
                    every='monday',
                    at='0:05 4:00 8:00 12:00 16:00 20:00',
                    output=output)

    elif isinstance(interval, int):
        cron.script(os.path.abspath(script),
                    every='%d.minute' % (interval / 60),
                    output=output)

    cron.run('update')
开发者ID:MikeMouse,项目名称:gt_g_pygodzilla,代码行数:36,代码来源:cron.py

示例2: getcwd

# 需要导入模块: from plan import Plan [as 别名]
# 或者: from plan.Plan import script [as 别名]
from plan import Plan
from os import getcwd

WORKING_DIR = getcwd() + '/../'
cron = Plan("lyket_ingestion_cron")

cron.script('LyketJob.py', every='5.minutes', path=WORKING_DIR)

if __name__ == '__main__':
    try:
        cron.run('update')
    except:
        cron.run('write')
开发者ID:MathematicianVogt,项目名称:lyk,代码行数:15,代码来源:schedule.py

示例3: Plan

# 需要导入模块: from plan import Plan [as 别名]
# 或者: from plan.Plan import script [as 别名]
# -*- coding: utf-8 -*-

# Use this file to easily define all of your cron jobs.
#
# It's helpful to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
#
# Learn more: http://github.com/fengsp/plan

from plan import Plan

cron = Plan("scripts", path='/web/yourproject/scripts',
                             environment={'YOURAPP_ENV': 'production'})

cron.script('script.py', every='1.day')
cron.script('script_2.py', every='1.month', at='hour.12 minute.0')
# more scripts here

if __name__ == "__main__":
    cron.run()
开发者ID:angrygorilla,项目名称:plan,代码行数:22,代码来源:schedule_scripts.py

示例4: Plan

# 需要导入模块: from plan import Plan [as 别名]
# 或者: from plan.Plan import script [as 别名]
from plan import Plan


cron = Plan(__name__)

cron.script('test', every='5.minute')

cron.run('update')
开发者ID:MikeMouse,项目名称:gt_g_apps,代码行数:10,代码来源:test_plan.py

示例5: Plan

# 需要导入模块: from plan import Plan [as 别名]
# 或者: from plan.Plan import script [as 别名]
#
# Learn more: http://github.com/fengsp/plan

import os
from os.path import join as pjoin
from plan import Plan

dir_path = os.path.dirname(os.path.realpath(__file__))

cron = Plan(
    "scripts",
    path=pjoin(dir_path, '../scrape'),
    environment={'DJANGO_SETTINGS_MODULE': 'scrape.settings_production'}
)

# register one command, script or module
#  cron.command('command', every='1.day')
#  cron.script('script.py', path='/web/yourproject/scripts', every='1.month')
#  cron.module('calendar', every='feburary', at='day.3')

cron.command('cd %s && DJANGO_SETTINGS_MODULE=scrape.settings_production $HOME/venv/bin/scrapy crawl eoaient' % (pjoin(dir_path, '../scrape/crawler')),
    every='2.day', at='minute.48')
cron.command('cd %s && DJANGO_SETTINGS_MODULE=scrape.settings_production $HOME/venv/bin/scrapy crawl ck0tp' % (pjoin(dir_path, '../scrape/crawler')),
    every='3.day', at='minute.12')

cron.script('manage.py extoon_info', every='5.hour', at='minute.30')
cron.script('manage.py extoon_description', every='6.hour', at='minute.15')

if __name__ == "__main__":
    cron.run('update')
开发者ID:ikeikeikeike,项目名称:scrape-django-app,代码行数:32,代码来源:extoon.py

示例6: Plan

# 需要导入模块: from plan import Plan [as 别名]
# 或者: from plan.Plan import script [as 别名]
import os
from os.path import join as pjoin
from plan import Plan

dir_path = os.path.dirname(os.path.realpath(__file__))

cron = Plan(
    "scripts",
    path=pjoin(dir_path, '../scrape'),
    environment={'DJANGO_SETTINGS_MODULE': 'scrape.settings_production'}
)

# register one command, script or module
#  cron.command('command', every='1.day')
#  cron.script('script.py', path='/web/yourproject/scripts', every='1.month')
#  cron.module('calendar', every='feburary', at='day.3')

cron.command('cd %s && $HOME/venv/bin/scrapy crawl toonchar' % (pjoin(dir_path, '../scrape/crawler')), every='1.day', at='minute.48')
cron.script('manage.py profile', every='12.hour', at='minute.24')
cron.script('manage.py actress', every='3.day', at='minute.12')
cron.script('manage.py feed', every='2.hour', at='minute.36')

cron.script('manage.py bing_image_char', every='10.day', at='minute.7')
cron.script('manage.py bing_image_toon', every='7.day', at='minute.14')
cron.script('manage.py bing_image_diva', every='4.day', at='minute.21')
cron.script('manage.py bing_image_tag', every='5.day', at='minute.28')

if __name__ == "__main__":
    cron.run('update')
开发者ID:ikeikeikeike,项目名称:scrape-django-app,代码行数:31,代码来源:schedule.py

示例7: get_environment

# 需要导入模块: from plan import Plan [as 别名]
# 或者: from plan.Plan import script [as 别名]
import subprocess

from plan import Plan

from utils.config import get_environment, get_task_specs


config = get_environment('plan')
config['environment'] = dict(config['environment'])
cron = Plan(**config)
log_path = os.path.abspath(os.path.join(config.path,'logs'))
modules_path = os.path.abspath(os.path.join(config.path,'modules'))

for task in get_environment('tasks'):
    task_specs = get_task_specs(task['name'])
    cron.script(**task_specs)

if __name__ == "__main__":
    command = sys.argv[1]
    if command == 'write':
        if not os.path.exists('logs'):
            os.makedirs('logs')
        c = subprocess.Popen("crabd-check", stdout=subprocess.PIPE, shell=True)
        print(c)
    elif command == 'clear':
        if os.path.exists('logs'):
            shutil.rmtree('logs', ignore_errors=True)
        c = subprocess.Popen("killall crabd", stdout=subprocess.PIPE, shell=True)
        print(c)
    cron.run(command) #write, check, update or clear the crontab
开发者ID:davinirjr,项目名称:cron-metrics,代码行数:32,代码来源:start_cron.py

示例8: Plan

# 需要导入模块: from plan import Plan [as 别名]
# 或者: from plan.Plan import script [as 别名]
# -*- coding: utf-8 -*-

# Use this file to easily define all of your cron jobs.
#
# It's helpful to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
#
# Learn more: http://github.com/fengsp/plan

from plan import Plan

cron = Plan()

cron.command('top', every='4.hour', output=dict(stdout='/tmp/top_stdout.log',
                                                stderr='/tmp/top_stderr.log'))
cron.script('script.py', every='1.day', path='/web/yourproject/scripts',
                             environment={'YOURAPP_ENV': 'production'})

if __name__ == "__main__":
    cron.run()
开发者ID:2008chny,项目名称:plan,代码行数:22,代码来源:schedule.py

示例9: Plan

# 需要导入模块: from plan import Plan [as 别名]
# 或者: from plan.Plan import script [as 别名]
# Package Details:
# http://plan.readthedocs.org/index.html

import os
from plan import Plan

cron = Plan()

path = os.getcwd()
cmd = "python " + path

cron.script("hello_job.py", path=path, every="1.minute")


if __name__ == "__main__":
    cron.run("write")
开发者ID:RichardAfolabi,项目名称:Data_Analysis_with_Python,代码行数:18,代码来源:schedule_hello.py


注:本文中的plan.Plan.script方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。