本文整理汇总了Python中radical.entk.Stage.post_exec方法的典型用法代码示例。如果您正苦于以下问题:Python Stage.post_exec方法的具体用法?Python Stage.post_exec怎么用?Python Stage.post_exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类radical.entk.Stage
的用法示例。
在下文中一共展示了Stage.post_exec方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stage_post_exec
# 需要导入模块: from radical.entk import Stage [as 别名]
# 或者: from radical.entk.Stage import post_exec [as 别名]
def test_stage_post_exec():
global p1
p1.name = 'p1'
s = Stage()
s.name = 's1'
for t in range(NUM_TASKS):
s.add_tasks(create_single_task())
s.post_exec = condition
p1.add_stages(s)
res_dict = {
'resource': 'local.localhost',
'walltime': 30,
'cpus': 1,
}
os.environ['RADICAL_PILOT_DBURL'] = MLAB
appman = AppManager(rts='radical.pilot', hostname=hostname, port=port)
appman.resource_desc = res_dict
appman.workflow = [p1]
appman.run()
示例2: generate_pipeline
# 需要导入模块: from radical.entk import Stage [as 别名]
# 或者: from radical.entk.Stage import post_exec [as 别名]
def generate_pipeline():
def func_condition():
global CUR_NEW_STAGE, MAX_NEW_STAGE
if CUR_NEW_STAGE <= MAX_NEW_STAGE:
return True
return False
def func_on_true():
global CUR_NEW_STAGE
CUR_NEW_STAGE += 1
shuffle(p.stages[CUR_NEW_STAGE:])
def func_on_false():
print 'Done'
# Create a Pipeline object
p = Pipeline()
for s in range(MAX_NEW_STAGE+1):
# Create a Stage object
s1 = Stage()
for i in range(CUR_TASKS):
t1 = Task()
t1.executable = '/bin/sleep'
t1.arguments = [ '30']
# Add the Task to the Stage
s1.add_tasks(t1)
# Add post-exec to the Stage
s1.post_exec = {
condition': func_condition,
on_true': func_on_true,
on_false': func_on_false
}
# Add Stage to the Pipeline
p.add_stages(s1)
return p
示例3: on_true
# 需要导入模块: from radical.entk import Stage [as 别名]
# 或者: from radical.entk.Stage import post_exec [as 别名]
def on_true():
global NUM_TASKS, CUR_STAGE
NUM_TASKS *= 2
s = Stage()
s.name = 's%s'%CUR_STAGE
for t in range(NUM_TASKS):
s.add_tasks(create_single_task())
s.post_exec = condition
p1.add_stages(s)
示例4: test_stage_post_exec_assignment
# 需要导入模块: from radical.entk import Stage [as 别名]
# 或者: from radical.entk.Stage import post_exec [as 别名]
def test_stage_post_exec_assignment(l, d):
s = Stage()
def func():
return True
with pytest.raises(TypeError):
s.post_exec = l
with pytest.raises(TypeError):
s.post_exec = d
s.post_exec = func
class Tmp(object):
def func(self):
return True
tmp = Tmp()
s.post_exec = tmp.func
示例5: generate_pipeline
# 需要导入模块: from radical.entk import Stage [as 别名]
# 或者: from radical.entk.Stage import post_exec [as 别名]
def generate_pipeline():
def func_condition():
p.suspend()
print 'Suspending pipeline %s for 10 seconds' %p.uid
sleep(10)
return True
def func_on_true():
print 'Resuming pipeline %s' %p.uid
p.resume()
def func_on_false():
pass
# Create a Pipeline object
p = Pipeline()
# Create a Stage object
s1 = Stage()
for i in range(10):
t1 = Task()
t1.executable = '/bin/sleep'
t1.arguments = ['30']
# Add the Task to the Stage
s1.add_tasks(t1)
# Add post-exec to the Stage
s1.post_exec = {
'condition': func_condition,
'on_true': func_on_true,
'on_false': func_on_false
}
# Add Stage to the Pipeline
p.add_stages(s1)
return p
示例6: func_on_true
# 需要导入模块: from radical.entk import Stage [as 别名]
# 或者: from radical.entk.Stage import post_exec [as 别名]
def func_on_true():
global CUR_NEW_STAGE
CUR_NEW_STAGE += 1
s = Stage()
for i in range(10):
t = Task()
t.executable = '/bin/sleep'
t.arguments = [ '30']
s.add_tasks(t)
# Add post-exec to the Stage
s.post_exec = {
'condition': func_condition,
'on_true': func_on_true,
'on_false': func_on_false
}
p.add_stages(s)
示例7: generate_pipeline
# 需要导入模块: from radical.entk import Stage [as 别名]
# 或者: from radical.entk.Stage import post_exec [as 别名]
def generate_pipeline():
def func_condition():
global CUR_NEW_STAGE, MAX_NEW_STAGE
if CUR_NEW_STAGE <= MAX_NEW_STAGE:
return True
return False
def func_on_true():
global CUR_NEW_STAGE
CUR_NEW_STAGE += 1
s = Stage()
for i in range(10):
t = Task()
t.executable = '/bin/sleep'
t.arguments = [ '30']
s.add_tasks(t)
# Add post-exec to the Stage
s.post_exec = {
'condition': func_condition,
'on_true': func_on_true,
'on_false': func_on_false
}
p.add_stages(s)
def func_on_false():
print 'Done'
# Create a Pipeline object
p = Pipeline()
# Create a Stage object
s1 = Stage()
for i in range(10):
t1 = Task()
t1.executable = ['sleep']
t1.arguments = [ '30']
# Add the Task to the Stage
s1.add_tasks(t1)
# Add post-exec to the Stage
s1.post_exec = {
'condition': func_condition,
'on_true': func_on_true,
'on_false': func_on_false
}
# Add Stage to the Pipeline
p.add_stages(s1)
return p