本文整理汇总了Python中multiprocessing.Process.deamon方法的典型用法代码示例。如果您正苦于以下问题:Python Process.deamon方法的具体用法?Python Process.deamon怎么用?Python Process.deamon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.Process
的用法示例。
在下文中一共展示了Process.deamon方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_conn_process
# 需要导入模块: from multiprocessing import Process [as 别名]
# 或者: from multiprocessing.Process import deamon [as 别名]
def start_conn_process():
# Create device info here as it may change after restart.
config = {
"digest" : "serial",
"port" : self.mbed.port,
"baudrate" : self.mbed.serial_baud,
"program_cycle_s" : self.options.program_cycle_s,
"reset_type" : self.options.forced_reset_type,
"target_id" : self.options.target_id,
"serial_pooling" : self.options.pooling_timeout,
"forced_reset_timeout" : self.options.forced_reset_timeout,
"sync_behavior" : self.options.sync_behavior,
"platform_name" : self.options.micro,
"image_path" : self.mbed.image_path,
}
if self.options.global_resource_mgr:
grm_module, grm_host, grm_port = self.options.global_resource_mgr.split(':')
config.update({
"conn_resource" : 'grm',
"grm_module" : grm_module,
"grm_host" : grm_host,
"grm_port" : grm_port,
})
# DUT-host communication process
args = (event_queue, dut_event_queue, config)
p = Process(target=conn_process, args=args)
p.deamon = True
p.start()
return p
示例2: calculate_quality_list
# 需要导入模块: from multiprocessing import Process [as 别名]
# 或者: from multiprocessing.Process import deamon [as 别名]
def calculate_quality_list(self, voi, gantry, couch, calculate_from=0, stepsize=1.0, avoid=[], gradient=True):
""" TODO: Documentation
"""
q = Queue(32767)
process = []
d = voi.get_voi_cube()
d.cube = np.array(d.cube, dtype=np.float32)
voi_cube = DensityProjections(d)
result = []
for gantry_angle in gantry:
p = Process(
target=self.calculate_angle_quality_thread,
args=(voi, gantry_angle, couch, calculate_from, stepsize, q, avoid, voi_cube, gradient))
p.start()
p.deamon = True
process.append(p)
if len(process) > 2:
tmp = q.get()
result.append(tmp)
for p in process:
if not p.is_alive():
process.remove(p)
while not len(result) == len(gantry) * len(couch):
tmp = q.get()
result.append(tmp)
return result
示例3: worker_proc
# 需要导入模块: from multiprocessing import Process [as 别名]
# 或者: from multiprocessing.Process import deamon [as 别名]
def worker_proc(tur_arg=None, authdata=None, sleeper=None, multipools=None, work=None):
for wp in range(multipools):
j = Process(target=uploader.UploadAction, args=(tur_arg, authdata, work))
j.deamon = True
j.start()
for i in xrange(multipools):
work.put(None)
示例4: start_conn_process
# 需要导入模块: from multiprocessing import Process [as 别名]
# 或者: from multiprocessing.Process import deamon [as 别名]
def start_conn_process():
# Create device info here as it may change after restart.
config = {
"digest" : "serial",
"port" : self.mbed.port,
"baudrate" : self.mbed.serial_baud,
"program_cycle_s" : self.options.program_cycle_s,
"reset_type" : self.options.forced_reset_type
}
# DUT-host communication process
args = (event_queue, dut_event_queue, self.prn_lock, config)
p = Process(target=conn_process, args=args)
p.deamon = True
p.start()
return p
示例5: newAlarm
# 需要导入模块: from multiprocessing import Process [as 别名]
# 或者: from multiprocessing.Process import deamon [as 别名]
def newAlarm(self,seconds,name):
if self.alarmList[name]!=None:
if self.alarmList[name].is_alive():
return False
ala=Process(target=startout, args=(seconds,name))
ala.deamon=True
ala.start()
self.alarmList[name]=ala
print '--------------alarmList Below-------------'
for each in self.alarmList.keys():
if self.alarmList[each]!=None:
print each
print self.alarmList[each].pid
print '--------------alarmList above-------------'
return True
示例6: str
# 需要导入模块: from multiprocessing import Process [as 别名]
# 或者: from multiprocessing.Process import deamon [as 别名]
continue
if port == 0:
print "[MANAGER] Error in assigning ports"
continue
print "[MANAGER] Received simulation with sim_id=" + sim_id + ", starting now on port " + str(port)
starter = Starter()
starter_thread = Thread(target=starter.main, args=(sim_id, port, ports, semaphore))
starter_thread.start()
class Tests:
def __init__(self, t):
print "[HANDLE TESTS] Thread started"
self.tests = t
def handle_tests(self):
while 1:
team_name, agent_name = self.tests.get(block=True)
print "[TESTS] Received test request with agent_name: " + agent_name + " team_name:" + team_name + ", starting now.."
test = Test()
test_thread = Thread(target=test.run, args=(team_name, agent_name,))
test_thread.start()
test_thread.join()
if __name__ == "__main__":
manager = Manager()
manager_thread = Process(target=manager.main)
manager_thread.deamon = True
manager_thread.start()
manager_thread.join()
示例7: execfile
# 需要导入模块: from multiprocessing import Process [as 别名]
# 或者: from multiprocessing.Process import deamon [as 别名]
try:
time.sleep(600)
except:
if cfg['global']['verbose']:
print "Have to end the Sync loop... :("
return
#Including Website
execfile('./website/main.py')
#webservice = Process(target=service_web)
#webservice.deamon = True
#webservice.start()
#if cfg['global']['verbose']:
# print "Serverstarted. You can use your browser to configure: http://%s:%s" % \
# (cfg['webserver']['ip'], cfg['webserver']['port'])
#
syncservice = Process(target=service_sync)
syncservice.deamon = True
syncservice.start()
def quit(signum, frame):
if cfg['global']['verbose']:
print "\nThanks for using always Backup"
try:
sys.exit(0)
except:
pass
signal.signal(signal.SIGINT, quit)