当前位置: 首页>>代码示例>>Python>>正文


Python Stage.post_exec方法代码示例

本文整理汇总了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()
开发者ID:radical-cybertools,项目名称:radical.ensemblemd,代码行数:30,代码来源:test_post_exec.py

示例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
开发者ID:radical-cybertools,项目名称:radical.ensemblemd,代码行数:51,代码来源:adapt_to.py

示例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)
开发者ID:radical-cybertools,项目名称:radical.ensemblemd,代码行数:17,代码来源:test_post_exec.py

示例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
开发者ID:radical-cybertools,项目名称:radical.ensemblemd,代码行数:26,代码来源:test_stage.py

示例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
开发者ID:radical-cybertools,项目名称:radical.ensemblemd,代码行数:45,代码来源:suspend_pipelines.py

示例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)
开发者ID:radical-cybertools,项目名称:radical.ensemblemd,代码行数:25,代码来源:adapt_tc.py

示例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
开发者ID:radical-cybertools,项目名称:radical.ensemblemd,代码行数:66,代码来源:adapt_tc.py


注:本文中的radical.entk.Stage.post_exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。