Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DavidPCoster opened this issue Jun 30, 2023 · 0 comments

Comments

@DavidPCoster
Copy link
Collaborator

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant