Skip to content

JSON spawner#101

Merged
mtinning merged 13 commits intomasterfrom
json-spawner
Dec 12, 2019
Merged

JSON spawner#101
mtinning merged 13 commits intomasterfrom
json-spawner

Conversation

@phil-brad
Copy link
Member

Creating an inbuilt JSON plugin which uses:

  • SingleInputFileSpawner which is a simple spawner, spawning tasks that take one input file as argument. Sets attributes through a SimulationInput object
  • A JsonSimulationInput object which sets items into a dictionary and writes to a JSON file.
    The JSON plugin creates a SingleInputFileSpawner which uses a JsonSimulationInput.

Change to SimulationTask so that in case the _exe_path is empty, simulations are not run (but a spawner will still do preceding actions such as writing input files.

@phil-brad phil-brad requested a review from mtinning October 31, 2019 02:24
from ..simulation_inputs import JsonSimulationInput


def create_spawner(task_exe, working_dir, base_file, runner_type):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't written a unit test for this. I don't know if you have any recommended ways of testing it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a unit test, you could:

  • patch configuration.get_config() with a mock object and check that the configration parameters are set correctly
  • check that the parameters you pass from the input file are accessible from the returned spawner

from ..simulation_inputs import JsonSimulationInput


def create_spawner(task_exe, working_dir, base_file, runner_type):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a unit test, you could:

  • patch configuration.get_config() with a mock object and check that the configration parameters are set correctly
  • check that the parameters you pass from the input file are accessible from the returned spawner

@phil-brad
Copy link
Member Author

Test for JSON plugin added

@mtinning mtinning merged commit 74d2215 into master Dec 12, 2019
@phil-brad phil-brad deleted the json-spawner branch December 17, 2019 19:00
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

Successfully merging this pull request may close these issues.

2 participants