當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。