materialsproject / fireworks

The Fireworks Workflow Management Repo.
https://materialsproject.github.io/fireworks
Other
361 stars 185 forks source link

Enable launchpad and fireworker config be passed via json string #499

Open JBlaschke opened 1 year ago

JBlaschke commented 1 year ago

This is a relatively simple addition to the rlaunch CLI tool: When --json is provided, then the inputs to -l and -w are JSON-formatted strings. This is mainly to allow for LaunchPad and FWorker to be specified in a python script, without having to generate these files first.

An example workflow can be found here: https://github.com/JBlaschke/alcc-recipes/blob/jpb/fireworks/fireworks/test_3_python/fw.py#L26 where a python script manages a 2-node and a 4-node slurm job. In this case fworker_1, and fworker_2 need to be passed to the slurm script in addition to launchpad. With the addition of a --json flag, this can be handled from the command line without needing to manage additional files.

Tagging @lastephey and @computron

computron commented 1 year ago

Thanks! But I see a typo:

launchpad_generator = lambda x: LaunchPad.form_file(x)

Can you fix and also run through the confirm the previous options are working correctly after the changes?

JBlaschke commented 1 year ago

@computron thanks for catching that! Fixed.

janosh commented 1 year ago

@JBlaschke Could you add a test for this?