本文整理汇总了Python中multiprocessing.process.Process.daemon方法的典型用法代码示例。如果您正苦于以下问题:Python Process.daemon方法的具体用法?Python Process.daemon怎么用?Python Process.daemon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.process.Process
的用法示例。
在下文中一共展示了Process.daemon方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_litmus_with_authentication
# 需要导入模块: from multiprocessing.process import Process [as 别名]
# 或者: from multiprocessing.process.Process import daemon [as 别名]
def test_litmus_with_authentication(self):
"""Run litmus test suite on HTTP with authentification.
This test passes
"""
try:
proc = Process(target=run_wsgidav_server, args=(True, False))
proc.daemon = True
proc.start()
time.sleep(1)
try:
self.assertEqual(subprocess.call(["litmus", "http://127.0.0.1:8080/", "tester", "secret"]),
0,
"litmus suite failed: check the log")
except OSError:
print "*" * 70
print "This test requires the litmus test suite."
print "See http://www.webdav.org/neon/litmus/"
print "*" * 70
raise
finally:
proc.terminate()
proc.join()
示例2: process
# 需要导入模块: from multiprocessing.process import Process [as 别名]
# 或者: from multiprocessing.process.Process import daemon [as 别名]
def process(host,port):
from multiprocessing.process import Process
p = Process(target=run, args=(host,port))
p.daemon = True
p.start()
return p
示例3: main
# 需要导入模块: from multiprocessing.process import Process [as 别名]
# 或者: from multiprocessing.process.Process import daemon [as 别名]
def main():
''' parse the command line - new up the appl and listen on port '''
if os.path.isfile("../kew_pe.conf"):
print ("Loading config file ../kew_pe.conf")
options.parse_config_file("../kew_pe.conf")
options.parse_command_line()
logging.basicConfig(level=logging.DEBUG)
#report_control.process('localhost',8081)
process = Process(target=report_control.run, name="report_control", kwargs={'host':'localhost', 'port':8081})
process.daemon = True
process.start()
示例4: start_actor_server
# 需要导入模块: from multiprocessing.process import Process [as 别名]
# 或者: from multiprocessing.process.Process import daemon [as 别名]
def start_actor_server(
actor,
host_port_tuple=None,
start_in_background_thread=False,
log_requests=False,
server_starter=start_bjoern_server
):
if server_starter != start_bjoern_server:
print("Using builtin server (slow)")
if not host_port_tuple:
# if no specific port is given,
# run on free port
host_port_tuple = ('', 0)
port = host_port_tuple[1]
if host_port_tuple[1] == 0:
port = get_free_port(host_port_tuple)
host_name = get_host_name(host_port_tuple[0])
host_uri = 'http://{0}:{1}'.format(host_name, port)
print("Running server on {0}".format(host_uri))
wsgi_application = get_wsgi_application(
actor, host_uri,
log_requests=log_requests
)
if start_in_background_thread:
process = Process(
target=server_starter,
args=(wsgi_application, host_name, port)
)
process.daemon = True
process.start()
return host_uri, process
server_starter(wsgi_application, host_name, port)
示例5: build_process
# 需要导入模块: from multiprocessing.process import Process [as 别名]
# 或者: from multiprocessing.process.Process import daemon [as 别名]
def build_process(target):
f51fp = Process(target=target, name=target.__name__)
f51fp.daemon = 1
f51fp.start()
return f51fp