<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <parent>
    <artifactId>juno</artifactId>
    <groupId>cab.ml</groupId>
    <version>0.1.0</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>juno-master</artifactId>
  <name>juno-master</name>
  <description>Juno-master standalone coordinator entry point.
		Full-cluster tests.

		Two test flavours:
		InProcessClusterIT — 3 CyclicForwardPassHandlers chained via
		LocalInferencePipeline,
		single JVM, zero network, fast feedback loop.
		ThreeNodeClusterIT — 3 real JVM node processes launched via
		ProcessBuilder,
		each on a separate gRPC port, connected by a
		ProcessPipelineClient that wires the coordinator to them.
		ModelLiveRunnerIT — live model tests across all models listed in the
		MODELS system property. Disabled by default; activate with
		-Pintegration.

		Main class: CoordinatorMain — standalone distributed coordinator for
		AWS deployment. Replaces juno-player.jar in the coordinator systemd
		service.

		Recommended model for real-weight testing (no GPU required for stubs):
		TinyLlama-1.1B-Chat-v1.0.Q4_K_M.gguf ~670 MB
		vocab_size=32000 hidden_dim=2048 layers=22 heads=32
		All 22 layers fit in one node; split 8/7/7 across three.
		Download: https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF
		Memory budget (16 GB host):
		3 node JVMs × -Xmx4g = 12 GB
		1 coordinator JVM -Xmx2g = 2 GB
		OS + JVM overhead = 2 GB
		Total = 16 GB ✓</description>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <argLine>--enable-preview --enable-native-access=ALL-UNNAMED</argLine>
          <forkCount>1</forkCount>
          <reuseForks>false</reuseForks>
          <excludes>
            <exclude>**/GpuForwardPassIT.java</exclude>
            <exclude>**/ModelLiveRunnerIT.java</exclude>
          </excludes>
          <systemPropertyVariables>
            <it.model.path>${it.model.path}</it.model.path>
            <it.timeout.ms>120000</it.timeout.ms>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.5.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer>
                  <mainClass>cab.ml.juno.master.CoordinatorMain</mainClass>
                </transformer>
                <transformer />
              </transformers>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>module-info.class</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
              <finalName>juno-master</finalName>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>3.3.0</version>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>gpu</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <argLine>--enable-preview
								--enable-native-access=ALL-UNNAMED</argLine>
              <forkCount>1</forkCount>
              <reuseForks>false</reuseForks>
              <excludes />
              <includes>
                <include>**/GpuForwardPassIT.java</include>
              </includes>
              <systemPropertyVariables>
                <it.model.path>${it.model.path}</it.model.path>
                <it.timeout.ms>120000</it.timeout.ms>
                <juno.gpu.test>true</juno.gpu.test>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>integration</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <argLine>--enable-preview
								--enable-native-access=ALL-UNNAMED</argLine>
              <forkCount>1</forkCount>
              <reuseForks>false</reuseForks>
              <excludes />
              <includes>
                <include>**/ModelLiveRunnerIT.java</include>
              </includes>
              <systemPropertyVariables>
                <MODELS>${MODELS}</MODELS>
                <it.timeout.ms>300000</it.timeout.ms>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <dependencies>
    <dependency>
      <groupId>cab.ml</groupId>
      <artifactId>node</artifactId>
      <version>0.1.0</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.10.2</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>junit-jupiter-api</artifactId>
          <groupId>org.junit.jupiter</groupId>
        </exclusion>
        <exclusion>
          <artifactId>junit-jupiter-params</artifactId>
          <groupId>org.junit.jupiter</groupId>
        </exclusion>
        <exclusion>
          <artifactId>junit-jupiter-engine</artifactId>
          <groupId>org.junit.jupiter</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>5.12.0</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>byte-buddy</artifactId>
          <groupId>net.bytebuddy</groupId>
        </exclusion>
        <exclusion>
          <artifactId>byte-buddy-agent</artifactId>
          <groupId>net.bytebuddy</groupId>
        </exclusion>
        <exclusion>
          <artifactId>objenesis</artifactId>
          <groupId>org.objenesis</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.26.0</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>byte-buddy</artifactId>
          <groupId>net.bytebuddy</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
</project>
