rasa 训练和启动接口开发
parent
362d33d93d
commit
76170c8a41
@ -0,0 +1,28 @@
|
||||
package com.superversion.rasa.config;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class ThreadPoolExecutorConfig {
|
||||
|
||||
private volatile static ThreadPoolExecutor instance = null;
|
||||
|
||||
private ThreadPoolExecutorConfig(){}
|
||||
|
||||
|
||||
public static ThreadPoolExecutor getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (ThreadPoolExecutorConfig.class) { // 加锁
|
||||
if (instance == null) {
|
||||
int corePoolSize = 5;
|
||||
int maximumPoolSize = 10;
|
||||
long keepAliveTime = 100;
|
||||
BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(20);
|
||||
RejectedExecutionHandler rejectedExecutionHandler = new ThreadPoolExecutor.AbortPolicy();
|
||||
instance = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.SECONDS, workQueue, rejectedExecutionHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.superversion.rasa.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RasaArgument {
|
||||
|
||||
private String config;
|
||||
private String data;
|
||||
private String domain;
|
||||
private String out;
|
||||
private String fixedModelName;//fixed-model-name
|
||||
private String enableApi;//enable-api
|
||||
private String endpoints;
|
||||
private String port;
|
||||
|
||||
}
|
@ -1,4 +1,14 @@
|
||||
package com.superversion.rasa.service;
|
||||
|
||||
import com.superversion.rasa.pojo.vo.RasaArgument;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public interface RasaCmdService {
|
||||
|
||||
String trainExec(RasaArgument argument) throws IOException, ExecutionException, InterruptedException, TimeoutException;
|
||||
|
||||
String runExec( RasaArgument argument) throws ExecutionException, InterruptedException, TimeoutException;
|
||||
}
|
||||
|
Loading…
Reference in New Issue