Пример #1
0
def run(args=None, intro=True):
    # display the 'grid-control' logo and version
    if intro and not os.environ.get('GC_DISABLE_INTRO'):
        sys.stdout.write(SafeFile(utils.pathShare('logo.txt'), 'r').read())
        sys.stdout.write('Revision: %s\n' % utils.getVersion())
    pyver = (sys.version_info[0], sys.version_info[1])
    if pyver < (2, 3):
        utils.deprecated(
            'This python version (%d.%d) is not supported anymore!' % pyver)
    Activity.root = Activity('Running grid-control',
                             name='root')  # top level activity instance

    # main try... except block to catch exceptions and show error message
    try:
        config = gc_create_config(args or sys.argv[1:], useDefaultFiles=True)
        workflow = gc_create_workflow(config)
        try:
            sys.exit(workflow.run())
        finally:
            sys.stdout.write('\n')
    except SystemExit:  # avoid getting caught for Python < 2.5
        raise
    except Exception:  # coverage overrides sys.excepthook
        gc_excepthook(*sys.exc_info())
        sys.exit(os.EX_SOFTWARE)
Пример #2
0
def _parse_cmd_line(cmd_line_args):
    # grid-control command line parser
    parser = Options(usage='%s [OPTIONS] <config file>', add_help_option=False)
    parser.add_bool(None, ' ', 'debug', default=False)
    parser.add_bool(None, ' ', 'help-conf', default=False)
    parser.add_bool(None, ' ', 'help-confmin', default=False)
    parser.add_bool(None, 'c', 'continuous', default=False)
    parser.add_bool(None, 'h', 'help', default=False)
    parser.add_bool(None, 'i', 'init', default=False)
    parser.add_bool(None, 'q', 'resync', default=False)
    parser.add_bool(None,
                    's',
                    'no-submission',
                    default=True,
                    dest='submission')
    parser.add_bool(None, 'G', 'gui', default=False, dest='gui_ansi')
    parser.add_accu(None, 'v', 'verbose')
    parser.add_list(None, 'l', 'logging')
    parser.add_list(None, 'o', 'override')
    parser.add_text(None, 'a', 'action')
    parser.add_text(None, 'd', 'delete')
    parser.add_text(None, 'C', 'cancel')
    parser.add_text(None, 'J', 'job-selector')
    parser.add_text(None, 'n', 'jobs')
    parser.add_text(None, 'm', 'max-retry')
    parser.add_text(None, ' ', 'reset')
    parser.add_bool(None, ' ', 'debug-console',
                    False)  # undocumented debug option
    parser.add_list(None, ' ', 'debug-trace')  # undocumented debug option
    # Deprecated options - refer to new report script instead
    for (sopt, lopt) in [('-r', 'report'), ('-R', 'site-report'),
                         ('-T', 'time-report'), ('-M', 'task-report'),
                         ('-D', 'detail-report'), ('', 'help-vars')]:
        parser.add_bool(None, sopt, lopt, default=False, dest='old_report')

    (opts, args, _) = parser.parse(args=cmd_line_args)
    opts.gui = None
    if opts.gui_ansi:
        opts.gui = 'ANSIGUI'
    opts.continuous = opts.continuous or None  # either True or None
    # Display help
    if opts.help:
        parser.exit_with_usage(msg=SafeFile(
            get_path_share('help.txt')).read_close(),
                               show_help=False)
    # Require single config file argument
    if len(args) == 0:
        parser.exit_with_usage(msg='Config file not specified!')
    elif len(args) > 1:
        parser.exit_with_usage(msg='Invalid command line arguments: %r' %
                               cmd_line_args)
    # Warn about deprecated report options
    if opts.old_report:
        deprecated(
            'Please use the more versatile report tool in the scripts directory!'
        )
    # Configure preliminary logging
    logging.getLogger().setLevel(max(1, logging.DEFAULT - opts.verbose))
    return (opts, args)
Пример #3
0
	def __init__(self, config, name):
		deprecated('Please use the GliteWMS backend for grid jobs!')
		GridWMS.__init__(self, config, name,
			submit_exec=resolve_install_path('glite-job-submit'),
			output_exec=resolve_install_path('glite-job-output'),
			check_executor=GridCheckJobs(config, 'glite-job-status'),
			cancel_executor=GridCancelJobs(config, 'glite-job-cancel'))
		self._submit_args_dict.update({'-r': self._ce, '--config-vo': self._config_fn})
Пример #4
0
	def __init__(self, config, name):
		utils.deprecated('Please use the GliteWMS backend for grid jobs!')
		GridWMS.__init__(self, config, name)

		self._submitExec = utils.resolveInstallPath('glite-job-submit')
		self._statusExec = utils.resolveInstallPath('glite-job-status')
		self._outputExec = utils.resolveInstallPath('glite-job-output')
		self._cancelExec = utils.resolveInstallPath('glite-job-cancel')
		self._submitParams.update({'-r': self._ce, '--config-vo': self._configVO })
Пример #5
0
    def __init__(self, config, name):
        utils.deprecated("Please use the GliteWMS backend for grid jobs!")
        GridWMS.__init__(self, config, name)

        self._submitExec = utils.resolveInstallPath("glite-job-submit")
        self._statusExec = utils.resolveInstallPath("glite-job-status")
        self._outputExec = utils.resolveInstallPath("glite-job-output")
        self._cancelExec = utils.resolveInstallPath("glite-job-cancel")
        self._submitParams.update({"-r": self._ce, "--config-vo": self._configVO})
Пример #6
0
	def __init__(self, config, name):
		utils.deprecated('Please use the GliteWMS backend for grid jobs!')
		GridWMS.__init__(self, config, name,
			checkExecutor = Grid_CheckJobs(config, 'glite-job-status'),
			cancelExecutor = Grid_CancelJobs(config, 'glite-job-cancel'))

		self._submitExec = utils.resolveInstallPath('glite-job-submit')
		self._outputExec = utils.resolveInstallPath('glite-job-output')
		self._submitParams.update({'-r': self._ce, '--config-vo': self._configVO })
Пример #7
0
def gc_cmd_line_parser(cmd_line_args):
	parser = Options(usage = '%s [OPTIONS] <config file>', add_help_option = False)
	parser.addBool(None, ' ', 'debug',         default = False)
	parser.addBool(None, ' ', 'help-conf',     default = False)
	parser.addBool(None, ' ', 'help-confmin',  default = False)
	parser.addBool(None, 'c', 'continuous',    default = False)
	parser.addBool(None, 'h', 'help',          default = False)
	parser.addBool(None, 'i', 'init',          default = False)
	parser.addBool(None, 'q', 'resync',        default = False)
	parser.addBool(None, 's', 'no-submission', default = True,  dest = 'submission')
	parser.addBool(None, 'G', 'gui',           default = False, dest = 'gui_ansi')
	parser.addBool(None, 'W', 'webserver',     default = False, dest = 'gui_cp')
	parser.addAccu(None, 'v', 'verbose')
	parser.addList(None, 'l', 'logging')
	parser.addList(None, 'o', 'override')
	parser.addText(None, ' ', 'action')
	parser.addText(None, 'd', 'delete')
	parser.addText(None, 'J', 'job-selector')
	parser.addText(None, 'm', 'max-retry')
	parser.addText(None, ' ', 'reset')
	# Deprecated options - refer to new report script instead
	for (sopt, lopt) in [('-r', 'report'), ('-R', 'site-report'), ('-T', 'time-report'),
			('-M', 'task-report'), ('-D', 'detail-report'), ('', 'help-vars')]:
		parser.addBool(None, sopt, lopt, default = False, dest = 'old_report')

	(opts, args, _) = parser.parse(args = cmd_line_args)
	opts.gui = None
	if opts.gui_ansi:
		opts.gui = 'ANSIGUI'
	elif opts.gui_cp:
		opts.gui = 'CPWebserver'
	opts.continuous = opts.continuous or None # either True or None
	# Display help
	if opts.help:
		sys.stderr.write('%s\n\n%s\n' % (parser.usage(), open(utils.pathShare('help.txt'), 'r').read()))
		sys.exit(os.EX_USAGE)
	# Require single config file argument
	if len(args) == 0:
		utils.exitWithUsage(parser.usage(), 'Config file not specified!')
	elif len(args) > 1:
		utils.exitWithUsage(parser.usage(), 'Invalid command line arguments: %r' % cmd_line_args)
	# Warn about deprecated report options
	if opts.old_report:
		utils.deprecated('Please use the more versatile report tool in the scripts directory!')
	# Configure preliminary logging
	utils.verbosity(opts.verbose)
	logging.getLogger().setLevel(max(1, logging.DEFAULT - opts.verbose))
	if opts.debug: # Setup initial debug handler before it is reconfigured by logging_setup
		handler = logging.StreamHandler(sys.stdout)
		handler.setFormatter(ExceptionFormatter(showCodeContext = 2, showVariables = 1, showFileStack = 1))
		logging.getLogger('exception').addHandler(handler)

	return (opts, args)
Пример #8
0
def gc_cmd_line_parser(cmd_line_args):
	parser = Options(usage = '%s [OPTIONS] <config file>', add_help_option = False)
	parser.addBool(None, ' ', 'debug',         default = False)
	parser.addBool(None, ' ', 'help-conf',     default = False)
	parser.addBool(None, ' ', 'help-confmin',  default = False)
	parser.addBool(None, 'c', 'continuous',    default = False)
	parser.addBool(None, 'h', 'help',          default = False)
	parser.addBool(None, 'i', 'init',          default = False)
	parser.addBool(None, 'q', 'resync',        default = False)
	parser.addBool(None, 's', 'no-submission', default = True,  dest = 'submission')
	parser.addBool(None, 'G', 'gui',           default = False, dest = 'gui_ansi')
	parser.addBool(None, 'W', 'webserver',     default = False, dest = 'gui_cp')
	parser.addAccu(None, 'v', 'verbose')
	parser.addList(None, 'l', 'logging')
	parser.addList(None, 'o', 'override')
	parser.addText(None, ' ', 'action')
	parser.addText(None, 'd', 'delete')
	parser.addText(None, 'J', 'job-selector')
	parser.addText(None, 'm', 'max-retry')
	parser.addText(None, ' ', 'reset')
	# Deprecated options - refer to new report script instead
	for (sopt, lopt) in [('-r', 'report'), ('-R', 'site-report'), ('-T', 'time-report'),
			('-M', 'task-report'), ('-D', 'detail-report'), ('', 'help-vars')]:
		parser.addBool(None, sopt, lopt, default = False, dest = 'old_report')

	(opts, args, _) = parser.parse(args = cmd_line_args)
	opts.gui = None
	if opts.gui_ansi:
		opts.gui = 'ANSIGUI'
	elif opts.gui_cp:
		opts.gui = 'CPWebserver'
	opts.continuous = opts.continuous or None # either True or None
	# Display help
	if opts.help:
		sys.stderr.write('%s\n\n%s\n' % (parser.usage(), open(utils.pathShare('help.txt'), 'r').read()))
		sys.exit(os.EX_USAGE)
	# Require single config file argument
	if len(args) == 0:
		utils.exitWithUsage(parser.usage(), 'Config file not specified!')
	elif len(args) > 1:
		utils.exitWithUsage(parser.usage(), 'Invalid command line arguments: %r' % cmd_line_args)
	# Warn about deprecated report options
	if opts.old_report:
		utils.deprecated('Please use the more versatile report tool in the scripts directory!')
	# Configure preliminary logging
	utils.verbosity(opts.verbose)
	logging.getLogger().setLevel(max(1, logging.DEFAULT - opts.verbose))
	if opts.debug: # Setup initial debug handler before it is reconfigured by logging_setup
		handler = logging.StreamHandler(sys.stdout)
		handler.setFormatter(ExceptionFormatter(showCodeContext = 2, showVariables = 1, showFileStack = 1))
		logging.getLogger('exception').addHandler(handler)

	return (opts, args)
Пример #9
0
 def __init__(self, config, name):
     deprecated('Please use the GliteWMS backend for grid jobs!')
     GridWMS.__init__(self,
                      config,
                      name,
                      submit_exec=resolve_install_path('glite-job-submit'),
                      output_exec=resolve_install_path('glite-job-output'),
                      check_executor=GridCheckJobs(config,
                                                   'glite-job-status'),
                      cancel_executor=GridCancelJobs(
                          config, 'glite-job-cancel'))
     self._submit_args_dict.update({
         '-r': self._ce,
         '--config-vo': self._config_fn
     })
Пример #10
0
def _parse_cmd_line(cmd_line_args):
	# grid-control command line parser
	parser = Options(usage='%s [OPTIONS] <config file>', add_help_option=False)
	parser.add_bool(None, ' ', 'debug', default=False)
	parser.add_bool(None, ' ', 'help-conf', default=False)
	parser.add_bool(None, ' ', 'help-confmin', default=False)
	parser.add_bool(None, 'c', 'continuous', default=False)
	parser.add_bool(None, 'h', 'help', default=False)
	parser.add_bool(None, 'i', 'init', default=False)
	parser.add_bool(None, 'q', 'resync', default=False)
	parser.add_bool(None, 's', 'no-submission', default=True, dest='submission')
	parser.add_bool(None, 'G', 'gui', default=False, dest='gui_ansi')
	parser.add_accu(None, 'v', 'verbose')
	parser.add_list(None, 'l', 'logging')
	parser.add_list(None, 'o', 'override')
	parser.add_text(None, 'a', 'action')
	parser.add_text(None, 'd', 'delete')
	parser.add_text(None, 'C', 'cancel')
	parser.add_text(None, 'J', 'job-selector')
	parser.add_text(None, 'n', 'jobs')
	parser.add_text(None, 'm', 'max-retry')
	parser.add_text(None, ' ', 'reset')
	parser.add_bool(None, ' ', 'debug-console', False)  # undocumented debug option
	parser.add_list(None, ' ', 'debug-trace')  # undocumented debug option
	# Deprecated options - refer to new report script instead
	for (sopt, lopt) in [('-r', 'report'), ('-R', 'site-report'), ('-T', 'time-report'),
			('-M', 'task-report'), ('-D', 'detail-report'), ('', 'help-vars')]:
		parser.add_bool(None, sopt, lopt, default=False, dest='old_report')

	(opts, args, _) = parser.parse(args=cmd_line_args)
	opts.gui = None
	if opts.gui_ansi:
		opts.gui = 'ANSIGUI'
	opts.continuous = opts.continuous or None  # either True or None
	# Display help
	if opts.help:
		parser.exit_with_usage(msg=SafeFile(get_path_share('help.txt')).read_close(), show_help=False)
	# Require single config file argument
	if len(args) == 0:
		parser.exit_with_usage(msg='Config file not specified!')
	elif len(args) > 1:
		parser.exit_with_usage(msg='Invalid command line arguments: %r' % cmd_line_args)
	# Warn about deprecated report options
	if opts.old_report:
		deprecated('Please use the more versatile report tool in the scripts directory!')
	# Configure preliminary logging
	logging.getLogger().setLevel(max(1, logging.DEFAULT - opts.verbose))
	return (opts, args)
Пример #11
0
def gc_run(args=None, intro=True):
	# display the 'grid-control' logo and version
	if intro and not os.environ.get('GC_DISABLE_INTRO'):
		sys.stdout.write(SafeFile(get_path_share('logo.txt'), 'r').read_close())
		sys.stdout.write('Revision: %s\n' % get_version())
	pyver = (sys.version_info[0], sys.version_info[1])
	if pyver < (2, 3):
		deprecated('This python version (%d.%d) is not supported anymore!' % pyver)
	atexit.register(lambda: sys.stdout.write('\n'))

	# main try... except block to catch exceptions and show error message
	try:
		return _gc_run(args)
	except SystemExit:  # avoid getting caught for Python < 2.5
		abort(True)
		raise
	except Exception:  # coverage overrides sys.excepthook
		abort(True)
		gc_excepthook(*sys.exc_info())
		sys.exit(os.EX_SOFTWARE)
Пример #12
0
def run():
	# set up signal handler for interrupts and debug session requests
	signal.signal(signal.SIGINT, handle_abort_interrupt)
	signal.signal(signal.SIGURG, handle_debug_interrupt)

	# display the 'grid-control' logo and version
	sys.stdout.write(open(utils.pathShare('logo.txt'), 'r').read())
	sys.stdout.write('Revision: %s\n' % utils.getVersion())
	pyver = (sys.version_info[0], sys.version_info[1])
	if pyver < (2, 3):
		utils.deprecated('This python version (%d.%d) is not supported anymore!' % pyver)

	# main try... except block to catch exceptions and show error message
	try:
		config = gc_create_config(sys.argv[1:])
		workflow = gc_create_workflow(config)
		sys.exit(workflow.run())
	except SystemExit:
		pass
	except Exception: # coverage overrides sys.excepthook
		gc_excepthook(*sys.exc_info())
Пример #13
0
def gc_run(args=None, intro=True):
    # display the 'grid-control' logo and version
    if intro and not os.environ.get('GC_DISABLE_INTRO'):
        sys.stdout.write(
            SafeFile(get_path_share('logo.txt'), 'r').read_close())
        sys.stdout.write('Revision: %s\n' % get_version())
    pyver = (sys.version_info[0], sys.version_info[1])
    if pyver < (2, 3):
        deprecated('This python version (%d.%d) is not supported anymore!' %
                   pyver)
    atexit.register(lambda: sys.stdout.write('\n'))

    # main try... except block to catch exceptions and show error message
    try:
        return _gc_run(args)
    except SystemExit:  # avoid getting caught for Python < 2.5
        abort(True)
        raise
    except Exception:  # coverage overrides sys.excepthook
        abort(True)
        gc_excepthook(*sys.exc_info())
        sys.exit(os.EX_SOFTWARE)
Пример #14
0
def run():
    # set up signal handler for interrupts and debug session requests
    signal.signal(signal.SIGINT, handle_abort_interrupt)
    signal.signal(signal.SIGURG, handle_debug_interrupt)

    # display the 'grid-control' logo and version
    sys.stdout.write(open(utils.pathShare('logo.txt'), 'r').read())
    sys.stdout.write('Revision: %s\n' % utils.getVersion())
    pyver = (sys.version_info[0], sys.version_info[1])
    if pyver < (2, 3):
        utils.deprecated(
            'This python version (%d.%d) is not supported anymore!' % pyver)

    # main try... except block to catch exceptions and show error message
    try:
        config = gc_create_config(sys.argv[1:])
        workflow = gc_create_workflow(config)
        sys.exit(workflow.run())
    except SystemExit:
        pass
    except Exception:  # coverage overrides sys.excepthook
        gc_excepthook(*sys.exc_info())
Пример #15
0
def run(args = None, intro = True):
	# display the 'grid-control' logo and version
	if intro and not os.environ.get('GC_DISABLE_INTRO'):
		sys.stdout.write(SafeFile(utils.pathShare('logo.txt'), 'r').read())
		sys.stdout.write('Revision: %s\n' % utils.getVersion())
	pyver = (sys.version_info[0], sys.version_info[1])
	if pyver < (2, 3):
		utils.deprecated('This python version (%d.%d) is not supported anymore!' % pyver)
	Activity.root = Activity('Running grid-control', name = 'root') # top level activity instance

	# main try... except block to catch exceptions and show error message
	try:
		config = gc_create_config(args or sys.argv[1:], useDefaultFiles = True)
		workflow = gc_create_workflow(config)
		try:
			sys.exit(workflow.run())
		finally:
			sys.stdout.write('\n')
	except SystemExit: # avoid getting caught for Python < 2.5 
		raise
	except Exception: # coverage overrides sys.excepthook
		gc_excepthook(*sys.exc_info())
		sys.exit(os.EX_SOFTWARE)
Пример #16
0
	def interrupt(sig, frame):
		global log, handler
		utils.abort(True)
		log = utils.ActivityLog('Quitting grid-control! (This can take a few seconds...)')
		signal.signal(signal.SIGINT, handler)
	handler = signal.signal(signal.SIGINT, interrupt)

	# set up signal handler for debug session requests
	signal.signal(signal.SIGURG, debugInterruptHandler)

	# display the 'grid-control' logo and version
	utils.vprint(open(utils.pathShare('logo.txt'), 'r').read(), -1)
	utils.vprint('Revision: %s' % utils.getVersion(), -1)
	pyver = sys.version_info[0] + sys.version_info[1] / 10.0
	if pyver < 2.3:
		utils.deprecated('This python version (%.1f) is not supported anymore!' % pyver)

	usage = 'Syntax: %s [OPTIONS] <config file>\n' % sys.argv[0]
	parser = optparse.OptionParser(add_help_option=False)
	parser.add_option('-h', '--help',          dest='help',       default=False, action='store_true')
	parser.add_option('',   '--help-conf',     dest='help_cfg',   default=False, action='store_true')
	parser.add_option('',   '--help-confmin',  dest='help_scfg',  default=False, action='store_true')
	parser.add_option('-i', '--init',          dest='init',       default=False, action='store_true')
	parser.add_option('-q', '--resync',        dest='resync',     default=False, action='store_true')
	parser.add_option('',   '--debug',         dest='debug',      default=False, action='store_true')
	parser.add_option('-s', '--no-submission', dest='submission', default=True,  action='store_false')
	parser.add_option('-c', '--continuous',    dest='continuous', default=None,  action='store_true')
	parser.add_option('-o', '--override',      dest='override',   default=[],    action='append')
	parser.add_option('-d', '--delete',        dest='delete',     default=None)
	parser.add_option('',   '--reset',         dest='reset',      default=None)
	parser.add_option('-a', '--action',        dest='action',     default=None)