Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Labrador
AuTA
Core
Commits
f4dd9373
Verified
Commit
f4dd9373
authored
Aug 29, 2022
by
Luc Everse
Browse files
Options
Downloads
Patches
Plain Diff
Also send errors to Submit
parent
70f9086e
No related branches found
No related tags found
2 merge requests
!179
Release 2.5.0
,
!177
Submit integration
Pipeline
#737379
passed
Aug 29, 2022
Stage: build-env
Stage: test
Stage: visualize
Stage: jar
Stage: publish
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/java/nl/tudelft/ewi/auta/core/controller/SubmitAppController.java
+36
-3
36 additions, 3 deletions
...tudelft/ewi/auta/core/controller/SubmitAppController.java
with
36 additions
and
3 deletions
core/src/main/java/nl/tudelft/ewi/auta/core/controller/SubmitAppController.java
+
36
−
3
View file @
f4dd9373
...
@@ -262,13 +262,18 @@ public class SubmitAppController extends ControllerBase
...
@@ -262,13 +262,18 @@ public class SubmitAppController extends ControllerBase
try
{
try
{
final
var
url
=
new
URL
(
submitMetadata
.
getUrl
());
final
var
url
=
new
URL
(
submitMetadata
.
getUrl
());
if
(
entityContainer
.
hadException
())
{
this
.
sendError
(
url
,
entityContainer
,
submitMetadata
);
return
;
}
SUBMIT_ACCESS_LEVEL_MAP
.
entrySet
().
stream
().
forEach
(
e
->
{
SUBMIT_ACCESS_LEVEL_MAP
.
entrySet
().
stream
().
forEach
(
e
->
{
try
{
try
{
final
var
report
=
this
.
reportGenerator
.
generateReport
(
final
var
report
=
this
.
reportGenerator
.
generateReport
(
entityContainer
,
Set
.
of
(
e
.
getKey
())
entityContainer
,
Set
.
of
(
e
.
getKey
())
);
);
this
.
sendFeedback
(
url
,
report
,
e
.
getValue
(),
submitMetadata
,
null
);
this
.
sendFeedback
(
url
,
report
,
e
.
getValue
(),
submitMetadata
,
null
,
true
);
}
catch
(
final
IOException
|
TemplateException
ex
)
{
}
catch
(
final
IOException
|
TemplateException
ex
)
{
logger
.
error
(
"Could not template report"
,
ex
);
logger
.
error
(
"Could not template report"
,
ex
);
}
}
...
@@ -280,6 +285,30 @@ public class SubmitAppController extends ControllerBase
...
@@ -280,6 +285,30 @@ public class SubmitAppController extends ControllerBase
}
}
}
}
/**
* Sends an internal error to Submit.
*
* @param url the URL to send the error to
* @param entityContainer the container of the entity that caused the error
* @param submitMetadata metadata to be attached to the error message
*/
private
void
sendError
(
final
URL
url
,
final
EntityContainer
entityContainer
,
final
SubmitAppMetadata
submitMetadata
)
{
// Send the first bit of feedback with a "true" success, because sending an error locks
// down the submission's feedback
this
.
sendFeedback
(
url
,
"The script encountered an internal error and could not finish checking "
+
"your submission."
,
"STUDENT"
,
submitMetadata
,
null
,
true
);
this
.
sendFeedback
(
url
,
entityContainer
.
getExceptionMessage
(),
"TA"
,
submitMetadata
,
null
,
false
);
}
/**
/**
* Sends a report to Submit.
* Sends a report to Submit.
*
*
...
@@ -288,13 +317,16 @@ public class SubmitAppController extends ControllerBase
...
@@ -288,13 +317,16 @@ public class SubmitAppController extends ControllerBase
* @param visibleFor for whom the report should be visible
* @param visibleFor for whom the report should be visible
* @param submitMetadata metadata to be attached to the feedback
* @param submitMetadata metadata to be attached to the feedback
* @param score the final score, if any
* @param score the final score, if any
* @param success whether the feedback is part of a successful run (true) or a script failure
* (false)
*/
*/
private
void
sendFeedback
(
private
void
sendFeedback
(
final
URL
url
,
final
URL
url
,
final
@Nullable
String
report
,
final
@Nullable
String
report
,
final
String
visibleFor
,
final
String
visibleFor
,
final
SubmitAppMetadata
submitMetadata
,
final
SubmitAppMetadata
submitMetadata
,
final
@Nullable
Integer
score
final
@Nullable
Integer
score
,
final
boolean
success
)
{
)
{
try
{
try
{
final
var
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
final
var
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
...
@@ -312,6 +344,7 @@ public class SubmitAppController extends ControllerBase
...
@@ -312,6 +344,7 @@ public class SubmitAppController extends ControllerBase
body
.
visibleFor
=
visibleFor
;
body
.
visibleFor
=
visibleFor
;
body
.
textualFeedback
=
report
;
body
.
textualFeedback
=
report
;
body
.
score
=
score
;
body
.
score
=
score
;
body
.
success
=
success
;
this
.
gson
.
toJson
(
body
,
writer
);
this
.
gson
.
toJson
(
body
,
writer
);
writer
.
flush
();
writer
.
flush
();
}
}
...
@@ -352,7 +385,7 @@ public class SubmitAppController extends ControllerBase
...
@@ -352,7 +385,7 @@ public class SubmitAppController extends ControllerBase
score
,
submitMetadata
.
getSubmissionId
(),
submitMetadata
.
getScriptId
()
score
,
submitMetadata
.
getSubmissionId
(),
submitMetadata
.
getScriptId
()
);
);
this
.
sendFeedback
(
url
,
null
,
"STUDENT"
,
submitMetadata
,
score
);
this
.
sendFeedback
(
url
,
null
,
"STUDENT"
,
submitMetadata
,
score
,
true
);
}
}
/**
/**
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment