本文整理汇总了Python中server.start函数的典型用法代码示例。如果您正苦于以下问题:Python start函数的具体用法?Python start怎么用?Python start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了start函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: decorated_function
def decorated_function(self, *args):
result = None
try:
return function(self, *args)
except (OSError, socket.error), err:
autostart = self.ui.configbool('inotify', 'autostart', True)
if err[0] == errno.ECONNREFUSED:
self.ui.warn(_('(found dead inotify server socket; '
'removing it)\n'))
os.unlink(self.repo.join('inotify.sock'))
if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart:
self.ui.debug(_('(starting inotify server)\n'))
try:
try:
server.start(self.ui, self.repo)
except server.AlreadyStartedException, inst:
# another process may have started its own
# inotify server while this one was starting.
self.ui.debug(str(inst))
except Exception, inst:
self.ui.warn(_('could not start inotify server: '
'%s\n') % inst)
else:
try:
return function(self, *args)
except socket.error, err:
self.ui.warn(_('could not talk to new inotify '
'server: %s\n') % err[-1])
开发者ID:wangbiaouestc,项目名称:WindowsMingWMC,代码行数:29,代码来源:client.py
示例2: main
def main(**kws):
no_session = kws.pop('no_session', False)
e = engine.HQueryEngine(kws)
import server # server should not be imported in backend process
server.start(e, no_session)
# TODO "reset" -> make everything new
# TODO put git hash of varial on webcreator (find on webcreator init)
# TODO multiple instances: add random token to jug_file path (delete 2w olds)
# TODO add multiple histos e.g. store histos via python, not in json
# TODO CUTFLOW
# TODO hint toggles (on bins vs. low, high / CUTFLOW)
# TODO add multiple histos (toggled form)
# TODO reloading: use ajax instead of full reload
# TODO status from job submitter (warn when only few jobs are running)
# TODO progress bar or (n_done / n_all) statement
# TODO progress: sometimes it hangs until done. Why?
# TODO first make histos for current section, send reload, then others
# TODO lines in plots if selection is applied (improved N-1 feature)
# TODO SGEJobSubmitter: Jobs are killed after 1 hour. Resubmit before that.
# TODO cut efficiency / cutflow plot in map reduce
# TODO histo_form: put width into CSS block
# TODO separate CSS file for all hquery-related fields
# TODO think about pulling everything through GET
# TODO restart backend button
开发者ID:HeinerTholen,项目名称:Varial,代码行数:26,代码来源:main.py
示例3: test_maths
def test_maths( self ):
log_file_name = "integration_logs"
# Remove possible previous file
os.remove(log_file_name)
# Start Graphite Proxy
server.start( 9999, "true", "false" )
# Create python request senders to send requests to the graphite proxy
proxy_host = "127.0.0.1"
proxy_port = 8090
senders = []
for i in range(6):
senders.append( request_sender.RequestSender( proxy_host, proxy_port, False ) )
# Send requests in parallel to test the server threading capabilities (each RequestSender is a different thread)
# Math category 1
senders[0].run("test.integration.maths.1 2 0")
senders[1].run("test.integration.maths.1 3 0")
senders[2].run("test.integration.maths.1 5 0")
# Math category 2
senders[3].run("test.integration.maths.2 2 0")
senders[4].run("test.integration.maths.2 3 0")
senders[5].run("test.integration.maths.2 5 0")
# Wait for the computations
time.sleep(5)
# Stop the server thread to be able to quit the programm properly
server.stop()
# Get received messages from logs
logs_file = open(log_file_name, 'r')
logs = logs_file.read()
# Check received math message for rule 1 (by number of received messages)
self.assertNotEqual( logs.find("Message added: test.integration.maths.1 10.0"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.1 2.0"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.1 5.0"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.1 3.3"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.1 3.0"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.1 1.5"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.1 1.2"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.1 100.0"), -1 )
# Check received math message for rule 2 (by number of spend time)
self.assertNotEqual( logs.find("Message added: test.integration.maths.2 10.0"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.2 2.0"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.2 5.0"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.2 3.3"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.2 3.0"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.2 1.5"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.2 1.2"), -1 )
self.assertNotEqual( logs.find("Message added: test.integration.maths.2 100.0"), -1 )
# Remove created logs file
os.remove(log_file_name)
开发者ID:bdajeje,项目名称:graphite-proxy,代码行数:60,代码来源:test_maths.py
示例4: main
def main():
if len(sys.argv) < 3:
errprint('Usage:\n%s WEB_PORT KADEMLIA_PORT {[KNOWN_NODE_IP KNOWN_NODE_PORT] or FILE}' % sys.argv[0])
sys.exit(1)
try:
int(sys.argv[1])
except ValueError:
errprint('\nWEB_PORT must be an integer.\n')
errprint('Usage:\n%s WEB_PORT KADEMLIA_PORT {[KNOWN_NODE_IP KNOWN_NODE_PORT] or FILE}' % sys.argv[0])
sys.exit(1)
try:
int(sys.argv[2])
except ValueError:
errprint('\nKADEMLIA_PORT must be an integer.\n')
errprint('Usage:\n%s WEB_PORT KADEMLIA_PORT {[KNOWN_NODE_IP KNOWN_NODE_PORT] or FILE}' % sys.argv[0])
sys.exit(1)
if len(sys.argv) == 5:
PEER = [(sys.argv[3], int(sys.argv[4]))]
elif len(sys.argv) == 4:
PEER = []
f = open(sys.argv[3],'r')
lines = f.readlines()
f.close()
for line in lines:
peer_ip,peer_udp = line.split()
PEER.append((peer_ip,int(peer_udp)))
else:
PEER = None;
cprint('PEER is %s' % str(PEER))
node_instance = NODE(KADEMLIA_PORT = int(sys.argv[2]),PEER = PEER);
node_instance.registerNode();
webserver.start(getter = node_instance.searchKey,poster = node_instance.publishKey,web_port = int(sys.argv[1]));
开发者ID:AaronGoldman,项目名称:CCFS_Kademlia_Service,代码行数:34,代码来源:kademlia_service.py
示例5: decorated_function
def decorated_function(self, *args):
try:
return function(self, *args)
except (OSError, socket.error), err:
autostart = self.ui.configbool('inotify', 'autostart', True)
if err.args[0] == errno.ECONNREFUSED:
self.ui.warn(_('inotify-client: found dead inotify server '
'socket; removing it\n'))
os.unlink(os.path.join(self.root, '.hg', 'inotify.sock'))
if err.args[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart:
try:
try:
server.start(self.ui, self.dirstate, self.root,
dict(daemon=True, daemon_pipefds=''))
except server.AlreadyStartedException, inst:
# another process may have started its own
# inotify server while this one was starting.
self.ui.debug(str(inst))
except Exception, inst:
self.ui.warn(_('inotify-client: could not start inotify '
'server: %s\n') % inst)
else:
try:
return function(self, *args)
except socket.error, err:
self.ui.warn(_('inotify-client: could not talk to new '
'inotify server: %s\n') % err.args[-1])
开发者ID:chuchiperriman,项目名称:hg-stable,代码行数:28,代码来源:client.py
示例6: main
def main():
import argparse
parser = argparse.ArgumentParser(
description='Start the Plow Render Node Daemon',
usage='%(prog)s [opts]',
)
parser.add_argument("-debug", action="store_true",
help="Print more debugging output")
args = parser.parse_args()
logger = logging.getLogger()
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = RndFormatter(datefmt='%Y-%m-%d %H:%M:%S')
ch.setFormatter(formatter)
logger.addHandler(ch)
logger.setLevel(logging.DEBUG if args.debug else logging.INFO)
import server
try:
server.start()
except KeyboardInterrupt:
sys.exit(2)
开发者ID:JohanAberg,项目名称:plow,代码行数:29,代码来源:main.py
示例7: run_test
def run_test(tester, proxy_port, is_udp):
# Create a python request receiver to receive Normal requests from the graphite proxy (emulate the Graphite Server)
client_port = 9999
receiver = request_receiver.RequestReceiver()
if not receiver.connect("127.0.0.1", client_port):
print "Impossible to connect, abort."
receiver.stop()
sys.exit()
# Start Graphite Proxy
server.start( client_port, "false", "false" )
# Create python request senders to send requests to the graphite proxy
proxy_host = "127.0.0.1"
senders = []
for i in range(4):
senders.append( request_sender.RequestSender( proxy_host, proxy_port, is_udp ) )
# Send requests in parallel to test the server threading capabilities (each RequestSender is a different thread)
senders[0].run("Integration.test.1 0 0")
senders[1].run("Integration.test.1 50 0")
senders[2].run("Integration.test.2 100 0")
senders[3].run("Integration.test.3 9999 0")
time.sleep(2)
server.stop()
receiver.stop() # Stop the server thread to be able to quit the programm properly
# Receive normal messages
tester.assertNotEqual( receiver.getReceivedMEssage().find("Integration.test.1 0.000000 0\nIntegration.test.1 50.000000 0\nIntegration.test.2 100.000000 0\nIntegration.test.3 9999.000000 0\n"), -1 )
开发者ID:bdajeje,项目名称:graphite-proxy,代码行数:31,代码来源:test_pass_through.py
示例8: status
def status(self, files, match, list_ignored, list_clean,
list_unknown=True):
try:
if not list_ignored and not self.inotifyserver:
result = client.query(ui, repo, files, match, False,
list_clean, list_unknown)
if result is not None:
return result
except socket.error, err:
if err[0] == errno.ECONNREFUSED:
ui.warn(_('(found dead inotify server socket; '
'removing it)\n'))
os.unlink(repo.join('inotify.sock'))
elif err[0] != errno.ENOENT:
raise
if ui.configbool('inotify', 'autostart'):
query = None
ui.debug(_('(starting inotify server)\n'))
try:
server.start(ui, repo)
query = client.query
except server.AlreadyStartedException, inst:
# another process may have started its own
# inotify server while this one was starting.
ui.debug(str(inst))
query = client.query
except Exception, inst:
ui.warn(_('could not start inotify server: '
'%s\n') % inst)
ui.print_exc()
开发者ID:carlgao,项目名称:lenga,代码行数:30,代码来源:__init__.py
示例9: async_main
def async_main(start_ioloop=False):
import tornado.ioloop
from async import client, server
server.start()
client.start()
if start_ioloop:
tornado.ioloop.IOLoop.current().start()
开发者ID:yarpc,项目名称:yarpc-python,代码行数:8,代码来源:main.py
示例10: start
def start():
try:
toolkit.verbose("Starting the system.")
robot.start()
server.start()
toolkit.verbose("Succesfully started the system!")
except:
toolkit.verbose("Uh-oh. An error occured at startup.")
开发者ID:pkok,项目名称:bsc-thesis,代码行数:8,代码来源:main.py
示例11: main
def main():
argparser = ArgumentParser()
argparser.add_argument('-P', '--port', default=8080, type=int)
argparser.add_argument('-H', '--host', default='0.0.0.0', type=str)
args = argparser.parse_args()
initialize()
start(port=args.port, host=args.host)
开发者ID:smurching,项目名称:pokemon_ai,代码行数:9,代码来源:__init__.py
示例12: generate
def generate(edges, js):
print 'generating graph...'
_add_edges(edges)
if js:
_write_graph_to_json()
server.start()
else:
_draw_graph()
开发者ID:DCRichards,项目名称:vizit,代码行数:8,代码来源:graphs.py
示例13: main
def main():
"""Run the world.
This function sets up logging, connects to CloudSQL, and starts the API
Server. It never returns.
"""
logging.getLogger().setLevel(logging.DEBUG)
client = cloud_sql_client.CloudSQLClient(
cloud_sql_backend.INSTANCE, cloud_sql_backend.DATABASE)
backend = cloud_sql_backend.CloudSQLBackend(client)
server.start(backend)
开发者ID:dcurley,项目名称:mlab-metrics-api-server,代码行数:11,代码来源:main.py
示例14: startup
def startup():
#load the config file and start the listener, daemon
config = ConfigParser.ConfigParser()
config.read('C:\dev\projects\elasticd\conf\settings.cfg')
logging.debug("init starting up")
p_manager = PluginManager(config)
datastore = p_manager.get_datastore()
registrar = Registrar(datastore)
server.set_registrar(registrar)
server.start()
开发者ID:benbunk,项目名称:elastic.d,代码行数:13,代码来源:__init__.py
示例15: main
def main():
if len(sys.argv) < 3:
errprint('Usage:\n%s WEB_PORT KADEMLIA_PORT {[KNOWN_NODE_IP KNOWN_NODE_PORT] or FILE}' % sys.argv[0])
sys.exit(1)
try:
int(sys.argv[1])
except ValueError:
errprint('\nWEB_PORT must be an integer.\n')
errprint('Usage:\n%s WEB_PORT KADEMLIA_PORT {[KNOWN_NODE_IP KNOWN_NODE_PORT] or FILE}' % sys.argv[0])
sys.exit(1)
try:
int(sys.argv[2])
except ValueError:
errprint('\nKADEMLIA_PORT must be an integer.\n')
errprint('Usage:\n%s WEB_PORT KADEMLIA_PORT {[KNOWN_NODE_IP KNOWN_NODE_PORT] or FILE}' % sys.argv[0])
sys.exit(1)
if len(sys.argv) == 5:
PEER = [(sys.argv[3], int(sys.argv[4]))]
elif len(sys.argv) == 4:
PEER = []
f = open(sys.argv[3], 'r')
lines = f.readlines()
f.close()
for line in lines:
peer_ip, peer_udp = line.split()
PEER.append((peer_ip, int(peer_udp)))
else:
PEER = None
subprocess.Popen(['python', 'examples/create_network.py', '10', '127.0.0.1'],stdout=subprocess.PIPE)
#cprint('between subprocesses')
time.sleep(5)
subprocess.Popen(['python', 'gui.py', '4050', '127.0.0.1', '4000'],stdout=subprocess.PIPE)
#subprocess.Popen(['gnome-terminal','--tab'])
#cprint('after subprocesses')
node_instance = NODE(KADEMLIA_PORT=int(sys.argv[2]), PEER=PEER)
node_instance.registerNode()
# python gui.py 4000 127.0.0.1 4000 --entangled-0.1
# gnome-terminal --tab
# create_network.py 10 127.0.0.1
webserver.start(getter=node_instance.searchKey, poster=node_instance.publishKey, web_port=int(sys.argv[1]))
开发者ID:ms93,项目名称:CCFS_Kademlia_Service,代码行数:48,代码来源:kademlia_service.py
示例16: startup
def startup(config_path=DEFAULT_SETTINGS_FILE):
#init logging
setup_logging()
#load the config file and start the listener, daemon
logging.debug("init starting up")
config = ConfigParser.ConfigParser()
logging.debug('reading setting from: %s' % config_path)
config.read(config_path)
#Load the plugin manager to get a handle to the plugins.
_plugin_manager = PluginManager(config)
locator = _plugin_manager.get_resource_locator()
datastore = _plugin_manager.get_datastore()
driver = _plugin_manager.get_driver()
_registrar = Registrar(datastore, driver)
#should the listener be started?
start_server = config.getboolean('DEFAULT', 'start_server')
if start_server:
server.set_registrar(registrar)
Thread.start(server.start())
#start looking for backends and updating the driver
#THIS CALL WILL NOT RETURN
daemon.start(_registrar, locator, config)
开发者ID:mchao47,项目名称:Elasticd,代码行数:27,代码来源:__init__.py
示例17: main
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hp:v", \
["help", "port=", "version"])
except getopt.GetoptError:
usage()
sys.exit(2)
for op, value in opts:
if op == "-p":
port = int(value)
init()
logging.info("Server is starting...")
#with daemon.DaemonContext():
server.start(port)
elif op == "-v":
print("Version:" + configure.get_conf()["version"])
elif op == "-h":
usage()
开发者ID:apprentice1989,项目名称:fuzzy-risk-evaluation-server,代码行数:18,代码来源:fuzzyriskeval.py
示例18: main
def main():
import argparse
parser = argparse.ArgumentParser(description="Start the Plow Render Node Daemon", usage="%(prog)s [opts]")
parser.add_argument("-debug", action="store_true", help="Print more debugging output")
args = parser.parse_args()
logger = logging.getLogger()
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = RndFormatter(datefmt="%Y-%m-%d %H:%M:%S")
ch.setFormatter(formatter)
logger.addHandler(ch)
logger.setLevel(logging.DEBUG if args.debug else logging.INFO)
import server
server.start()
开发者ID:Br3nda,项目名称:plow,代码行数:22,代码来源:main.py
示例19: test_statistics
def test_statistics( self ):
# Create a python request receiver to receive Normal requests from the graphite proxy (emulate the Graphite Server)
client_port = 9999
receiver = request_receiver.RequestReceiver()
if not receiver.connect("127.0.0.1", client_port):
print "Impossible to connect, abort."
receiver.stop()
sys.exit()
# Start Graphite Proxy
server.start( client_port, "false", "true" )
time.sleep(4)
server.stop()
receiver.stop() # Stop the server thread to be able to quit the programm properly
# Receive normal messages
messages = receiver.getReceivedMEssage()
self.assertNotEqual( messages.find("stats.global_buffer.messages.max"), -1 )
self.assertNotEqual( messages.find("stats.math_buffer.messages.max"), -1 )
self.assertNotEqual( messages.find("stats.messages.created.nbr"), -1 )
self.assertNotEqual( messages.find("stats.statistics.messages.created.nbr"), -1 )
开发者ID:bdajeje,项目名称:graphite-proxy,代码行数:24,代码来源:test_statistics.py
示例20: startup
def startup(config_path=DEFAULT_SETTINGS_FILE):
''' Load the config file and start the listener, daemon '''
logging.debug('Init starting up')
config = ConfigParser.ConfigParser()
logging.debug('Reading setting from: %s' % config_path)
config.read(config_path)
''' Load the plugin manager to get a handle to the plugins. '''
plugin_manager = PluginManager(config)
_locator = plugin_manager.get_resource_locator()
_datastore = plugin_manager.get_datastore()
_driver = plugin_manager.get_driver()
_registrar = Registrar(_datastore, _driver)
''' Should the listener be started? '''
start_server = config.getboolean('DEFAULT', 'start_server')
if start_server:
server.set_registrar(registrar)
thread.start(server.start())
''' Start looking for backends and updating the driver '''
''' THIS CALL WILL NOT RETURN '''
daemon.start(_registrar, _locator, config)
开发者ID:marshyski,项目名称:Elasticd,代码行数:24,代码来源:__init__.py
注:本文中的server.start函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论