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 script to create large courses locally #9252

Conversation

az108
Copy link
Contributor

@az108 az108 commented Aug 28, 2024

Checklist

General

Motivation and Context

Recently, new Performance Guidelines were introduced. To help developers adhere to these guidelines, this script allows them to locally create a large course with a significant number of students, student participations, and submissions. This enables developers to test their pull requests (PRs) with large datasets according to their specific needs.

Description

large_course_main.py allows you to run the script.
If you want to change the amount of students created, you can modify the students variable in the config.ini file.
If you want to change the amount of commits each student should perform in the example exercise, you can modify the commits variable in the config.ini file.
If you want to change the amount of programming exercises created, you can modify the exercises variable in the config.ini file.
This will automatically perform all the necessary steps:

  1. Authenticate as admin.

  2. Create students.

  3. Create a course.

  4. Add users to the course.

  5. Create a programming exercise.

  6. Add participation and commit for each student.

The provided ReadMe can also be used to get further details if necessary.

Steps for Testing (This PR can only be tested locally)

Prerequisites:

  • 1 Developer
  1. Checkout to this branch
  2. Start the Artemis Server and Client
  3. Navigate to "supporting_scripts/course-scripts"
  4. Run large_course_main.py
  5. Verify if the students and a Course was created on your Local Setup with a Programming Exercise and Sumbissions based on the amount of students you created.

Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive script for automated course setup, including user creation, course management, and programming exercise integration.
    • Added functions for managing user enrollments and programming exercises within courses.
    • Provided a cleanup option to delete created students after testing.
  • Documentation

    • Enhanced performance review guidelines in the pull request template, emphasizing the importance of high performance for large course setups.
    • Added detailed README.md files outlining setup instructions, usage, and project purpose for educators and administrators.

@az108 az108 requested a review from a team as a code owner August 28, 2024 16:13
Copy link

coderabbitai bot commented Aug 28, 2024

Walkthrough

The changes introduce several new Python scripts and README.md files designed to automate the setup and management of educational courses, users, and programming exercises. These scripts facilitate tasks such as user creation, course establishment, user enrollment, and programming exercise management. Additionally, updates to existing scripts enhance type safety and clarity, while the README files provide detailed guidance on installation, configuration, and usage.

Changes

Files Change Summary
supporting_scripts/local-course-scripts/.../Main.py, supporting_scripts/local-course-scripts/.../README.md New automation script and documentation for course setup, user management, and programming exercises.
supporting_scripts/course-scripts/quick-course-setup/.../README.md, supporting_scripts/course-scripts/quick-course-setup/.../create_course.py, supporting_scripts/course-scripts/quick-course-setup/.../manage_programming_exercise.py New scripts and documentation for quick course setup and user management functionalities.
supporting_scripts/course-scripts/quick-course-setup/.../create_course.py Enhanced type annotations and improved logic for course name parsing.
supporting_scripts/course-scripts/quick-course-setup/.../requirements.txt Added a list of package dependencies required for the project.
.github/PULL_REQUEST_TEMPLATE.md New checklist item added for performance review related to large course setups.

Sequence Diagram(s)

sequenceDiagram
    participant Admin
    participant MainScript
    participant AuthService
    participant UserService
    participant CourseService
    participant ExerciseService

    Admin->>MainScript: Start Course Setup
    MainScript->>AuthService: Authenticate Admin
    AuthService-->>MainScript: Auth Success
    MainScript->>UserService: Create Users
    UserService-->>MainScript: Users Created
    MainScript->>CourseService: Create Course
    CourseService-->>MainScript: Course Created
    MainScript->>UserService: Enroll Users
    UserService-->>MainScript: Users Enrolled
    MainScript->>ExerciseService: Create Programming Exercise
    ExerciseService-->>MainScript: Exercise Created
    MainScript->>UserService: Add Participation
    UserService-->>MainScript: Participation Added
    MainScript->>UserService: Commit Changes
    UserService-->>MainScript: Changes Committed
Loading

Possibly related issues


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 30

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 28, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Outside diff range comments (1)
supporting_scripts/local-course-scripts/large-course-with-programming-exercise-sumbissions-setup/README.md (1)

Line range hint 22-74: Add blank lines around headings, fix unordered list indentation issues, and remove trailing punctuation in headings.

The section should be formatted correctly to improve readability. Remove trailing punctuation in headings.

Apply this diff to add blank lines around headings, fix unordered list indentation issues, and remove trailing punctuation in headings:

 ## Usage

 ### Running the Main Script

-The main script orchestrates the entire process, from user creation to course setup, and finally user participation in programming exercises. To run the script:
+The main script orchestrates the entire process, from user creation to course setup, and finally user participation in programming exercises. To run the script:

-#### 1.Open the project in IntelliJ.
-#### 2.Locate the main.py file in the project directory.
-#### 3.Run main.py:
+#### 1. Open the project in IntelliJ
+#### 2. Locate the main.py file in the project directory
+#### 3. Run main.py

-  You can use the play button within IntelliJ (if Python is configured properly) to run the script.
-  If you want to change the amount of students created, you can modify the `students` variable in the config.ini file.
-  If you want to change the amount of commits each student should perform in the example exercise, you can modify the `comments` variable in the config.ini file.
-  This will automatically perform all the necessary steps:
+  - You can use the play button within IntelliJ (if Python is configured properly) to run the script.
+  - If you want to change the number of students created, you can modify the `students` variable in the config.ini file.
+  - If you want to change the number of commits each student should perform in the example exercise, you can modify the `comments` variable in the config.ini file.
+  - This will automatically perform all the necessary steps:

-1.  Authenticate as admin.
-2.  Create users.
-3.  Create a course.
-4.  Add users to the course.
-5.  Create a programming exercise.
-6.  Add participation and commit for each user.
+  1.  Authenticate as admin.
+  2.  Create users.
+  3.  Create a course.
+  4.  Add users to the course.
+  5.  Create a programming exercise.
+  6.  Add participation and commit for each user.
Tools
LanguageTool

[style] ~3-~3: Specify a number, remove phrase, or simply use “many” or “numerous”
Context: ...s or quickly initializing a course with a large number of students. ## Setup ### 1. Install Pyt...

(LARGE_NUMBER_OF)


[typographical] ~11-~11: To join two clauses or introduce examples, consider using an em dash.
Context: ...Python support in IntelliJ: - Go to File > Project Structure > Facets > Add - Python. - Add a Python environment ...

(DASH_RULE)


[typographical] ~13-~13: To join two clauses or introduce examples, consider using an em dash.
Context: ...d a module in IntelliJ by navigating to File > Project Structure > Modules > Add - Python. ### 2. Configure the Environme...

(DASH_RULE)


[uncategorized] ~36-~36: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...e script. - If you want to change the amount of students created, you can modify the...

(AMOUNTOF_TO_NUMBEROF)


[style] ~38-~38: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...able in the config.ini file. - If you want to change the amount of commits each stude...

(REP_WANT_TO_VB)

Markdownlint

11-11: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


12-12: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


13-13: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


7-7: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


15-15: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


28-28: Punctuation: '.'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


30-30: Punctuation: '.'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


32-32: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


19-19: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


8-8: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


16-16: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 28, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 29, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 29, 2024
Copy link
Contributor

@JohannesStoehr JohannesStoehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, left two inline comments:

Copy link
Contributor

@sarpsahinalp sarpsahinalp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart the from the mentioned unused import code lgtm

Copy link
Contributor

@MarkusPaulsen MarkusPaulsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally:

  1. Add type hints at least to all functions (parameter and return type).
  2. Make the creation of a programming exercise (Step 5) optional, so that we can also use it on an existing programming exercise.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 17

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 3, 2024
Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice and helpful scripts 👍 I added two small suggestions

…-setup-with-programming-exercise-setup' into feature/general/add-large-course-setup-with-programming-exercise-setup
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 4, 2024
florian-glombik
florian-glombik previously approved these changes Sep 4, 2024
Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, all scripts work for me and the description seems clear and understandable to me

Thank you for taking the time for the adjustments! 🙏

What I tested

  • setup as described
  • executing all scripts
    • course creation scripts work
    • large course participation generation works
    • deletion of users from participation generation does not interfere with other course settings

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 5, 2024
florian-glombik
florian-glombik previously approved these changes Sep 5, 2024
Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approve (test) after minor configuration changes since #9252 (review)

Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapprove after minor changes since #9252 (review)

Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code lgtm, thanks for adding the suggestions 👍

Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing the code changes 👍

Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapprove Code 👍

@krusche krusche changed the title General: Add script to create large courses locally Development: Add script to create large courses locally Sep 6, 2024
@krusche
Copy link
Member

krusche commented Sep 6, 2024

Great addition, thank you. For a follow-up: can we also allow to create large courses on test servers?

@krusche krusche merged commit b7aaf44 into develop Sep 6, 2024
25 of 30 checks passed
@krusche krusche deleted the feature/general/add-large-course-setup-with-programming-exercise-setup branch September 6, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

9 participants