Files
SIA/action_schema.xsd
2024-10-27 10:35:05 +01:00

148 lines
6.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Root element containing a sequence of actions to be executed -->
<xs:element name="actions">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="start_container"/>
<xs:element ref="write_container_stdin"/>
<xs:element ref="read_container_stdout"/>
<xs:element ref="read_container_stderr"/>
<xs:element ref="wait_container"/>
<xs:element ref="set_model_path"/>
</xs:choice>
</xs:complexType>
</xs:element>
<!--
Start a new Docker container.
Containers can be started in two modes:
- Short-running containers:
These are started with a timeout.
Their output is visible in the next iteration.
- Long-running containers:
These are started with a name.
They are added to the container list.
Their output is queried using the read_container_stdout and read_container_stderr actions.
Either a name or a timeout must be specified.
-->
<xs:element name="start_container">
<xs:complexType>
<!-- Docker image to use -->
<xs:attribute name="image" type="xs:string" use="required"/>
<!-- Container name for long-running containers -->
<xs:attribute name="name" type="xs:string" use="optional"/>
<!-- Timeout in milliseconds for short-running containers -->
<xs:attribute name="timeout" type="xs:integer" use="optional"/>
<xs:sequence>
<!-- Main command to run in container -->
<xs:element name="command" type="xs:string" minOccurs="0"/>
<!-- Command line arguments to the main command -->
<xs:element name="argument" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<!-- Volume mappings from host to container -->
<xs:element name="volumes" minOccurs="0">
<xs:complexType>
<xs:sequence>
<!--
Each volume maps host path to container path.
Syntax similar to -v switch of docker run command.
using : separator and optional :ro flag.
-->
<xs:element name="volume" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Port mappings from host to container -->
<xs:element name="ports" minOccurs="0">
<xs:complexType>
<xs:sequence>
<!-- Each port maps a host port to a container port -->
<xs:element name="port" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="host" type="xs:string" use="required"/>
<xs:attribute name="container" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Environment variables to set in the container -->
<xs:element name="environment" minOccurs="0">
<xs:complexType>
<xs:sequence>
<!-- Each variable has a name and value -->
<xs:element name="variable" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Write data to a container's standard input -->
<xs:element name="write_container_stdin">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<!-- Name of the target container -->
<xs:attribute name="container" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- Read from a container's standard output buffer -->
<xs:element name="read_container_stdout">
<xs:complexType>
<!-- Name of the container to read from -->
<xs:attribute name="container" type="xs:string" use="required"/>
<!-- Optional number of bytes to read (-1 for all available) -->
<xs:attribute name="n" type="xs:integer" use="optional"/>
</xs:complexType>
</xs:element>
<!-- Read from a container's standard error buffer -->
<xs:element name="read_container_stderr">
<xs:complexType>
<!-- Name of the container to read from -->
<xs:attribute name="container" type="xs:string" use="required"/>
<!-- Optional number of bytes to read (-1 for all available) -->
<xs:attribute name="n" type="xs:integer" use="optional"/>
</xs:complexType>
</xs:element>
<!--
Wait for a container to finish execution.
Standard output and standard error are merged and visible in the next iteration.
-->
<xs:element name="wait_container">
<xs:complexType>
<!-- Name of the container to wait for -->
<xs:attribute name="name" type="xs:string" use="required"/>
<!-- Maximum time to wait in milliseconds -->
<xs:attribute name="timeout" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
<!-- Switch to a different LLM model file -->
<xs:element name="set_model_path">
<xs:complexType>
<xs:simpleContent>
<!-- Path to the model file to load -->
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>