我们正在试验和评估 GitHub Classroom 和 GitHub Actions 的“自动评分”。
在我们的作业中,如果单元测试通过,学生会得到分数。所以 autograding.json 运行起来比较简单mvn test -Dtest=testClass#testmethod。
在默认设置中,我对以下几点不满意:
如果构建(即测试)失败,GitHub (Actions) 会向您发送邮件,但如果测试成功,您将不会收到邮件。如果学生在通过自动评分(即单元测试)时得到反馈,那就太好了。如何才能做到这一点?
GitHub (Actions) 不会在邮件中提供任何详细信息,您必须访问操作页面。如果您能提供点数以及对错误的一些单行解释,那就更好了。如何才能做到这一点?
为了说明我想要什么:如果 JSON 允许指定成功时的反馈消息和失败时的反馈消息并且GitHub Action 邮件应包含此文本(如果不可能,则应该有一个格式良好的显示此文本的网页)。不幸的是,我没有找到有关 JSON 的任何文档。是否有 autograde.json 的任何文档?
我也对其他选择感兴趣。
以下是我们目前使用的 autograde.json 的示例:
{
"tests": [
{
"name": "Unit Tests - Testing your Application: DoubleVector - BasicFunctionality",
"setup": "",
"run": "mvn -q -B -Dtest=DoubleVectorFromArrayTest#testBasicFunctionality test",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 0.5
},
{
"name": "Unit Tests - Testing your Application: DoubleVector - …Run Code Online (Sandbox Code Playgroud) 如果激活了某个配置文件(此处为“java8”),我们的 maven pom.xml 指定添加额外的源和测试源文件夹。pom的相应部分如下所示
<profile>
<id>java8</id>
....
<build>
<plugins>
....
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals><goal>add-test-source</goal></goals>
<configuration>
<sources>
<source>src/test/java8</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Run Code Online (Sandbox Code Playgroud)
根据http://mojo.codehaus.org/build-helper-maven-plugin/usage.html,这似乎是正确的规范。
运行时mvm install -P java8我发现附加测试已按预期执行。
但是,运行mvm eclipse:eclipse -P java8附加测试源文件夹不会出现在 eclipse 中.classpath。
问题:如何配置 maven 将测试源文件夹添加到 eclipse 配置中?上述行为是错误还是配置错误?
假设 lambda 表达式消耗一定量的资源(例如内存),该资源是有限的,需要限制并发执行的数量(例如:如果 lambda 暂时消耗 100 MB(本地内存),我们希望将其限制为 1GB ,我们不允许超过 10 个并发评估)。
限制并发执行数量的最佳方法是什么,例如
IntStream.range(0, numberOfJobs).parallel().foreach( i -> { /*...*/ });
Run Code Online (Sandbox Code Playgroud)
?
注意:一个明显的选择是执行嵌套
double jobsPerThread = (double)numberOfJobs / numberOfThreads;
IntStream.range(0, numberOfThreads).parallel().forEach( threadIndex ->
IntStream.range((int)(threadIndex * jobsPerThread), (int)((threadIndex+1) * jobsPerThread)).sequential().forEach( i -> { /*...*/ }));
Run Code Online (Sandbox Code Playgroud)
这是唯一的方法吗?Tt 没那么优雅。其实我想要一个
IntStream.range(0, numberOfJobs).parallel(numberOfThreads).foreach( i -> { /*...*/ });
Run Code Online (Sandbox Code Playgroud) 当硬件键盘连接到 iOS 设备 (iPad) 时,软件键盘的一小部分仍然可见:带有建议词的工具栏以及撤消和重做按钮。
最初我希望推断键盘高度的记录方法(参见https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html) - 在这种情况下 - 只是给出这个酒吧的高度。但是,报告的高度仍然是完整软件键盘的高度(尽管只有一部分可见)。
当连接了硬件键盘时,我们如何获得可见软件键盘的高度?