Did I find the right examples for you? yes no

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Execute the given workload -- i.e., translate, bind and dispatch it, and
then wait until its execution is completed.  For that to happen, we also
need to plan, translate, schedule and dispatch an overlay, obviously...

        def execute_workload (workload, planner, overlay_mgr, workload_mgr, 
                      strategy=troy.AUTOMATIC) : 

    """
    Execute the given workload -- i.e., translate, bind and dispatch it, and
    then wait until its execution is completed.  For that to happen, we also
    need to plan, translate, schedule and dispatch an overlay, obviously...
    """

    if  strategy == troy.AUTOMATIC :

        if  'plugin_strategy' in workload.session.cfg :
            strategy = workload.session.cfg['plugin_strategy']
        else :
            strategy =  'basic_late_binding'

    plugin_mgr = ru.PluginManager ('troy')
    strategy   = plugin_mgr.load  ('strategy', strategy)

    if  not strategy  : 
        raise RuntimeError ("Could not load troy strategy plugin")

    # for initialization, we re-use the planner session
    strategy.init_plugin (planner.session, 'strategy')

    # this method accepts workloads and workload IDs
    if  isinstance   (workload, basestring) :
        workload_id = workload
    elif isinstance  (workload, troy.Workload) :
        workload_id = workload.id
    else :
        raise TypeError ("strategy apply to troy workloads, not to %s" \
                      % type(workload))

    # hand over control the selected strategy plugin, 
    # so it can do what it has to do.
    strategy.execute (workload_id, planner, overlay_mgr, workload_mgr)
        


src/t/r/troy-0.0.3/bin/owms.py   troy(Download)
 
    workload_id = workload_manager.create_workload(task_descriptions)
    troy.execute_workload(workload_id, planner, overlay_manager,
        workload_manager, strategy=args.troy_strategy)
 

src/t/r/troy-0.0.3/troy/strategy.py   troy(Download)
    parsed_workload = workload_mgr.parse_workload (workload)
 
    return troy.execute_workload (parsed_workload, planner, 
                                  overlay_mgr, workload_mgr,
                                  strategy)