本文整理匯總了Python中flexget.ipc.IPCServer.shutdown方法的典型用法代碼示例。如果您正苦於以下問題:Python IPCServer.shutdown方法的具體用法?Python IPCServer.shutdown怎麽用?Python IPCServer.shutdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類flexget.ipc.IPCServer
的用法示例。
在下文中一共展示了IPCServer.shutdown方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Manager
# 需要導入模塊: from flexget.ipc import IPCServer [as 別名]
# 或者: from flexget.ipc.IPCServer import shutdown [as 別名]
class Manager(object):
"""Manager class for FlexGet
Fires events:
* manager.initialize
The first time the manager is initialized, before config is loaded
* manager.before_config_load
Before the config file is loaded from disk
* manager.before_config_validate
When updating the config, before the validator is run on it
* manager.config_updated
After a configuration file has been loaded or changed (and validated) this event is fired
* manager.startup
After manager has been initialized. This is when application becomes ready to use, however no database lock is
present, so the database must not be modified on this event.
* manager.lock_acquired
The manager does not always require a lock on startup, if one is requested, this event will run when it has been
acquired successfully
* manager.upgrade
If any plugins have declared a newer schema version than exists in the database, this event will be fired to
allow plugins to upgrade their tables
* manager.shutdown_requested
When shutdown has been requested. Any plugins which might add to execution queue should stop when this is fired.
* manager.shutdown
When the manager is exiting
* manager.execute.completed
If execution in current process was completed
* manager.daemon.started
* manager.daemon.completed
* manager.db_cleanup
"""
unit_test = False
options = None
def __init__(self, args):
"""
:param args: CLI args
"""
global manager
if not self.unit_test:
assert not manager, 'Only one instance of Manager should be created at a time!'
elif manager:
log.info('last manager was not torn down correctly')
if args is None:
# Decode all arguments to unicode before parsing
args = unicode_argv()[1:]
self.args = args
self.config_base = None
self.config_name = None
self.config_path = None
self.db_filename = None
self.engine = None
self.lockfile = None
self.database_uri = None
self.db_upgraded = False
self._has_lock = False
self.is_daemon = False
self.ipc_server = None
self.task_queue = None
self.persist = None
self.initialized = False
self.config = {}
if '--help' in args or '-h' in args:
# TODO: This is a bit hacky, but we can't call parse on real arguments when --help is used because it will
# cause a system exit before plugins are loaded and print incomplete help. This will get us a default
# options object and we'll parse the real args later, or send them to daemon. #2807
self.options, extra = CoreArgumentParser().parse_known_args(['execute'])
else:
try:
self.options, extra = CoreArgumentParser().parse_known_args(args)
except ParserError:
try:
# If a non-built-in command was used, we need to parse with a parser that doesn't define the subparsers
self.options, extra = manager_parser.parse_known_args(args)
except ParserError as e:
#.........這裏部分代碼省略.........