How to start a waveform from a python script, if a component is run on two different architectures?
Question: I had asked an earlier question on how to create and run the same component on
different architecture, [Same component run on 2 different
GPPs](http://stackoverflow.com/questions/22390340/same-component-
on-2-different-gpps). The IDE can create a component that can run on two
different architectures via the implementation tab. When you launch the
waveform, you have the option to specify a particular GPP for a component
instance.

How would you do the same thing when you are not launching the waveform from
the IDE? I currently launch waveforms from a python script.


Answer: You can accomplish this by passing a `DeviceAssignmentSequence` as the third
argument to the `ApplicationFactory::create()` call.

Each member of the sequence is a `DeviceAssignmentType` that takes two string
parameters. The first is the Component's `usagename` as it appears in the SAD
file. The second is the identifier for the Device that you would like to
deploy your Component to.

An example:

    
    
    from ossie.utils import redhawk
    from ossie.cf import CF
    dom = redhawk.attach("REDHAWK_DEV")
    
    # Find the devices
    for devMgr in dom.devMgrs:
        # Check the name of  Device Manager
        if devMgr.name == 'DEV_MGR1':
            # Find the GPP
            for dev in devMgr.devs:
                if dev.name == 'GPP'
                    dev1 = dev
        elif devMgr.name == 'DEV_MGR2':
            # Find the GPP
            for dev in devMgr.devs:
                if dev.name == 'GPP'
                    dev2 = dev
    
    # Create the deployment requirements
    # First variable is comp name as it appears in the SAD file, second is device ID
    assignment1 = CF.DeviceAssignmentType('comp_1', dev1._get_identifier())
    assignment2 = CF.DeviceAssignmentType('comp_2', dev2._get_identifier())
    
    # Install the Application Factory
    dom.installApplicationFactory('/waveforms/app_name/app_name.sad.xml')
    
    # Get the Application Factory
    facs = dom._get_applicationFactories()
    # If using multiple, different Applications, this list needs to be iterated
    # to get the correct factory
    app_fac = facs[0]
    
    # Create the Application
    app = app_fac.create(app_fac._get_name(), [], [assignment1, assignment2])
    
    # Uninstall the Application Factory
    dom.uninstallApplication(app_fac._get_identifier())
    

