Automatic wrapper for executables with Graphical User Interface

The DiscFromExe wrapper

This section describes how to use DiscFromExe. The input and output template files can be edited using the dedicated GUI, see next section.

class gemseo.wrappers.disc_from_exe.DiscFromExe(input_template, output_template, output_folder_basepath, executable_command, input_filename, output_filename, folders_iter='numbered', name=None, parse_outfile_method='TEMPLATE_PARSER', write_input_file_method=None, parse_out_separator='=')[source]

Generic wrapper for executables.

The DiscFromExe is a generic wrapper for executables. It generates a MDODiscipline from an executable and in inputs/output files wrappers. The input and output files are described by templates. The templates can be generated by executing the module template_grammar_editor to open a GUI.

It requires the creation of templates for input and output file, for instance, from the following input JSON file:

"a": 1.01515112125,
"b": 2.00151511213,
"c": 3.00151511213

A template that declares the inputs must be generated under this format, where “a” is the name of the input, and “1.0” is the default input. GEMSEO_INPUT declares an input, GEMSEO_OUTPUT declares an output, similarly.

"a": GEMSEO_INPUT{a::1.0},
"b": GEMSEO_INPUT{b::2.0},
"c": GEMSEO_INPUT{c::3.0}

Current limitations :

Only one input and one output file, otherwise, inherit from this class and modify the parsers. Only limited input writing and output parser strategies are implemented. To change that, you can pass custom parsing and writing methods to the constructor.

The only limitation in the current file format is that it must be a plain text file and not a binary file. In this case, the way of interfacing it is to provide a specific parser to the DiscFromExe, with the write_input_file_method and parse_outfile_method arguments of the constructor.


Create the discipline from the inputs, outputs wrapper and the executable command.

  • input_template (str) – path to the input file template. The input locations in the file are marked by GEMSEO_INPUT{input_name::1.0}, where “input_name” is the input name, and 1.0 is here the default input

  • output_template (str) – path to the output file template. The input locations in the file are marked by GEMSEO_OUTPUT{output_name::1.0}, where “output_name” is the input name

  • output_folder_basepath (str) – path to the output folder, in which the executions will be performed

  • executable_command (str) – command to run the executable. Will be called through a system call. Example: “python -i input.txt -o output.txt

  • input_filename (str) – name of the input file. This will determine the name of the input file generated in the output folder. Example “input.txt”

  • output_filename (str) – name of the output file. This will determine the name of the output file generated in the output folder. Example “output.txt”

  • folders_iter (str) – type of unique identifiers for the output folders. If NUMBERED the generated output folders will be “output_folder_basepath”+str(i+1), where i is the maximum value of the already existing “output_folder_basepath”+str(i) folders. Otherwise, a unique number based on the UUID function is generated. This last option shall be used if multiple MDO processes are runned in the same work directory.

  • parse_outfile_method (str) – optional method that can be provided by the user to parse the output file. To see the signature of the method, see the parse_outfile method of this file.

  • parse_out_separator (str) – if the KEY_VALUE_PARSER is used as output parser, specify the separator key (default : “=”).

  • write_input_file_method (str) – method to write the input file, if None, use this modules’ write_input_file. To see the signature of the method, see the write_input_file method of this file.

Inputs and outputs files template edition GUI

class gemseo.wrappers.template_grammar_editor.QtTemplateEditor(in_sep='GEMSEO_INPUT', out_sep='GEMSEO_OUTPUT')[source]

GUI template generator.

GUI to generate templates for input and output files edition Input text file data is replaced by a mark that specifies where to read the data. idem for outputs. Works with any text file format.

To open the GUI, run this python file

Example, for an input json file : { “a”: 1.01515112125, “b”: 2.00151511213, “c”: 3.00151511213 }

Generates a template : { “a”: GEMSEO_INPUT{a::1.0}, “b”: GEMSEO_INPUT{b::2.0}, “c”: GEMSEO_INPUT{c::3.0} }

Same for outputs.

Constructor :

  • in_sep – separator name for the input tag, default GEMSEO_INPUT

  • out_sep – separator name for the output tag, default GEMSEO_OUTPUT

The following screenshots detail the steps to create the templates from the reference input file.


Open a reference input file


Select the input and press the Input button (Ctrl+I) to generate the template tag


Enter the input name


The GUI highlights the inputs that ae tagged in the template


The user saves the input template (Ctrl+S)


Same for the outputs, shortcut (Ctrl+O)