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 Details

  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • loadClassicConfigurationDefinition

      public Configuration loadClassicConfigurationDefinition​(File definitionFile, boolean doCd)
      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

      public void validate​(Configuration config)
      Validate a configuration, writing failures to System.err.
      Parameters:
      config - The configuration to validate.
    • getJsonWriter

      protected static ObjectWriter getJsonWriter()
      How we write JSON.
      Returns:
      A service for writing objects as JSON.
    • main

      public static void main​(String... args) throws Exception
      Main entry point.
      Parameters:
      args - Takes two arguments: <source.py> and <target.json>.
      Throws:
      Exception - If things go wrong