本文整理汇总了Python中netschedule_tests_pack_4_10.execAny函数的典型用法代码示例。如果您正苦于以下问题:Python execAny函数的具体用法?Python execAny怎么用?Python execAny使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execAny函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: execute
def execute( self ):
" Should return True if the execution completed successfully "
self.fromScratch()
jobID1 = self.ns.submitJob( 'TEST', 'bla', '', '222', '', '' )
ns_client = self.getNetScheduleService( 'TEST', 'scenario1701' )
ns_client.set_client_identification( 'node', 'session' )
ns_client.on_warning = self.report_warning
j1 = self.ns.getJob( 'TEST' )
self.ns.putJob( 'TEST', j1[ 0 ], j1[ 1 ], 0 )
output = execAny( ns_client, 'READ2 reader_aff=0 any_aff=1 group=111,333' )
if output != "no_more_jobs=true":
raise Exception( "Expected no job, received some: " + output )
output = execAny( ns_client, 'READ2 reader_aff=0 any_aff=1 group=111,222' )
if output == "":
raise Exception( "Expected a job, got nothing" )
values = parse_qs( output, True, True )
receivedJobID = values[ 'job_key' ][ 0 ]
if receivedJobID != jobID1:
raise Exception( "Expected: " + jobID1 + ", got: " + output )
return True
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:25,代码来源:netschedule_tests_pack_4_19.py
示例2: execute
def execute( self ):
" Should return True if the execution completed successfully "
self.fromScratch()
jobID = self.ns.submitJob( 'TEST', 'bla', '', '', '', '' )
ns_client = self.getNetScheduleService( 'TEST', 'scenario301' )
output = execAny( ns_client, 'SST2 ' + jobID )
values = parse_qs( output, True, True )
if values[ 'job_status' ] != ['Pending'] or \
values.has_key( 'job_exptime' ) == False:
raise Exception( "Unexpected SST2 output" )
time1 = int( values[ 'job_exptime' ][ 0 ] )
time.sleep( 5 )
output = execAny( ns_client, 'SST2 ' + jobID )
values = parse_qs( output, True, True )
time2 = int( values[ 'job_exptime' ][ 0 ] )
if time2 - time1 < 3:
raise Exception( "SST2 does not change the job "
"expiration while it must" )
return True
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:26,代码来源:netschedule_tests_pack_4_11.py
示例3: execute
def execute( self ):
" Should return True if the execution completed successfully "
self.fromScratch( 4 )
# Client #2 plays a passive role of holding an affinity (a2)
ns_client2 = self.getNetScheduleService( 'TEST', 'scenario400' )
ns_client2.set_client_identification( 'node2', 'session2' )
changeAffinity( ns_client2, [ 'a2' ], [] )
jobID = self.ns.submitJob( 'TEST', 'bla', 'a2' )
ns_client1 = self.getNetScheduleService( 'TEST', 'scenario400' )
ns_client1.set_client_identification( 'node1', 'session1' )
changeAffinity( ns_client1, [ 'a1' ], [] )
output = execAny( ns_client1,
'GET2 wnode_aff=1 any_aff=0 exclusive_new_aff=1' )
if output != '':
raise Exception( "Expected no job, received: '" + output + "'" )
# 10 seconds till the job becomes obsolete
time.sleep( 12 )
output = execAny( ns_client1,
'GET2 wnode_aff=1 any_aff=0 exclusive_new_aff=1' )
if "job_key=" + jobID not in output:
raise Exception( "Expected a job, received: '" + output + "'" )
return True
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:29,代码来源:netschedule_tests_pack_4_13.py
示例4: execute
def execute( self ):
" Should return True if the execution completed successfully "
self.fromScratch()
jobID = self.ns.submitJob( 'TEST', 'bla' )
# Start listening
port = self.ns.getPort() + 2
sock = socket.socket( socket.AF_INET, # Internet
socket.SOCK_DGRAM ) # UDP
sock.bind( ( "" , port ) )
ns_client = self.getNetScheduleService( 'TEST', 'scenario502' )
ns_client.set_client_identification( 'mynode', 'mysession' )
execAny( ns_client, 'LISTEN ' + jobID + " " + str( port ) + " 30")
# Main job loop
jobID, authToken, attrs, jobInput = self.ns.getJob( "TEST", -1, '', '',
"node1", "session1" )
self.ns.returnJob( 'TEST', jobID, authToken )
jobID, authToken, attrs, jobInput = self.ns.getJob( "TEST", -1, '', '',
"node2", "session2" )
self.ns.putJob( 'TEST', jobID, authToken, 0, out = "my output" )
jobID, state, passport = self.ns.getJobsForReading2( 'TEST', -1, "",
'node3', 'session3' )
time.sleep( 15 )
# Receive from the socket
time.sleep( 3 )
notifications = ""
while True:
try:
data = sock.recv( 16384, socket.MSG_DONTWAIT )
if not data:
break
if len( notifications ) != 0:
notifications += "\n"
notifications += data
except:
break
if "job_status=Running&last_event_index=1" not in notifications:
raise Exception( "Did not receive job_status=Running&last_event_index=1" )
if "job_status=Pending&last_event_index=2" not in notifications:
raise Exception( "Did not receive job_status=Pending&last_event_index=2" )
if "job_status=Running&last_event_index=3" not in notifications:
raise Exception( "Did not receive job_status=Running&last_event_index=3" )
if "job_status=Done&last_event_index=4" not in notifications:
raise Exception( "Did not receive job_status=Done&last_event_index=4" )
if "job_status=Reading&last_event_index=5" not in notifications:
raise Exception( "Did not receive job_status=Reading&last_event_index=5" )
if "job_status=Done&last_event_index=6" not in notifications:
raise Exception( "Did not receive job_status=Done&last_event_index=6" )
return True
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:55,代码来源:netschedule_tests_pack_4_14.py
示例5: execute
def execute( self ):
" Should return True if the execution completed successfully "
self.fromScratch()
jobID = self.ns.submitJob( 'TEST', 'bla', 'a0' )
# First client holds a0 affinity
ns_client1 = self.getNetScheduleService( 'TEST', 'scenario308' )
ns_client1.set_client_identification( 'node1', 'session1' )
changeAffinity( ns_client1, [ 'a0' ], [] )
# Second client holds a100 affinity
ns_client2 = self.getNetScheduleService( 'TEST', 'scenario308' )
ns_client2.set_client_identification( 'node2', 'session2' )
changeAffinity( ns_client2, [ 'a100' ], [] )
# Socket to receive notifications
notifSocket = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
notifSocket.bind( ( "", 9007 ) )
# Second client tries to get the pending job - should get nothing
output = execAny( ns_client2,
'GET2 wnode_aff=1 any_aff=0 exclusive_new_aff=1 port=9007 timeout=3' )
if output != "":
raise Exception( "Expect no jobs, received: " + output )
time.sleep( 4 )
try:
# Exception is expected
data = notifSocket.recv( 8192, socket.MSG_DONTWAIT )
raise Exception( "Expected no notifications, received one: " + data )
except Exception, exc:
if "Resource temporarily unavailable" not in str( exc ):
raise
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:34,代码来源:netschedule_tests_pack_4_11.py
示例6: execute
def execute(self):
" Should return True if the execution completed successfully "
self.fromScratch()
jobID = self.ns.submitJob("TEST", "blah")
ns_client = self.getNetScheduleService("", "scenario702")
ns_client.set_client_identification("node1", "session1")
output = execAny(ns_client, "SST " + jobID)
if output != "0":
raise Exception("Unexpected job state")
# Try to submit a job without the queue
try:
output = execAny(ns_client, "SUBMIT blah")
except Exception, exc:
if "Job queue is required" in str(exc):
return True
raise
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:20,代码来源:netschedule_tests_pack_4_16.py
注:本文中的netschedule_tests_pack_4_10.execAny函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论