** System operation
-- Implement CPU nice priority for inference processes to minimize the
- impact on system responsiveness during heavy computations.
-
- Enable model selection per individual inference task, allowing for
dynamic adjustment based on task requirements.
*/
private String getCliCommand() {
+ int niceValue = 10; // Set the desired niceness level (10 is a common value for background tasks)
+
return join(" ",
+ "nice", "-n", Integer.toString(niceValue),
configuration.getLlamaCppExecutablePath().getAbsolutePath(),
"--model " + model.filesystemPath,
"--threads " + configuration.getThreadCount(),
import eu.svjatoslav.alyverkko_cli.commands.JoinFilesCommand;
import eu.svjatoslav.alyverkko_cli.commands.ListModelsCommand;
+import eu.svjatoslav.alyverkko_cli.commands.SelftestCommand;
import eu.svjatoslav.alyverkko_cli.configuration.Configuration;
import eu.svjatoslav.alyverkko_cli.commands.MailCorrespondentCommand;
private final java.util.List<Command> commands = java.util.Arrays.asList(
new ListModelsCommand(),
new MailCorrespondentCommand(),
- new JoinFilesCommand()
+ new JoinFilesCommand(),
+ new SelftestCommand()
);
public static void main(final String[] args) throws IOException, InterruptedException {
--- /dev/null
+package eu.svjatoslav.alyverkko_cli.commands;
+
+import eu.svjatoslav.alyverkko_cli.Command;
+import eu.svjatoslav.alyverkko_cli.Main;
+
+import java.io.IOException;
+
+import static eu.svjatoslav.alyverkko_cli.Main.configuration;
+import static eu.svjatoslav.alyverkko_cli.configuration.Configuration.loadConfiguration;
+
+public class SelftestCommand implements Command {
+
+ @Override
+ public String getName() {
+ return "selftest";
+ }
+
+ @Override
+ public void execute(String[] cliArguments) throws IOException {
+ // Perform selftest checks here
+ System.out.println("Starting selftest...");
+
+ configuration = loadConfiguration();
+
+ // Check if the configuration is loaded
+ if (Main.configuration == null) {
+ System.err.println("Configuration not found or invalid.");
+ return;
+ }
+
+ // Validate models directory
+ if (!Main.configuration.getModelsDirectory().exists() || !Main.configuration.getModelsDirectory().isDirectory()) {
+ System.err.println("Models directory does not exist or is not a directory: " + Main.configuration.getModelsDirectory());
+ return;
+ }
+
+ // Validate llama.cpp executable path
+ if (!Main.configuration.getLlamaCppExecutablePath().exists() || !Main.configuration.getLlamaCppExecutablePath().isFile()) {
+ System.err.println("llama.cpp executable not found at: " + Main.configuration.getLlamaCppExecutablePath());
+ return;
+ }
+
+ // Additional checks like model file existence, etc., can be added here
+
+ System.out.println("Selftest completed successfully.");
+ }
+}