Class MachineDefinitionConverter
java.lang.Object
uk.ac.manchester.spinnaker.py2json.MachineDefinitionConverter
- All Implemented Interfaces:
AutoCloseable
public class MachineDefinitionConverter extends Object implements AutoCloseable
Converts Python configurations for classic Spalloc Server into JSON
descriptions.
- Author:
- Donal Fellows
-
Constructor Summary
Constructors Constructor Description MachineDefinitionConverter()
Create a converter. -
Method Summary
Modifier and Type Method Description void
close()
protected static ObjectWriter
getJsonWriter()
How we write JSON.Configuration
loadClassicConfigurationDefinition(File definitionFile, boolean doCd)
Get the configuration from a Python file.static void
main(String... args)
Main entry point.void
validate(Configuration config)
Validate a configuration, writing failures toSystem.err
.
-
Constructor Details
-
MachineDefinitionConverter
Create a converter.
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
loadClassicConfigurationDefinition
Get the configuration from a Python file.WARNING! This changes the current working directory of the process (if
doCd
is 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
-