Skip to content

Commit

Permalink
Add endpoint to clear the cdm_cache and achilles_cache (#2406)
Browse files Browse the repository at this point in the history
Truncates cdm_cache and achilles_cache before warming cache.
  • Loading branch information
amarsan authored Nov 27, 2024
1 parent e41dc29 commit e7e6055
Show file tree
Hide file tree
Showing 12 changed files with 351 additions and 136 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
65 changes: 34 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<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">
<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">

<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -122,7 +122,7 @@
<security.ad.system.password></security.ad.system.password>
<security.ad.searchFilter>(&amp;(objectClass=person)(cn=%s))</security.ad.searchFilter>
<security.ad.ignore.partial.result.exception>true</security.ad.ignore.partial.result.exception>
<security.ad.result.count.limit>30000</security.ad.result.count.limit> <!-- 0 means no limit -->
<security.ad.result.count.limit>30000</security.ad.result.count.limit> <!-- 0 means no limit -->
<security.ad.default.import.group>public</security.ad.default.import.group>
<security.ad.searchString>(&amp;(objectClass=person)(userPrincipalName=%s))</security.ad.searchString>
<security.ad.userMapping.displaynameAttr>displayname</security.ad.userMapping.displaynameAttr>
Expand Down Expand Up @@ -191,8 +191,8 @@
<!-- If defaultGlobalReadPermissions is set to true (default), then all users can see every artifact. -->
<!-- If it is set to false, WebAPI will filter out the artifacts that a user does not explicitly have -->
<!-- read permissions to -->
<security.defaultGlobalReadPermissions>true</security.defaultGlobalReadPermissions>
<security.defaultGlobalReadPermissions>true</security.defaultGlobalReadPermissions>

<!-- EMBEDDED SERVER CONFIGURATION (ServerProperties) -->
<server.port>8080</server.port>
<server.ssl.key-store></server.ssl.key-store>
Expand All @@ -216,7 +216,7 @@
<jasypt.encryptor.enabled>false</jasypt.encryptor.enabled>
<jasypt.encryptor.password></jasypt.encryptor.password>
<jasypt.encryptor.algorithm>PBEWithMD5AndDES</jasypt.encryptor.algorithm>

<!-- ORGANIZATION SETTINGS -->
<organization.name>OHDSI</organization.name>

Expand Down Expand Up @@ -298,6 +298,7 @@
<audit.trail.log.file>/tmp/atlas/audit/audit.log</audit.trail.log.file>
<audit.trail.log.extraFile>/tmp/atlas/audit/audit-extra.log</audit.trail.log.extraFile>
</properties>

<build>
<finalName>WebAPI</finalName>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
Expand Down Expand Up @@ -368,8 +369,8 @@
<!-- only include properties to speed up plugin -->
<!-- ref: https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/462 -->
<includeOnlyProperties>
<includeOnlyProperty>git.branch</includeOnlyProperty>
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
<includeOnlyProperty>git.branch</includeOnlyProperty>
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
</includeOnlyProperties>
</configuration>
</plugin>
Expand Down Expand Up @@ -575,6 +576,7 @@
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down Expand Up @@ -813,12 +815,12 @@
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down Expand Up @@ -1164,7 +1166,7 @@
<version>${pac4j.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
Expand Down Expand Up @@ -1210,12 +1212,12 @@
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
Expand All @@ -1236,12 +1238,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.mjeanroy</groupId>
<artifactId>dbunit-plus</artifactId>
<version>2.0.1</version>
<scope>test</scope>
<groupId>com.github.mjeanroy</groupId>
<artifactId>dbunit-plus</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>webapi-oracle</id>
Expand Down Expand Up @@ -1334,17 +1337,17 @@
lower(email) = lower(?)</security.db.datasource.authenticationQuery>
</properties>
<repositories>
<repository>
<repository>
<id>ohdsi.snapshots</id>
<name>repo.ohdsi.org-snapshots</name>
<url>https://repo.ohdsi.org/nexus/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
Expand Down Expand Up @@ -1417,7 +1420,7 @@
<impala.enabled>true</impala.enabled>
<impala.driver.version>2.6.15</impala.driver.version>
<!-- Impala JDBC driver path -->
<impala.classpath>...path/to/impala/jdbc/drivers...</impala.classpath>
<impala.classpath>...path/to/impala/jdbc/drivers...</impala.classpath>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -1522,9 +1525,9 @@
<version>v2-rev20220326-1.32.1</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bigquery</artifactId>
<version>1.2.15</version>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bigquery</artifactId>
<version>1.2.15</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.ohdsi.webapi.achilles.domain.AchillesCacheEntity;
import org.ohdsi.webapi.source.Source;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
Expand All @@ -16,4 +16,8 @@ public interface AchillesCacheRepository extends CrudRepository<AchillesCacheEnt

@Query("select ac from AchillesCacheEntity ac where source = :source and cacheName in :names")
List<AchillesCacheEntity> findBySourceAndNames(@Param("source") Source source, @Param("names") List<String> names);

@Modifying
@Query("delete from AchillesCacheEntity where source = :source")
void deleteBySource(@Param("source") Source source);
}
Loading

0 comments on commit e7e6055

Please sign in to comment.