Skip to content

help needed in converting a hack to a proper implementation for coupling easyvvuq and muscle3 #397

Description

@DavidPCoster

At the recent SEAVEA hackathon, I managed to generate samples using EasyVVUQ and then send them to be executed via MUSCLE3. To do this, the EasyVVUQ component was implemented as a component in a MUSCLE3 workflow.
fusion_easyvvuq
But to do this I needed to extract the cases from the EasyVVUQ database, send them using MUSCLE3, and then add the results after completion.

My hack at the moment involves setting a null action

actions = uq.actions.Actions()

and then putting the following block into my code

while instance.reuse_instance():
    # configure output port
    if not instance.is_resizable('parameters_out'):
        instance.error_shutdown(
                'This component needs a resizable parameters_out port, but'
                ' it is connected to something that cannot be resized.'
                ' Maybe try adding a load balancer.')
        exit(1)

    instance.set_port_length('parameters_out', my_campaign.get_active_sampler().count)

    # run ensemble

    Results = []
    # O_I
    for sample, case in enumerate(my_campaign.list_runs()):
        uq_parameters = case[1]['params']
        del uq_parameters['out_file']
        for k in uq_parameters.keys():
            uq_parameters[k] = eval("%s(%s)" % (params[k]["type"], uq_parameters[k]))
        msg = Message(0.0, data=Settings(uq_parameters))
        instance.send('parameters_out', msg, sample)
    # S
    for sample, case in enumerate(my_campaign.list_runs()):
        msg = instance.receive_with_settings('states_in', sample)
        case[1]['result'] = {k: list(v.array) for k, v in msg.data.items()}
        case[1]['rundir'] = None
        case[1]['run_info'] = {'run_dir': None}
        my_campaign.campaign_db.store_result(case[0], case[1])

It works but I would like to see a more elegant solution!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions