Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.3.0 #253

Merged
merged 17 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,22 @@ jobs:
distribution: 'temurin'
cache: maven

- name: Get Taskit Version
run: |
echo "taskit_version=v$(mvn help:evaluate -Dexpression=taskit.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV"

- name: Checkout Taskit
if: ${{ endsWith(env.taskit_version, 'SNAPSHOT') }}
uses: actions/checkout@v4
with:
repository: HHS/ASPR-ms-taskit
path: taskit
ref: dev

- name: Get Util Version
if: ${{ endsWith(env.taskit_version, 'SNAPSHOT') }}
run: |
echo "util_version=v$(mvn help:evaluate -Dexpression=util.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV"
echo "util_version=v$(mvn help:evaluate -Dexpression=util.version -q -DforceStdout --file taskit/pom.xml)" >> "$GITHUB_ENV"

- name: Checkout Util
if: ${{ endsWith(env.util_version, 'SNAPSHOT') }}
Expand All @@ -42,6 +55,10 @@ jobs:
if: ${{ endsWith(env.util_version, 'SNAPSHOT') }}
run: mvn clean install -DskipTests --file util/pom.xml

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

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

Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/dev_pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,22 @@ jobs:
distribution: 'temurin'
cache: maven

- name: Get Taskit Version
run: |
echo "taskit_version=v$(mvn help:evaluate -Dexpression=taskit.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV"

- name: Checkout Taskit
if: ${{ endsWith(env.taskit_version, 'SNAPSHOT') }}
uses: actions/checkout@v4
with:
repository: HHS/ASPR-ms-taskit
path: taskit
ref: dev

- name: Get Util Version
if: ${{ endsWith(env.taskit_version, 'SNAPSHOT') }}
run: |
echo "util_version=v$(mvn help:evaluate -Dexpression=util.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV"
echo "util_version=v$(mvn help:evaluate -Dexpression=util.version -q -DforceStdout --file taskit/pom.xml)" >> "$GITHUB_ENV"

- name: Checkout Util
if: ${{ endsWith(env.util_version, 'SNAPSHOT') }}
Expand All @@ -42,6 +55,10 @@ jobs:
if: ${{ endsWith(env.util_version, 'SNAPSHOT') }}
run: mvn clean install -DskipTests --file util/pom.xml

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

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

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:


update-gcm-taskit:
if: ${{ !endsWith(needs.release.outputs.gcm_version, '0') }}
needs: release
runs-on: ubuntu-latest
permissions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public List<PersonId> getUnvaccinatedFamilyMembers(PersonId personId) {
List<PersonId> familyMembers = familyDataManager.getFamilyMembers(familyId);
for (PersonId familyMemeberId : familyMembers) {
if (!isPersonVaccinated(familyMemeberId)) {
result.add(personId);
result.add(familyMemeberId);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import gov.hhs.aspr.ms.gcm.lessons.plugins.model.PersonProperty;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ActorContext;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ActorPlan;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ConsumerActorPlan;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.EventFilter;
import gov.hhs.aspr.ms.gcm.simulation.plugins.globalproperties.datamanagers.GlobalPropertiesDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.datamanagers.PeopleDataManager;
Expand Down Expand Up @@ -46,7 +47,7 @@ private void vaccinatePerson(PersonId personId) {
if (refusesVaccine) {
double planTime = actorContext.getTime() + randomGenerator.nextDouble() * vaccineAttemptInterval;

ActorPlan plan = new ActorPlan(planTime, (c) -> vaccinatePerson(personId));
ActorPlan plan = new ConsumerActorPlan(planTime, (c) -> vaccinatePerson(personId));
actorContext.addPlan(plan);
//record the plan for possible cancellation
actorPlans.put(personId, plan);
Expand Down Expand Up @@ -80,7 +81,7 @@ private void handleVaccineAcceptance(ActorContext actorContext,
/* start code_ref= person_properties_vaccinator_plan_vaccination|code_cap= Each unvaccinated person has a planned vaccination based on the VACCINE_ATTEMPT_INTERVAL global property. */
private void planVaccination(PersonId personId) {
double planTime = actorContext.getTime() + randomGenerator.nextDouble() * vaccineAttemptInterval;
ActorPlan plan = new ActorPlan(planTime, (c) -> vaccinatePerson(personId));
ActorPlan plan = new ConsumerActorPlan(planTime, (c) -> vaccinatePerson(personId));
actorContext.addPlan(plan);
//record the plan for possible cancellation
actorPlans.put(personId, plan);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import gov.hhs.aspr.ms.gcm.lessons.plugins.model.support.SchoolStatus;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ActorContext;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ActorPlan;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ConsumerActorPlan;
import gov.hhs.aspr.ms.gcm.simulation.plugins.globalproperties.datamanagers.GlobalPropertiesDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.groups.datamanagers.GroupsDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.groups.support.GroupConstructionInfo;
Expand Down Expand Up @@ -41,7 +42,7 @@ public void init(ActorContext actorContext) {

private void planNextReview() {
double planTime = actorContext.getTime() + reviewInterval;
ActorPlan plan = new ActorPlan(planTime,false,this::reviewSchools);
ActorPlan plan = new ConsumerActorPlan(planTime,false,this::reviewSchools);
actorContext.addPlan(plan);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import gov.hhs.aspr.ms.gcm.lessons.plugins.model.support.PersonProperty;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ActorContext;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ActorPlan;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ConsumerActorPlan;
import gov.hhs.aspr.ms.gcm.simulation.plugins.globalproperties.datamanagers.GlobalPropertiesDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.groups.datamanagers.GroupsDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.groups.support.GroupId;
Expand All @@ -31,7 +32,7 @@ public void init(ActorContext actorContext) {

private void scheduleNextReview() {
double planTime = actorContext.getTime() + reviewInterval;
ActorPlan plan = new ActorPlan(planTime,false,this::reviewTeleworkStatus);
ActorPlan plan = new ConsumerActorPlan(planTime,false,this::reviewTeleworkStatus);
actorContext.addPlan(plan);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import gov.hhs.aspr.ms.gcm.lessons.plugins.model.support.PersonProperty;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ActorContext;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ActorPlan;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.ConsumerActorPlan;
import gov.hhs.aspr.ms.gcm.simulation.nucleus.EventFilter;
import gov.hhs.aspr.ms.gcm.simulation.plugins.globalproperties.datamanagers.GlobalPropertiesDataManager;
import gov.hhs.aspr.ms.gcm.simulation.plugins.people.datamanagers.PeopleDataManager;
Expand Down Expand Up @@ -215,7 +216,7 @@ private void intializeCandidatesAndWeights() {
* vaccinator selects from maintained sub-populations.
*/
private void planNextVaccination() {
futurePlan = new ActorPlan(interVaccinationTime + actorContext.getTime(), this::vaccinatePerson);
futurePlan = new ConsumerActorPlan(interVaccinationTime + actorContext.getTime(), this::vaccinatePerson);
actorContext.addPlan(futurePlan);
}

Expand Down
26 changes: 13 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<!-- Properties -->
<properties>
<revision>4.2.3</revision>
<revision>4.3.0</revision>

<!-- basic project properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -60,27 +60,27 @@

<!-- plugin versions -->
<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-surefire-plugin.version>3.4.0</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.4.0</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>
<maven-javadoc-plugin.version>3.8.0</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>3.2.5</maven-gpg-plugin.version>
<central-publishing-maven-plugin.version>0.5.0</central-publishing-maven-plugin.version>

<!-- dependency versions -->
<util.version>4.2.1</util.version>
<taskit.version>5.0.0</taskit.version>
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
<junit-jupiter-engine.version>5.10.2</junit-jupiter-engine.version>
<junit-jupiter-engine.version>5.11.0</junit-jupiter-engine.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>gov.hhs.aspr.ms</groupId>
<artifactId>util</artifactId>
<version>${util.version}</version>
<groupId>gov.hhs.aspr.ms.taskit</groupId>
<artifactId>protobuf</artifactId>
<version>${taskit.version}</version>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
Expand All @@ -105,8 +105,8 @@

<dependencies>
<dependency>
<groupId>gov.hhs.aspr.ms</groupId>
<artifactId>util</artifactId>
<groupId>gov.hhs.aspr.ms.taskit</groupId>
<artifactId>protobuf</artifactId>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
Expand Down
5 changes: 0 additions & 5 deletions simulation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
<configuration>
<doclint>all,-missing</doclint>
<additionalDependencies>
<additionalDependency>
<groupId>gov.hhs.aspr.ms</groupId>
<artifactId>util</artifactId>
<version>${util.version}</version>
</additionalDependency>
<additionalDependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void subscribeToSimulationClose(Consumer<ActorContext> consumer) {
* </ul>
*/
public void addPlan(final Consumer<ActorContext> consumer, final double planTime) {
simulation.addActorPlan(new ActorPlan(planTime, consumer));
simulation.addActorPlan(new ConsumerActorPlan(planTime, consumer));
}

/**
Expand All @@ -74,9 +74,6 @@ public void addPlan(final Consumer<ActorContext> consumer, final double planTime
* </ul>
*/
public void addPlan(final ActorPlan plan) {
if (plan == null) {
throw new ContractException(NucleusError.NULL_PLAN);
}
simulation.addActorPlan(plan);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
package gov.hhs.aspr.ms.gcm.simulation.nucleus;

import java.util.function.Consumer;
public abstract class ActorPlan extends Plan {

public class ActorPlan extends Plan {
ActorId actorId;
protected final Consumer<ActorContext> consumer;
// The actor id is used by the simulation via package access
ActorId actorId;

public ActorPlan(double time, boolean active, long arrivalId, Consumer<ActorContext> consumer) {
super(time, active, arrivalId, Planner.ACTOR);
this.consumer = consumer;
}


public ActorPlan(double time, Consumer<ActorContext> consumer) {
super(time, true, -1L, Planner.ACTOR);
this.consumer = consumer;
}
/**
* Constructs the plan scheduled for the given time, active status and arrivalId.
*
*
*/
public ActorPlan(double time, boolean active, long arrivalId) {
super(time, active, arrivalId, Planner.ACTOR);
}

public ActorPlan(double time, boolean active, Consumer<ActorContext> consumer) {
super(time, active, -1L, Planner.ACTOR);
this.consumer = consumer;
}
/**
* Constructs the plan scheduled for the given time. The plan will
* be active.The arrival id is set to -1L indicating that this is a new,
* non-deserialized plan.
*
*
*/
public ActorPlan(double time) {
super(time, true, -1L, Planner.ACTOR);
}

protected void execute(ActorContext context) {
this.consumer.accept(context);
}

/**
* Constructs the plan scheduled for the given time and active status.
* The arrival id is set to -1L indicating that this is a new, non-deserialized
* plan.
*
*
*/
public ActorPlan(double time, boolean active) {
super(time, active, -1L, Planner.ACTOR);
}

/**
* Executes the actor logic associated with the plan.
*/
protected abstract void execute(ActorContext context);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package gov.hhs.aspr.ms.gcm.simulation.nucleus;

import java.util.function.Consumer;

import gov.hhs.aspr.ms.util.errors.ContractException;

public final class ConsumerActorPlan extends ActorPlan {

private final Consumer<ActorContext> consumer;

/**
* Constructs the plan scheduled for the given time active status arrivalId and
* consumer
*
* @throws ContractException
* <ul>
* <li>{@linkplain NucleusError#NULL_PLAN_CONSUMER} if
* the consumer is null</li>
* </ul>
*/
public ConsumerActorPlan(double time, boolean active, long arrivalId, Consumer<ActorContext> consumer) {
super(time, active, arrivalId);
if (consumer == null) {
throw new ContractException(NucleusError.NULL_PLAN_CONSUMER);
}
this.consumer = consumer;
}

/**
* Constructs the plan scheduled for the given time and consumer. The plan will
* be active.The arrival id is set to -1L indicating that this is a new,
* non-deserialized plan.
*
* @throws ContractException
* <ul>
* <li>{@linkplain NucleusError#NULL_PLAN_CONSUMER} if
* the consumer is null</li>
* </ul>
*/
public ConsumerActorPlan(double time, Consumer<ActorContext> consumer) {
super(time);
if (consumer == null) {
throw new ContractException(NucleusError.NULL_PLAN_CONSUMER);
}
this.consumer = consumer;
}

/**
* Constructs the plan scheduled for the given time, active status and consumer.
* The arrival id is set to -1L indicating that this is a new, non-deserialized
* plan.
*
* @throws ContractException
* <ul>
* <li>{@linkplain NucleusError#NULL_PLAN_CONSUMER} if
* the consumer is null</li>
* </ul>
*/
public ConsumerActorPlan(double time, boolean active, Consumer<ActorContext> consumer) {
super(time, active);
if (consumer == null) {
throw new ContractException(NucleusError.NULL_PLAN_CONSUMER);
}
this.consumer = consumer;
}

@Override
protected final void execute(ActorContext context) {
this.consumer.accept(context);
}
}
Loading