Skip to content

Commit e7e6055

Browse files
authored
Add endpoint to clear the cdm_cache and achilles_cache (#2406)
Truncates cdm_cache and achilles_cache before warming cache.
1 parent e41dc29 commit e7e6055

12 files changed

Lines changed: 351 additions & 136 deletions

File tree

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = crlf
10+
charset = utf-8
11+
trim_trailing_whitespace = false
12+
insert_final_newline = false

pom.xml

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
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">
33

44
<modelVersion>4.0.0</modelVersion>
55

@@ -122,7 +122,7 @@
122122
<security.ad.system.password></security.ad.system.password>
123123
<security.ad.searchFilter>(&amp;(objectClass=person)(cn=%s))</security.ad.searchFilter>
124124
<security.ad.ignore.partial.result.exception>true</security.ad.ignore.partial.result.exception>
125-
<security.ad.result.count.limit>30000</security.ad.result.count.limit> <!-- 0 means no limit -->
125+
<security.ad.result.count.limit>30000</security.ad.result.count.limit> <!-- 0 means no limit -->
126126
<security.ad.default.import.group>public</security.ad.default.import.group>
127127
<security.ad.searchString>(&amp;(objectClass=person)(userPrincipalName=%s))</security.ad.searchString>
128128
<security.ad.userMapping.displaynameAttr>displayname</security.ad.userMapping.displaynameAttr>
@@ -191,8 +191,8 @@
191191
<!-- If defaultGlobalReadPermissions is set to true (default), then all users can see every artifact. -->
192192
<!-- If it is set to false, WebAPI will filter out the artifacts that a user does not explicitly have -->
193193
<!-- read permissions to -->
194-
<security.defaultGlobalReadPermissions>true</security.defaultGlobalReadPermissions>
195-
194+
<security.defaultGlobalReadPermissions>true</security.defaultGlobalReadPermissions>
195+
196196
<!-- EMBEDDED SERVER CONFIGURATION (ServerProperties) -->
197197
<server.port>8080</server.port>
198198
<server.ssl.key-store></server.ssl.key-store>
@@ -216,7 +216,7 @@
216216
<jasypt.encryptor.enabled>false</jasypt.encryptor.enabled>
217217
<jasypt.encryptor.password></jasypt.encryptor.password>
218218
<jasypt.encryptor.algorithm>PBEWithMD5AndDES</jasypt.encryptor.algorithm>
219-
219+
220220
<!-- ORGANIZATION SETTINGS -->
221221
<organization.name>OHDSI</organization.name>
222222

@@ -298,6 +298,7 @@
298298
<audit.trail.log.file>/tmp/atlas/audit/audit.log</audit.trail.log.file>
299299
<audit.trail.log.extraFile>/tmp/atlas/audit/audit-extra.log</audit.trail.log.extraFile>
300300
</properties>
301+
301302
<build>
302303
<finalName>WebAPI</finalName>
303304
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
@@ -368,8 +369,8 @@
368369
<!-- only include properties to speed up plugin -->
369370
<!-- ref: https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/462 -->
370371
<includeOnlyProperties>
371-
<includeOnlyProperty>git.branch</includeOnlyProperty>
372-
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
372+
<includeOnlyProperty>git.branch</includeOnlyProperty>
373+
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
373374
</includeOnlyProperties>
374375
</configuration>
375376
</plugin>
@@ -575,6 +576,7 @@
575576
</dependency>
576577
</dependencies>
577578
</dependencyManagement>
579+
578580
<dependencies>
579581
<dependency>
580582
<groupId>com.fasterxml.jackson.core</groupId>
@@ -813,12 +815,12 @@
813815
<artifactId>jackson-databind</artifactId>
814816
</exclusion>
815817
<exclusion>
816-
<groupId>org.slf4j</groupId>
817-
<artifactId>slf4j-log4j12</artifactId>
818+
<groupId>org.slf4j</groupId>
819+
<artifactId>slf4j-log4j12</artifactId>
818820
</exclusion>
819821
<exclusion>
820-
<groupId>log4j</groupId>
821-
<artifactId>log4j</artifactId>
822+
<groupId>log4j</groupId>
823+
<artifactId>log4j</artifactId>
822824
</exclusion>
823825
</exclusions>
824826
</dependency>
@@ -1164,7 +1166,7 @@
11641166
<version>${pac4j.version}</version>
11651167
<exclusions>
11661168
<exclusion>
1167-
<groupId>com.fasterxml.jackson.core</groupId>
1169+
<groupId>com.fasterxml.jackson.core</groupId>
11681170
<artifactId>jackson-databind</artifactId>
11691171
</exclusion>
11701172
</exclusions>
@@ -1210,12 +1212,12 @@
12101212
<artifactId>spring-boot-starter-test</artifactId>
12111213
<version>${spring.boot.version}</version>
12121214
<scope>test</scope>
1213-
<exclusions>
1214-
<exclusion>
1215-
<groupId>com.vaadin.external.google</groupId>
1216-
<artifactId>android-json</artifactId>
1217-
</exclusion>
1218-
</exclusions>
1215+
<exclusions>
1216+
<exclusion>
1217+
<groupId>com.vaadin.external.google</groupId>
1218+
<artifactId>android-json</artifactId>
1219+
</exclusion>
1220+
</exclusions>
12191221
</dependency>
12201222
<dependency>
12211223
<groupId>org.dbunit</groupId>
@@ -1236,12 +1238,13 @@
12361238
<scope>test</scope>
12371239
</dependency>
12381240
<dependency>
1239-
<groupId>com.github.mjeanroy</groupId>
1240-
<artifactId>dbunit-plus</artifactId>
1241-
<version>2.0.1</version>
1242-
<scope>test</scope>
1241+
<groupId>com.github.mjeanroy</groupId>
1242+
<artifactId>dbunit-plus</artifactId>
1243+
<version>2.0.1</version>
1244+
<scope>test</scope>
12431245
</dependency>
12441246
</dependencies>
1247+
12451248
<profiles>
12461249
<profile>
12471250
<id>webapi-oracle</id>
@@ -1334,17 +1337,17 @@
13341337
lower(email) = lower(?)</security.db.datasource.authenticationQuery>
13351338
</properties>
13361339
<repositories>
1337-
<repository>
1340+
<repository>
13381341
<id>ohdsi.snapshots</id>
13391342
<name>repo.ohdsi.org-snapshots</name>
13401343
<url>https://repo.ohdsi.org/nexus/content/repositories/snapshots</url>
13411344
<releases>
13421345
<enabled>false</enabled>
13431346
</releases>
1344-
<snapshots>
1347+
<snapshots>
13451348
<enabled>true</enabled>
1346-
</snapshots>
1347-
</repository>
1349+
</snapshots>
1350+
</repository>
13481351
</repositories>
13491352
</profile>
13501353
<profile>
@@ -1417,7 +1420,7 @@
14171420
<impala.enabled>true</impala.enabled>
14181421
<impala.driver.version>2.6.15</impala.driver.version>
14191422
<!-- Impala JDBC driver path -->
1420-
<impala.classpath>...path/to/impala/jdbc/drivers...</impala.classpath>
1423+
<impala.classpath>...path/to/impala/jdbc/drivers...</impala.classpath>
14211424
</properties>
14221425
<dependencies>
14231426
<dependency>
@@ -1522,9 +1525,9 @@
15221525
<version>v2-rev20220326-1.32.1</version>
15231526
</dependency>
15241527
<dependency>
1525-
<groupId>com.google.cloud</groupId>
1526-
<artifactId>google-cloud-bigquery</artifactId>
1527-
<version>1.2.15</version>
1528+
<groupId>com.google.cloud</groupId>
1529+
<artifactId>google-cloud-bigquery</artifactId>
1530+
<version>1.2.15</version>
15281531
</dependency>
15291532
<dependency>
15301533
<groupId>com.google.http-client</groupId>

src/main/java/org/ohdsi/webapi/achilles/repository/AchillesCacheRepository.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.ohdsi.webapi.achilles.domain.AchillesCacheEntity;
44
import org.ohdsi.webapi.source.Source;
5-
import org.springframework.data.jpa.repository.JpaRepository;
5+
import org.springframework.data.jpa.repository.Modifying;
66
import org.springframework.data.jpa.repository.Query;
77
import org.springframework.data.repository.CrudRepository;
88
import org.springframework.data.repository.query.Param;
@@ -16,4 +16,8 @@ public interface AchillesCacheRepository extends CrudRepository<AchillesCacheEnt
1616

1717
@Query("select ac from AchillesCacheEntity ac where source = :source and cacheName in :names")
1818
List<AchillesCacheEntity> findBySourceAndNames(@Param("source") Source source, @Param("names") List<String> names);
19+
20+
@Modifying
21+
@Query("delete from AchillesCacheEntity where source = :source")
22+
void deleteBySource(@Param("source") Source source);
1923
}

0 commit comments

Comments
 (0)