Skip to content

Commit

Permalink
Issue #3619: Migrate runs to archive table according to user/group co…
Browse files Browse the repository at this point in the history
…nfiguration - introduce common background jobs executor
  • Loading branch information
ekazachkova committed Aug 12, 2024
1 parent 65902b6 commit 11b4de1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/profiles/dev/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ scheduled.quartz.db.driverDelegateClass=${CP_API_SCHEDULING_QUARTZ_DATABASE_DRIV
scheduled.notifications.cleanup.sec=${CP_API_SCHEDULED_NOTIFICATIONS_CLEANUP:86400}

run.as.pool.size=5
run.archive.pool.size=${CP_API_RUN_ARCHIVE_POOL_SIZE:5}
background.api.jobs.pool.size=${CP_API_BACKGROUND_JOBS_POOL_SIZE:10}

#luigi
kube.namespace=default
Expand Down
9 changes: 5 additions & 4 deletions api/src/main/java/com/epam/pipeline/app/AppConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public class AppConfiguration implements SchedulingConfigurer {
@Value("${pause.pool.size:10}")
private int pausePoolSize;

@Value("${run.archive.pool.size:10}")
private int archiveRunPoolSize;
@Value("${background.api.jobs.pool.size:10}")
private int backgroundJobsPoolSize;

@Value("${run.as.pool.size:5}")
private int runAsPoolSize;
Expand Down Expand Up @@ -180,8 +180,9 @@ public Executor pauseRunExecutor() {
}

@Bean
public Executor archiveRunExecutor() {
return new DelegatingSecurityContextExecutor(getThreadPoolTaskExecutor("ArchiveRun", archiveRunPoolSize));
public Executor backgroundJobsExecutor() {
return new DelegatingSecurityContextExecutor(getThreadPoolTaskExecutor("BackgroundJobs",
backgroundJobsPoolSize));
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ArchiveRunAsynchronousService {

private final ArchiveRunCoreService archiveRunCoreService;

@Async("archiveRunExecutor")
@Async("backgroundJobsExecutor")
public void archiveRunsAsynchronous(final Map<String, Date> ownersAndDates, final List<Long> terminalStates,
final Integer chunkSize) {
archiveRunCoreService.archiveRuns(ownersAndDates, terminalStates, chunkSize);
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker/cp-api-srv/config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ cluster.gcp.node.terminate.script=/opt/api/scripts/terminate_node.py

## Common
docker.registry.login.script=/opt/api/scripts/docker-login.sh
run.archive.pool.size=${CP_API_RUN_ARCHIVE_POOL_SIZE:5}
background.api.jobs.pool.size=${CP_API_BACKGROUND_JOBS_POOL_SIZE:10}

# Kube config
cluster.cadvisor.port=4194
Expand Down

0 comments on commit 11b4de1

Please sign in to comment.