wcs/wcs/ctl/apply_timeouts.py

52 lines
2.0 KiB
Python

# w.c.s. - web application for online forms
# Copyright (C) 2005-2010 Entr'ouvert
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
from qommon.ctl import Command, make_option
class CmdApplyTimeouts(Command):
name = 'apply_timeouts'
def __init__(self):
Command.__init__(self, [
make_option('--extra', metavar='DIR', action='append',
dest='extra', default=[]),
make_option('--app-dir', metavar='DIR', action='store',
dest='app_dir', default=None),
make_option('--data-dir', metavar='DIR', action='store',
dest='data_dir', default=None),
make_option('--silent', action='store_true',
dest='silent', default=False),
])
def execute(self, options, args):
import wcs.workflows as workflows
import publisher
if options.app_dir:
publisher.WcsPublisher.APP_DIR = options.app_dir
if options.data_dir:
publisher.WcsPublisher.DATA_DIR = options.data_dir
if options.silent:
sys.stdout = file('/dev/null', 'w')
sys.stderr = file('/dev/null', 'w')
pub = publisher.WcsPublisher.create_publisher()
workflows.apply_timeouts()
CmdApplyTimeouts.register()