Class MachineDefinitionConverter
java.lang.Object
uk.ac.manchester.spinnaker.py2json.MachineDefinitionConverter
- All Implemented Interfaces:
AutoCloseable
Converts Python configurations for classic Spalloc Server into JSON
descriptions.
- Author:
- Donal Fellows
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected static ObjectWriterHow we write JSON.loadClassicConfigurationDefinition(File definitionFile, boolean doCd) Get the configuration from a Python file.static voidMain entry point.voidvalidate(Configuration config) Validate a configuration, writing failures toSystem.err.
-
Constructor Details
-
MachineDefinitionConverter
Create a converter.
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
loadClassicConfigurationDefinition
Get the configuration from a Python file.WARNING! This changes the current working directory of the process (if
doCdis true).- Parameters:
definitionFile- The file to load from.doCd- Whether to force the change of the working directory for the duration. Some scripts (especially test cases) need this.- Returns:
- The converted configuration.
-
validate
Validate a configuration, writing failures toSystem.err.- Parameters:
config- The configuration to validate.
-
getJsonWriter
How we write JSON.- Returns:
- A service for writing objects as JSON.
-
main
Main entry point.- Parameters:
args- Takes two arguments:<source.py>and<target.json>.- Throws:
Exception- If things go wrong
-