Skip to content

Commit

Permalink
Begin of Scheduling Configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
amengus87 committed May 27, 2024
1 parent 0256ee3 commit a6c20d3
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
1 change: 0 additions & 1 deletion backend/src/main/java/ai/dragon/config/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
@Configuration
@EnableConfigurationProperties(DataProperties.class)
public class AppConfig {

}
20 changes: 20 additions & 0 deletions backend/src/main/java/ai/dragon/config/AsyncConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ai.dragon.config;

import java.util.concurrent.Executor;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

@Configurable
@EnableAsync
public class AsyncConfig {
@Bean
public Executor threadPoolTaskExecutor() {
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setMaxPoolSize(10);

return threadPoolTaskExecutor;
}
}
25 changes: 25 additions & 0 deletions backend/src/main/java/ai/dragon/config/SchedulingConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package ai.dragon.config;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

@Configuration
@EnableScheduling
public class SchedulingConfig implements SchedulingConfigurer {
@Override
public void configureTasks(@NonNull ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.setScheduler(taskExecutor());
}

@Bean(destroyMethod = "shutdown")
public Executor taskExecutor() {
return Executors.newScheduledThreadPool(10);
}
}
4 changes: 2 additions & 2 deletions backend/src/main/java/ai/dragon/entity/SiloEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public class SiloEntity implements IAbstractEntity {
private String name;

@NotNull
@Schema(description = "Java Class to be used for the Vector Store")
@Schema(description = "Java Class to be used for the Vector Store", example = "dev.langchain4j.store.embedding.inmemory.InMemoryEmbeddingStore")
private String vectorStoreClass;

@NotNull
@Schema(description = "Java Class to be used for the Embedding Model")
@Schema(description = "Java Class to be used for the Embedding Model", example = "dev.langchain4j.model.embedding.bge.small.en.v15.BgeSmallEnV15QuantizedEmbeddingModel")
private String embeddingModelClass;

public SiloEntity() {
Expand Down

0 comments on commit a6c20d3

Please sign in to comment.