Skip to content

Commit

Permalink
Merge pull request #240 from HHS/dev
Browse files Browse the repository at this point in the history
4.2.2
  • Loading branch information
bischoffz authored Jun 17, 2024
2 parents af8336e + d4de9b1 commit 9bdeaec
Show file tree
Hide file tree
Showing 15 changed files with 169 additions and 99 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ name: GCM Development Build
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]

jobs:
dev-build:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/dev_pr_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: GCM Development PR Build

on:
pull_request:
branches-ignore: ["main", "master"]

jobs:
dev-build:
runs-on: ubuntu-latest
steps:
- name: Checkout GCM
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Get Util Version
run: |
echo "util_version=v$(mvn help:evaluate -Dexpression=util.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV"
- name: Checkout Util
if: ${{ endsWith(env.util_version, 'SNAPSHOT') }}
uses: actions/checkout@v4
with:
repository: HHS/ASPR-ms-util
path: util
ref: dev

- name: Build Util
if: ${{ endsWith(env.util_version, 'SNAPSHOT') }}
run: mvn clean install -DskipTests --file util/pom.xml

- name: Build GCM
run: mvn clean install --file pom.xml

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
# - name: Update dependency graph
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
22 changes: 11 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,28 @@

<!-- Properties -->
<properties>
<revision>4.2.1</revision>
<revision>4.2.2</revision>

<!-- basic project properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

<!-- plugin versions -->
<flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M5</maven-failsafe-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-install-plugin.version>3.1.1</maven-install-plugin.version>
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>3.2.2</maven-gpg-plugin.version>
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.2.5</maven-failsafe-plugin.version>
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
<maven-install-plugin.version>3.1.2</maven-install-plugin.version>
<maven-deploy-plugin.version>3.1.2</maven-deploy-plugin.version>
<maven-javadoc-plugin.version>3.7.0</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
<central-publishing-maven-plugin.version>0.4.0</central-publishing-maven-plugin.version>

<!-- dependency versions -->
<util.version>4.2.0</util.version>
<jacoco-maven-plugin.version>0.8.9</jacoco-maven-plugin.version>
<junit-jupiter-engine.version>5.8.2</junit-jupiter-engine.version>
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
<junit-jupiter-engine.version>5.10.2</junit-jupiter-engine.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import org.apache.commons.math3.random.RandomGenerator;

import gov.hhs.aspr.ms.gcm.simulation.nucleus.Event;
import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers.BasePeopleContainer;
import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers.PeopleContainer;
import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.filters.Filter;
import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.filters.TrueFilter;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.datamanagers.PeopleDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.PersonId;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers.BasePeopleContainer;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers.PeopleContainer;
import gov.hhs.aspr.ms.gcm.simulation.plugins.stochastics.datamanagers.StochasticsDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.stochastics.support.RandomNumberGeneratorId;
import gov.hhs.aspr.ms.util.errors.ContractException;
Expand Down Expand Up @@ -67,10 +67,11 @@ public DegeneratePopulationPartitionImpl(final PartitionsContext partitionsConte
}
list.add(filterSensitivity);
}

peopleContainer = new BasePeopleContainer(partitionsContext, supportRunContinuity);


final PeopleDataManager peopleDataManager = partitionsContext.getDataManager(PeopleDataManager.class);
peopleContainer = new BasePeopleContainer(peopleDataManager, supportRunContinuity);


final int personIdLimit = peopleDataManager.getPersonIdLimit();
for (int i = 0; i < personIdLimit; i++) {
if (peopleDataManager.personIndexExists(i)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

import gov.hhs.aspr.ms.gcm.simulation.nucleus.Event;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.NucleusError;
import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers.BasePeopleContainer;
import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers.PeopleContainer;
import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.filters.Filter;
import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.filters.TrueFilter;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.datamanagers.PeopleDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.PersonId;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers.BasePeopleContainer;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers.PeopleContainer;
import gov.hhs.aspr.ms.gcm.simulation.plugins.stochastics.datamanagers.StochasticsDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.stochastics.support.RandomNumberGeneratorId;
import gov.hhs.aspr.ms.util.combinatorics.TupleGenerator;
Expand Down Expand Up @@ -426,7 +426,8 @@ private void addPerson(final PersonId personId) {
cleanedKey = new Key(key);
cleanedKey.calculateHashCode();
keyMap.put(cleanedKey, cleanedKey);
final BasePeopleContainer basePeopleContainer = new BasePeopleContainer(partitionsContext,

final BasePeopleContainer basePeopleContainer = new BasePeopleContainer(peopleDataManager,
supportRunContinuity);
keyToPeopleMap.put(cleanedKey, basePeopleContainer);
final LabelSet labelSet = getLabelSet(cleanedKey);
Expand Down Expand Up @@ -1020,7 +1021,7 @@ private void move(final Key currentKey, final Key newKey, final PersonId personI
if (cleanedNewKey == null) {
cleanedNewKey = newKey;
keyMap.put(cleanedNewKey, cleanedNewKey);
keyToPeopleMap.put(cleanedNewKey, new BasePeopleContainer(partitionsContext, supportRunContinuity));
keyToPeopleMap.put(cleanedNewKey, new BasePeopleContainer(peopleDataManager, supportRunContinuity));
final LabelSet labelSet = getLabelSet(cleanedNewKey);
labelSetInfoMap.put(cleanedNewKey, labelSet);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public enum PersonError implements ContractError {
NULL_PERSON_RANGE("Null person range"),//
PERSON_ASSIGNMENT_TIME_IN_FUTURE("The person assignment time from the plugin data is greater than the current time in the simulation"),//
UNKNOWN_PERSON_ID("Unknown person id"),//

NULL_PEOPLE_DATA_MANAGER("Null people data manager"),//
;

private final String description;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers;
package gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers;

import java.util.List;

import org.apache.commons.math3.random.RandomGenerator;

import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.PartitionsContext;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.datamanagers.PeopleDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.PersonId;

Expand Down Expand Up @@ -32,8 +31,8 @@ private static enum PeopleContainerMode {

private final boolean supportRunContinuity;

public BasePeopleContainer(PartitionsContext partitionsContext, boolean supportRunContinuity) {
this.peopleDataManager = partitionsContext.getDataManager(PeopleDataManager.class);
public BasePeopleContainer(PeopleDataManager peopleDataManager, boolean supportRunContinuity) {
this.peopleDataManager = peopleDataManager;
this.supportRunContinuity = supportRunContinuity;

if (supportRunContinuity) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers;
package gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers;
package gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers;
package gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers;

import java.util.ArrayList;
import java.util.BitSet;
Expand All @@ -7,8 +7,8 @@
import org.apache.commons.math3.random.RandomGenerator;
import org.apache.commons.math3.util.FastMath;

import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.PartitionError;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.datamanagers.PeopleDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.PersonError;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.PersonId;
import gov.hhs.aspr.ms.util.errors.ContractException;

Expand Down Expand Up @@ -38,12 +38,12 @@ public class TreeBitSetPeopleContainer implements PeopleContainer {
/**
* Constructs the people container
*
* @throws ContractException {@linkplain PartitionError#NULL_PEOPLE_DATA_MANAGER}
* @throws ContractException {@linkplain PersonError#NULL_PEOPLE_DATA_MANAGER}
* if the person data view is null
*/
public TreeBitSetPeopleContainer(PeopleDataManager personDataManger) {
if (personDataManger == null) {
throw new ContractException(PartitionError.NULL_PEOPLE_DATA_MANAGER);
throw new ContractException(PersonError.NULL_PEOPLE_DATA_MANAGER);
}
blockSize = 63;
this.peopleDataManager = personDataManger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers;
package gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers;

import org.apache.commons.math3.random.RandomGenerator;
import org.junit.jupiter.api.Test;

import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.PartitionsContext;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.datamanagers.PeopleDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.PersonId;
import gov.hhs.aspr.ms.util.annotations.UnitTestConstructor;
import gov.hhs.aspr.ms.util.annotations.UnitTestMethod;

public class AT_BasePeopleContainer {

private PeopleContainer getPeopleContainer(PartitionsContext partitionsContext) {
return new BasePeopleContainer(partitionsContext,false);
private PeopleContainer getPeopleContainer(PeopleDataManager peopleDataManager) {
return new BasePeopleContainer(peopleDataManager,false);
}

@Test
@UnitTestConstructor(target = BasePeopleContainer.class, args = { PartitionsContext.class, boolean.class})
@UnitTestConstructor(target = BasePeopleContainer.class, args = { PeopleDataManager.class, boolean.class})
public void testConstructor() {
// nothing to test
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers;
package gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.apache.commons.math3.random.RandomGenerator;
import org.junit.jupiter.api.Test;

import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.PartitionsContext;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.datamanagers.PeopleDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.PersonId;
import gov.hhs.aspr.ms.util.annotations.UnitTestConstructor;
import gov.hhs.aspr.ms.util.annotations.UnitTestField;
Expand All @@ -20,7 +20,7 @@ public void testDefaultTargetDepth() {
assertEquals(80, IntSetPeopleContainer.DEFAULT_TARGET_DEPTH);
}

private PeopleContainer getPeopleContainer(PartitionsContext context) {
private PeopleContainer getPeopleContainer(PeopleDataManager peopleDataManager) {
return new IntSetPeopleContainer();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers;
package gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import org.apache.commons.math3.random.RandomGenerator;
import org.junit.jupiter.api.Test;

import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.PartitionError;
import gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.PartitionsContext;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.datamanagers.PeopleDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.PersonError;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.PersonId;
import gov.hhs.aspr.ms.util.annotations.UnitTestConstructor;
import gov.hhs.aspr.ms.util.annotations.UnitTestMethod;
Expand All @@ -18,15 +17,15 @@
public class AT_TreeBitSetPeopleContainer {


private PeopleContainer getPeopleContainer(PartitionsContext context) {
return new TreeBitSetPeopleContainer(context.getDataManager(PeopleDataManager.class));
private PeopleContainer getPeopleContainer(PeopleDataManager peopleDataManager) {
return new TreeBitSetPeopleContainer(peopleDataManager);
}

@Test
@UnitTestConstructor(target = TreeBitSetPeopleContainer.class,args = {PeopleDataManager.class})
public void testConstructor() {
ContractException contractException = assertThrows(ContractException.class,()->new TreeBitSetPeopleContainer(null));
assertEquals(PartitionError.NULL_PEOPLE_DATA_MANAGER, contractException.getErrorType());
assertEquals(PersonError.NULL_PEOPLE_DATA_MANAGER, contractException.getErrorType());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.hhs.aspr.ms.gcm.simulation.plugins.partitions.support.containers;
package gov.hhs.aspr.ms.gcm.simulation.plugins.people.support.containers;

/*
* Manual performance tuning test turned off until adoption of JOL or another memory assessment tool for post-8 java
Expand Down
Loading

0 comments on commit 9bdeaec

Please sign in to comment.