Skip to content

Commit

Permalink
Reduce sample data generation size
Browse files Browse the repository at this point in the history
- sample docker image was getting too large (>500MB)

#4802
  • Loading branch information
davidwatkins73 committed Jun 29, 2020
1 parent 4063805 commit f237e2c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.jooq.*;
import org.jooq.impl.DSL;
import org.jooq.lambda.Unchecked;
import org.jooq.lambda.tuple.Tuple2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

Expand Down Expand Up @@ -136,7 +137,8 @@ public List<TallyPack<String>> tallyDataTypesByAppIdSelector(Select<Record1<Long
.and(BOTH_APPS)
.and(NOT_REMOVED);

Result<Record3<Long, String, Integer>> records = dsl.select(
Map<EntityReference, List<Tally<String>>> dataTypeRefToTallies = dsl
.select(
lfd.DECORATOR_ENTITY_ID,
flowTypeCase.as(flowType),
count().as(flowCount))
Expand All @@ -150,18 +152,12 @@ public List<TallyPack<String>> tallyDataTypesByAppIdSelector(Select<Record1<Long
.on(targetAppId.eq(lf.TARGET_ENTITY_ID))
.where(dsl.renderInlined(condition))
.groupBy(lfd.DECORATOR_ENTITY_ID, flowTypeCase)
.fetch();

Map<EntityReference, List<Tally<String>>> dataTypeRefToTallies = records.stream()
.map(r -> tuple(
mkRef(EntityKind.DATA_TYPE, r.getValue(lfd.DECORATOR_ENTITY_ID)),
ImmutableTally.<String>builder()
.fetchGroups(
r -> mkRef(EntityKind.DATA_TYPE, r.getValue(lfd.DECORATOR_ENTITY_ID)),
r -> ImmutableTally.<String>builder()
.id(r.getValue(flowType))
.count(r.getValue(flowCount))
.build()))
.collect(groupingBy(t -> t.v1(),
mapping(t -> t.v2(),
toList())));
.build());

return dataTypeRefToTallies.entrySet()
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private static void visit(ImmutablePerson parent, int level, List<Long> orgUnitI

int nextLevel = level + 1;

int siblingCount = level == 1 ? SampleData.jobTitles[1].length : rnd.nextInt(7) + 2;
int siblingCount = level == 1 ? SampleData.jobTitles[1].length : rnd.nextInt(4) + 2;

for (int i = 0 ; i < siblingCount ; i++) {
Person person = fairy.person();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public interface SampleDataGenerator {
String SAMPLE_DATA_PROVENANCE = "waltz-sample";
String SAMPLE_DATA_USER = "admin";

int NUM_APPS = 500;
int NUM_CHANGE_INITIATIVES = 100;
int NUM_APPS = 100;
int NUM_CHANGE_INITIATIVES = 50;
int NUM_PROCESS_GROUPS = 3;
int NUM_PROCESSES_IN_GROUP = 6;
int MAX_RATINGS_PER_APP = 12;
int MAX_RATINGS_PER_APP = 15;


default DSLContext getDsl(ApplicationContext ctx) {
Expand Down
25 changes: 24 additions & 1 deletion waltz-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,30 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifesdumt>
<mainClass>
com.khartec.waltz.web.Main
</mainClass>
</manifesdumt>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit f237e2c

Please sign in to comment.