Skip to content

Commit

Permalink
Migrate to new Athene 2.0 (#2157)
Browse files Browse the repository at this point in the history
  • Loading branch information
linusmichel committed Oct 29, 2020
1 parent 4871aed commit bec5fb2
Show file tree
Hide file tree
Showing 33 changed files with 1,048 additions and 842 deletions.
33 changes: 14 additions & 19 deletions docs/dev/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,11 @@ have to configure the file ``application-artemis.yml`` in the folder
git:
name: Artemis
email: artemis@in.tum.de
automatic-text:
segmentation-url: http://localhost:8000/segment
athene:
submit-url: http://localhost/submit
feedback-consistency-url: http://localhost:8001/feedback_consistency
material-upload-url: http://localhost:8001/upload
embedding-url: http://localhost:8001/embed
embedding-chunk-size: 50
clustering-url: http://localhost:8002/cluster
secret: null
base64-secret: YWVuaXF1YWRpNWNlaXJpNmFlbTZkb283dXphaVF1b29oM3J1MWNoYWlyNHRoZWUzb2huZ2FpM211bGVlM0VpcAo=
token-validity-in-seconds: 10800
Change all entries with ``<...>`` with proper values, e.g. your TUM
Online account credentials to connect to the given instances of JIRA,
Expand Down Expand Up @@ -342,18 +339,18 @@ Other useful commands:
- Stop the client: ``docker-compose stop artemis-client`` (restart via
``docker-compose start artemis-client``)

Text Assessment Clustering Service
----------------------------------
Athene Service
--------------

The semi-automatic text assessment relies on the Athene_ service.
To enable automatic text assessments, special configuration is required:

Enable the ``automaticText`` Spring profile:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Enable the ``athene`` Spring profile:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

--spring.profiles.active=dev,bamboo,bitbucket,jira,artemis,scheduling,automaticText
--spring.profiles.active=dev,bamboo,bitbucket,jira,artemis,scheduling,athene

Configure API Endpoints:
^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -366,12 +363,10 @@ HTTP. We need to extend the configuration in the file
artemis:
# ...
automatic-text:
segmentation-url: http://localhost:8000/segment
material-upload-url: http://localhost:8001/upload
embedding-url: http://localhost:8001/embed
embedding-chunk-size: 50
clustering-url: http://localhost:8002/cluster
secret: null
athene:
submit-url: http://localhost/submit
feedback-consistency-url: http://localhost:8001/feedback_consistency
base64-secret: YWVuaXF1YWRpNWNlaXJpNmFlbTZkb283dXphaVF1b29oM3J1MWNoYWlyNHRoZWUzb2huZ2FpM211bGVlM0VpcAo=
token-validity-in-seconds: 10800
.. _Athene: https://github.com/ls1intum/Athene
4 changes: 4 additions & 0 deletions src/main/java/de/tum/in/www1/artemis/config/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public final class Constants {

public static final String PROGRAMMING_SUBMISSION_RESOURCE_API_PATH = "/api" + PROGRAMMING_SUBMISSION_RESOURCE_PATH;

public static final String ATHENE_RESULT_PATH = "/athene-result/";

public static final String ATHENE_RESULT_API_PATH = "/api" + ATHENE_RESULT_PATH;

public static final String SYSTEM_NOTIFICATIONS_RESOURCE_PATH = "/system-notifications/";

public static final String SYSTEM_NOTIFICATIONS_RESOURCE_PATH_ACTIVE_API_PATH = "/api" + SYSTEM_NOTIFICATIONS_RESOURCE_PATH + "active-notification";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public void configure(WebSecurity web) {
.antMatchers(HttpMethod.POST, TEST_CASE_CHANGED_API_PATH + "*");
web.ignoring()
.antMatchers(HttpMethod.GET, SYSTEM_NOTIFICATIONS_RESOURCE_PATH_ACTIVE_API_PATH);
web.ignoring()
.antMatchers(HttpMethod.POST, ATHENE_RESULT_API_PATH + "*");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.stereotype.Repository;

import de.tum.in.www1.artemis.domain.TextSubmission;
import de.tum.in.www1.artemis.domain.enumeration.Language;

/**
* Spring Data JPA repository for the TextSubmission entity.
Expand Down Expand Up @@ -39,4 +40,20 @@ public interface TextSubmissionRepository extends JpaRepository<TextSubmission,

@EntityGraph(type = LOAD, attributePaths = { "result", "result.assessor", "blocks" })
Optional<TextSubmission> findByResult_Id(Long resultId);

/**
* Gets all TextSubmissions which are submitted and loads all blocks
* @param exerciseId the Id of the exercise
* @return List of Text Submissions
*/
@EntityGraph(type = LOAD, attributePaths = { "blocks" })
List<TextSubmission> findByParticipation_ExerciseIdAndSubmittedIsTrue(Long exerciseId);

/**
* Gets all TextSubmissions which are submitted, with matching and loads all blocks
* @param exerciseId the Id of the exercise
* @param language language of the exercise
* @return List of Text Submissions
*/
List<TextSubmission> findByParticipation_ExerciseIdAndSubmittedIsTrueAndLanguage(Long exerciseId, Language language);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import de.tum.in.www1.artemis.service.dto.TextFeedbackConflictRequestDTO;

@Service
@Profile("automaticText")
@Profile("athene")
public class AutomaticTextAssessmentConflictService {

private final Logger log = LoggerFactory.getLogger(AutomaticTextAssessmentConflictService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import de.tum.in.www1.artemis.repository.TextBlockRepository;

@Service
@Profile("automaticText")
@Profile("athene")
public class AutomaticTextFeedbackService {

private final FeedbackService feedbackService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import de.tum.in.www1.artemis.repository.TextClusterRepository;

@Service
@Profile("automaticText")
@Profile("athene")
public class TextAssessmentQueueService {

private final TextClusterRepository textClusterRepository;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import de.tum.in.www1.artemis.domain.*;
import de.tum.in.www1.artemis.domain.enumeration.InitializationState;
import de.tum.in.www1.artemis.domain.enumeration.Language;
import de.tum.in.www1.artemis.domain.enumeration.SubmissionType;
import de.tum.in.www1.artemis.domain.participation.StudentParticipation;
import de.tum.in.www1.artemis.repository.*;
Expand Down Expand Up @@ -251,6 +252,14 @@ public List<TextSubmission> getTextSubmissionsByExerciseId(Long exerciseId, bool
return textSubmissions;
}

public List<TextSubmission> getTextSubmissionsWithTextBlocksByExerciseId(Long exerciseId) {
return textSubmissionRepository.findByParticipation_ExerciseIdAndSubmittedIsTrue(exerciseId);
}

public List<TextSubmission> getTextSubmissionsWithTextBlocksByExerciseIdAndLanguage(Long exerciseId, Language language) {
return textSubmissionRepository.findByParticipation_ExerciseIdAndSubmittedIsTrueAndLanguage(exerciseId, language);
}

/**
* Find a text submission of the given exercise that still needs to be assessed and lock it to prevent other tutors from receiving and assessing it.
*
Expand Down
Loading

0 comments on commit bec5fb2

Please sign in to comment.