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

Development: Add Atlas Profile with optionally autowired Atlas Java API #9936

Open
wants to merge 35 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
23e56e3
Remove unused atlas API method
ole-ve Dec 3, 2024
95b3e30
Optionally autowire atlas APIs instead of "directly" autowiring
ole-ve Dec 3, 2024
4aa32af
Add atlas profile
ole-ve Dec 3, 2024
b090df8
Add missing ifPresent autowires
ole-ve Dec 3, 2024
cdf89d0
Add atlas Spring profile
ole-ve Dec 3, 2024
61a9502
Throw ApiNotPresentException when module not present
ole-ve Dec 3, 2024
3314c3d
Replace remaining occurrences of generic exception with ApiNotPresent…
ole-ve Dec 3, 2024
9e0a4d9
Add JavaDoc for ApiNotPresentException
ole-ve Dec 3, 2024
047a5e9
Replace constructor arg type of api from String to Class
ole-ve Dec 3, 2024
7d29768
Optionally autowire ScienceEventApi in DataExportScienceEventService
ole-ve Dec 3, 2024
310897e
Don't require competencyProgressApi to be present for Java DB migrations
ole-ve Dec 3, 2024
bf40e32
Hide atlas functionality if server (spring) profile is disabled
ole-ve Dec 16, 2024
6be0cb9
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Dec 16, 2024
61747e1
enable atlas profile in certain client tests
ole-ve Dec 17, 2024
c4228f3
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Jan 2, 2025
e42484b
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Jan 6, 2025
2b2336a
:spotlessApply
ole-ve Jan 7, 2025
4d1d641
remove useless comment
ole-ve Jan 7, 2025
bed043f
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Jan 14, 2025
e5c8a47
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Jan 19, 2025
e86ad2e
fix merge aftermath
ole-ve Jan 19, 2025
6890324
replace remaining occurrences of non-optionally autowired APIs with O…
ole-ve Jan 19, 2025
6c7a3d7
use new PROFILE_ATLAS for LearnerProfileApi
ole-ve Jan 19, 2025
e2a581b
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Jan 24, 2025
567dc72
fix optional autowiring
ole-ve Jan 24, 2025
f70b516
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Jan 28, 2025
a6bac3c
delete CourseLearnerProfile on deletion of Course
ole-ve Jan 28, 2025
3ce202c
remove not working @OnDelete annotation
ole-ve Feb 4, 2025
8efb46d
change foreign keys to get deleted on cascade
ole-ve Feb 4, 2025
56f4849
fix master.xml
ole-ve Feb 4, 2025
c86df96
handle atlas not present for missing competency links to exercise unit
ole-ve Feb 4, 2025
10b51be
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Feb 10, 2025
976d1f5
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Feb 10, 2025
d2616c0
Merge branch 'develop' into chore/introduce-atlas-profile
ole-ve Feb 11, 2025
071855e
adjust thresholds for ApiNotPresentException
ole-ve Feb 11, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/test-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
# Run artemis server in a detached mode, and store the pid in variable steps.run-artemis.outputs.pid
- name: Run Artemis Server
id: run-artemis
run: ./main-repo/gradlew bootRun --args='--spring.profiles.active=dev,artemis,scheduling --artemis.user-management.use-external=false --artemis.user-management.internal-admin.username=artemis_admin --artemis.user-management.internal-admin.password=artemis_admin --artemis.user-management.registration.enabled=true --artemis.user-management.registration.allowed-email-pattern=.*' & echo "pid=$!" >> "$GITHUB_OUTPUT"
run: ./main-repo/gradlew bootRun --args='--spring.profiles.active=dev,artemis,scheduling,atlas --artemis.user-management.use-external=false --artemis.user-management.internal-admin.username=artemis_admin --artemis.user-management.internal-admin.password=artemis_admin --artemis.user-management.registration.enabled=true --artemis.user-management.registration.allowed-email-pattern=.*' & echo "pid=$!" >> "$GITHUB_OUTPUT"

# For debug purposes or if anything goes wrong, and we have to manually kill the process on the VM
- name: Print Pid
Expand Down
2 changes: 1 addition & 1 deletion .idea/runConfigurations/Artemis__Server_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Artemis__Server___Client_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ To build and optimize the Artemis application for production, run:
This will create a Artemis-<version>.war file in the folder `build/libs`. The build command compiles the TypeScript into JavaScript files, concatenates and minifies the created files (including HTML and CSS files). It will also modify `index.html` so it references these new files. To ensure everything worked, run the following command to start the application on your local computer:

```shell
java -jar build/libs/*.war --spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,local
java -jar build/libs/*.war --spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,local,atlas
tobias-lippert marked this conversation as resolved.
Show resolved Hide resolved
```

(You might need to copy a yml file into the folder build/libs before, also see [development setup](https://docs.artemis.cit.tum.de/dev/setup/))
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/setup/aeolus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Enable the ``aeolus`` Spring profile

::

--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,local,aeolus
--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,atlas,local,aeolus

Configure the Aeolus Endpoint
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/setup/apollon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Enable the ``apollon`` Spring profile:

::

--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,local,apollon
--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,atlas,local,apollon

Configure API Endpoints:
^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/setup/athena.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Enable the ``athena`` Spring profile:

::

--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,local,athena
--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,atlas,local,athena

Configure API Endpoints:
^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/setup/distributed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ For ICL, the run configuration for core nodes need to include the additional pro

::

--spring.profiles.active=prod,core,ldap-only,localvc,localci,athena,scheduling,iris,lti
--spring.profiles.active=prod,core,atlas,ldap-only,localvc,localci,athena,scheduling,iris,lti

Core nodes do not require further adjustments to the ``application-prod.yml``, as long as you have added the necessary variables as described in the :ref:`Integrated Code Lifecycle Setup <Integrated Code Lifecycle Setup>`.

Expand Down
2 changes: 1 addition & 1 deletion docs/admin/setup/iris.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Enable the ``iris`` Spring profile:

::

--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,local,iris
--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,atlas,local,iris

Configure Pyris API Endpoints:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/setup/production-setup-tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ permissions in the ``/opt/artemis/`` directory that contains the ``Artemis.war``
--add-opens java.management/sun.management=ALL-UNNAMED \
--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED \
-jar Artemis.war \
--spring.profiles.active=prod,localci,localvc,artemis,scheduling,buildagent,core,local,openapi
--spring.profiles.active=prod,localci,localvc,artemis,scheduling,buildagent,core,atlas,local,openapi
SuccessExitStatus=143
StandardOutput=/opt/artemis/artemis.log # remove to use default journald logging/cleanup mechanisms
StandardError=inherit
Expand Down
4 changes: 2 additions & 2 deletions docs/dev/setup/aeolus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Start Aeolus with the following docker compose command:
docker compose -f docker/aeolus.yml up -d


Check if Aeolus is running by visiting the following URL in your browser: http://localhost:8090/docs
Check if Aeolus is running by visiting the following URL in your browser: http://localhost:8090/docs
It should display the Aeolus API documentation.

.. _configure artemis for aeolus:
Expand Down Expand Up @@ -77,7 +77,7 @@ e.g.:

::

--spring.profiles.active=dev,localci,localvc,aeolus,artemis,scheduling,local
--spring.profiles.active=dev,localci,localvc,aeolus,artemis,scheduling,atlas,local
ole-ve marked this conversation as resolved.
Show resolved Hide resolved


More information on how Aeolus works can be found on `GitHub <https://github.com/ls1intum/Aeolus>`_ or in the `Aeolus documentation <https://ls1intum.github.io/Aeolus/>`_.
2 changes: 1 addition & 1 deletion docs/dev/setup/integrated-code-lifecycle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ e.g.:

::

--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,local
--spring.profiles.active=dev,localci,localvc,artemis,scheduling,buildagent,core,atlas,local

All of these profiles are enabled by default when using the ``Artemis (Server, LocalVC & LocalCI)`` run configuration in IntelliJ.
Please read :ref:`Server Setup` for more details.
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/setup/jenkins-gitlab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ In addition, you have to start Artemis with the profiles ``gitlab`` and

::

--spring.profiles.active=dev,jenkins,gitlab,artemis,scheduling
--spring.profiles.active=dev,jenkins,gitlab,artemis,atlas,scheduling

Please read :ref:`Server Setup` for more details.

Expand Down
2 changes: 1 addition & 1 deletion docs/dev/setup/jenkins-localvc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ In addition, you have to start Artemis with the profiles ``localvc`` and

::

--spring.profiles.active=dev,jenkins,localvc,artemis,scheduling
--spring.profiles.active=dev,jenkins,localvc,artemis,atlas,scheduling

Please read :ref:`Server Setup` for more details.

Expand Down
6 changes: 3 additions & 3 deletions docs/dev/setup/server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ The Artemis server should startup by running the main class

::

--spring.profiles.active=dev,jenkins,gitlab,artemis,scheduling
--spring.profiles.active=dev,jenkins,gitlab,artemis,atlas,scheduling

If you use IntelliJ (Community or Ultimate) you can set the active
profiles by

* Choosing ``Run | Edit Configurations...``
* Going to the ``Configuration Tab``
* Expanding the ``Environment`` section to reveal ``VM Options`` and setting them to
``-Dspring.profiles.active=dev,jenkins,gitlab,artemis,scheduling``
``-Dspring.profiles.active=dev,jenkins,gitlab,artemis,atlas,scheduling``

Set Spring profiles with IntelliJ Ultimate
""""""""""""""""""""""""""""""""""""""""""
Expand All @@ -244,4 +244,4 @@ sure to pass the active profiles to the ``gradlew`` command like this:

.. code:: bash

./gradlew bootRun --args='--spring.profiles.active=dev,jenkins,gitlab,artemis,scheduling'
./gradlew bootRun --args='--spring.profiles.active=dev,jenkins,gitlab,artemis,atlas,scheduling'
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class ParticipantScoreScheduleService {

private Optional<Instant> lastScheduledRun = Optional.empty();

private final CompetencyProgressApi competencyProgressApi;
private final Optional<CompetencyProgressApi> competencyProgressApi;

private final ParticipantScoreRepository participantScoreRepository;

Expand All @@ -96,7 +96,7 @@ public class ParticipantScoreScheduleService {
*/
private final AtomicBoolean isRunning = new AtomicBoolean(false);

public ParticipantScoreScheduleService(@Qualifier("taskScheduler") TaskScheduler scheduler, CompetencyProgressApi competencyProgressApi,
public ParticipantScoreScheduleService(@Qualifier("taskScheduler") TaskScheduler scheduler, Optional<CompetencyProgressApi> competencyProgressApi,
ParticipantScoreRepository participantScoreRepository, StudentScoreRepository studentScoreRepository, TeamScoreRepository teamScoreRepository,
ExerciseRepository exerciseRepository, ResultRepository resultRepository, UserRepository userRepository, TeamRepository teamRepository) {
this.scheduler = scheduler;
Expand Down Expand Up @@ -336,7 +336,8 @@ private void executeTask(Long exerciseId, Long participantId, Instant resultLast
if (scoreParticipant instanceof Team team && !Hibernate.isInitialized(team.getStudents())) {
scoreParticipant = teamRepository.findWithStudentsByIdElseThrow(team.getId());
}
competencyProgressApi.updateProgressByLearningObjectSync(score.getExercise(), scoreParticipant.getParticipants());
Participant finalScoreParticipant = scoreParticipant;
competencyProgressApi.ifPresent(api -> api.updateProgressByLearningObjectSync(score.getExercise(), finalScoreParticipant.getParticipants()));
}
catch (Exception e) {
log.error("Exception while processing participant score for exercise {} and participant {} for participant scores:", exerciseId, participantId, e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.api;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Controller;
Expand All @@ -9,7 +9,7 @@
import de.tum.cit.aet.artemis.lecture.domain.Lecture;

@Controller
@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
public class CompetencyApi extends AbstractAtlasApi {

private final CompetencyService competencyService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.api;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import java.util.List;
import java.util.Optional;
Expand All @@ -19,7 +19,7 @@
import de.tum.cit.aet.artemis.exercise.domain.participation.Participant;

@Controller
@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
public class CompetencyProgressApi extends AbstractAtlasApi {

private final CompetencyProgressService competencyProgressService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.api;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import java.util.List;

Expand All @@ -14,7 +14,7 @@
import de.tum.cit.aet.artemis.atlas.repository.CompetencyRelationRepository;

@Controller
@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
public class CompetencyRelationApi extends AbstractAtlasApi {

private final CompetencyRelationRepository competencyRelationRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.api;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Controller;
Expand All @@ -9,7 +9,7 @@
import de.tum.cit.aet.artemis.atlas.repository.CourseCompetencyRepository;

@Controller
@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
public class CourseCompetencyApi extends AbstractAtlasApi {

private final CourseCompetencyRepository courseCompetencyRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.api;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import java.util.Set;

Expand All @@ -13,7 +13,7 @@
import de.tum.cit.aet.artemis.core.domain.User;

@Controller
@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
public class LearnerProfileApi extends AbstractAtlasApi {

private final LearnerProfileService learnerProfileService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.api;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Controller;
Expand All @@ -9,7 +9,7 @@
import de.tum.cit.aet.artemis.atlas.service.LearningMetricsService;

@Controller
@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
public class LearningMetricsApi extends AbstractAtlasApi {

private final LearningMetricsService metricsService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.api;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import jakarta.validation.constraints.NotNull;

Expand All @@ -12,7 +12,7 @@
import de.tum.cit.aet.artemis.core.domain.User;

@Controller
@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
public class LearningPathApi extends AbstractAtlasApi {

private final LearningPathService learningPathService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.api;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Controller;
Expand All @@ -10,7 +10,7 @@
import de.tum.cit.aet.artemis.core.domain.Course;

@Controller
@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
public class PrerequisitesApi extends AbstractAtlasApi {

private final PrerequisiteRepository prerequisiteRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.api;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import java.util.Set;

Expand All @@ -11,7 +11,7 @@
import de.tum.cit.aet.artemis.atlas.repository.ScienceEventRepository;

@Controller
@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
public class ScienceEventApi extends AbstractAtlasApi {

private final ScienceEventRepository scienceEventRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tum.cit.aet.artemis.atlas.repository;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_ATLAS;

import java.util.List;

Expand All @@ -12,7 +12,7 @@
import de.tum.cit.aet.artemis.atlas.domain.competency.CompetencyExerciseLink;
import de.tum.cit.aet.artemis.core.repository.base.ArtemisJpaRepository;

@Profile(PROFILE_CORE)
@Profile(PROFILE_ATLAS)
@Repository
public interface CompetencyExerciseLinkRepository extends ArtemisJpaRepository<CompetencyExerciseLink, Long> {

Expand Down
Loading
Loading