-
Notifications
You must be signed in to change notification settings - Fork 301
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
Integrated code lifecycle
: Improve logging when build job times out
#9955
Integrated code lifecycle
: Improve logging when build job times out
#9955
Conversation
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 pmd (7.7.0)src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.javaThe following rules are missing or misspelled in your ruleset file category/vm/bestpractices.xml: BooleanInstantiation, DontImportJavaLang, DuplicateImports, EmptyFinallyBlock, EmptyIfStmt, EmptyInitializer, EmptyStatementBlock, EmptyStatementNotInLoop, EmptySwitchStatements, EmptySynchronizedBlock, EmptyTryBlock, EmptyWhileStmt, ExcessiveClassLength, ExcessiveMethodLength, ImportFromSamePackage, MissingBreakInSwitch, SimplifyBooleanAssertion. Please check your ruleset configuration. WalkthroughThe pull request introduces modifications to three service classes within the build agent module. Enhancements include improved logging for container management in Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.java (1)
180-186
: LGTM! Consider adding error tracking metadata.The timeout handling implementation provides clear user guidance and proper logging. The message effectively communicates:
- The timeout duration
- Potential causes (infinite loop, inefficient code)
- Next steps (code review, instructor contact)
Consider adding structured metadata for error tracking:
if (e instanceof TimeoutException) { + String errorCode = "BUILD_TIMEOUT"; String msg = "Timed out after " + buildJobTimeoutSeconds + " seconds. " + "This may be due to an infinite loop or inefficient code. Please review your code for potential issues. " + "If the problem persists, contact your instructor for assistance. (Build job ID: " + buildJobItem.id() + ")"; buildLogsMap.appendBuildLogEntry(buildJobItem.id(), msg); - log.warn(msg); + log.warn("{} - {}", errorCode, msg); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobContainerService.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobExecutionService.java
(3 hunks)src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.java
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobContainerService.java (1)
Pattern src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobExecutionService.java (1)
Pattern src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.java (1)
Pattern src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
🔇 Additional comments (6)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.java (2)
19-19
: LGTM!
The TimeoutException import is required for the new timeout handling functionality.
Line range hint 377-377
: LGTM! Enhanced log traceability.
Adding the build job ID to the duration log message improves traceability and debugging capabilities.
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobContainerService.java (1)
209-210
: LGTM! Enhanced container operation logging.
Adding container ID logging before the stop operation improves observability and debugging capabilities.
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobExecutionService.java (3)
311-314
: LGTM! Enhanced test results handling observability.
Adding logging for test results directory movement improves traceability and debugging capabilities.
319-322
: LGTM! Enhanced test results collection observability.
Adding logging for test results collection from the container improves traceability and debugging capabilities.
360-363
: LGTM! Enhanced test results parsing observability.
Adding logging for test results parsing improves traceability and debugging capabilities.
…buildjob-timeout-logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timeout log makes sense (code + tested on ts1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on TS1 during testing session. works as expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested on ts1, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on TS1 (as part of a testing session). Worked fine. No problems.
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.java
Outdated
Show resolved
Hide resolved
ed26c49
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.java
(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.java (1)
Pattern src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
🔇 Additional comments (3)
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.java (3)
19-19
: LGTM: Import statement is appropriate
The TimeoutException import is required for the new timeout handling functionality.
180-182
: LGTM: Timeout handling is well-placed
The timeout detection and logging are appropriately placed within the exception handling block, maintaining clean separation of concerns.
196-199
:
Revise the user-facing message content
According to previous discussions, build logs are only accessible to instructors and admins. The current message is written as if addressing students directly.
Consider revising the message to be instructor-focused:
- String msg = "Timed out after " + buildJobTimeoutSeconds + " seconds. "
- + "This may be due to an infinite loop or inefficient code. Please review your code for potential issues. "
- + "If the problem persists, contact your instructor for assistance. (Build job ID: " + buildJobItem.id() + ")";
+ String msg = "Build job timed out after " + buildJobTimeoutSeconds + " seconds. "
+ + "Student code may contain an infinite loop or inefficient implementation. "
+ + "Consider reviewing the submission for these issues. (Build job ID: " + buildJobItem.id() + ")";
src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobManagementService.java
Show resolved
Hide resolved
|
Integrated code lifecycle
: Add a log when buildjob times outIntegrated code lifecycle
: Improve logging when build job times out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussing the changes with @BBesrour I agree that they make sense because students would see the logs when a build fails
Checklist
General
Changes affecting Programming Exercises
Motivation and Context
Resolves #9877
A new line is now added at the end of the logs
Steps for Testing
Prerequisites:
Testserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.
Review Progress
Performance Review
Code Review
Manual Tests
Screenshots
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Documentation