Skip to content

Commit

Permalink
Merge branch 'master' into lp-link-twtr
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahima committed Mar 15, 2018
2 parents cc27024 + f4bb889 commit 7f316cf
Show file tree
Hide file tree
Showing 45 changed files with 326 additions and 50 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ distributing the results back to students and to you.

<a class="btn" href="https://lp.gradescope.com/instructors?utm_medium=autograder-post&utm_campaign=autograder-twtr&utm_source=ReadTheDocs">Try Gradescope, it's Free!</a>

## Public Beta

The autograder platform is currently free in public beta. Once the feature is
out of beta, it will no longer be free, but we won’t interrupt usage in the
middle of the term.

# How it works

As an instructor, you create a new assignment on Gradescope, and
Expand All @@ -42,3 +36,16 @@ any further questions, feel free to contact us at
- [Python](python/)
- [Java (JUnit)](java/)
- [Java+Maven](java-mvn/)

# Pricing

Starting Fall 2017, the autograder platform will be available with
paid school site licenses and for individual courses that pay for
access to our "Gradescope Complete" tier (see our [pricing
page](https://gradescope.com/pricing) for more information).

If you're an existing user or have any questions regarding pricing,
please contact us at
[help@gradescope.com](mailto:help@gradescope.com). If you want to
experiment with the platform to see if it works for you, feel free to
contact us for trial access.
Binary file added advanced_settings.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assignment_details.png
Binary file not shown.
Binary file added assignment_form.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assignments.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build_status.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified configure_autograder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions deploy_keys/run_autograder
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

BASE_DIR=/autograder/autograder_samples/python/src

# Update autograder files
cd /autograder/autograder_samples
git pull

cp /autograder/submission/calculator.py $BASE_DIR/calculator.py

pip install -r $BASE_DIR/requirements.txt

cd $BASE_DIR

python run_tests.py > /autograder/results/results.json
17 changes: 17 additions & 0 deletions deploy_keys/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

cd /autograder/source

apt-get install -y python python-pip python-dev

mkdir -p /root/.ssh
cp ssh_config /root/.ssh/config
# Make sure to include your private key here
cp deploy_key /root/.ssh/deploy_key
# To prevent host key verification errors at runtime
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts

# Clone autograder files
git clone git@github.com:gradescope/autograder_samples /autograder/autograder_samples
# Install python dependencies
pip install -r /autograder/autograder_samples/python/src/requirements.txt
3 changes: 3 additions & 0 deletions deploy_keys/ssh_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Host github.com
IdentityFile ~/.ssh/deploy_key
IdentitiesOnly yes
8 changes: 4 additions & 4 deletions getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
If you haven't made an account on Gradescope, sign up as an instructor at
[Gradescope.com](https://gradescope.com/).

Currently, programming assignments are in beta, so you'll need to
request access to the feature by emailing
[help@gradescope.com](mailto:help@gradescope.com).
Programming assignments are part of [Gradescope Complete](https://gradescope.com/pricing),
so you'll need to either upgrade your course, or request trial access to the feature by
emailing [help@gradescope.com](mailto:help@gradescope.com).

You'll need to have a course set up, so create one if you don't have one.

Expand All @@ -21,7 +21,7 @@ Programming Assignment" in the bottom bar.
You'll be asked for some basic details about your assignment. Choose
the appropriate options and continue.

[![Assignment](assignment_details.png)](assignment_details.png)
[![Assignment](assignment_form.png)](assignment_form.png)

Next you'll be asked to upload your autograder. Upload a zip file
meeting the required [specifications](specs), and press "Update
Expand Down
43 changes: 43 additions & 0 deletions git_pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Pulling Autograder from Git

To speed up autograder development, you can pull your autograder from a Git
repository. This will allow you to avoid long setup times when testing changes
to your autograder. You will still want to put common setup in your `setup.sh` or
`Dockerfile`, to avoid having to install things on each autograder run. You may
also want to include a copy of the repository in the base image, so that
autograder runs don't have to clone it from scratch.

If you just want to jump in, you can check out our
[example](https://github.com/gradescope/autograder_samples/tree/master/deploy_keys).
When using this, make sure to generate a keypair, and include your private key
file in your autograder zip file or Docker image.

## Setting up your SSH configuration

You should set up your ssh config so that Git knows to use the correct private
key when pulling. Your configuration should look something like the following:

```
Host github.com
IdentityFile ~/.ssh/deploy_key
IdentitiesOnly yes
```

Make sure to include the private key in your autograder image, and copy it to
the right place.

You should also make sure to include the host keys for your git server, so that
you don't get a host key verification error at runtime. You can do this by
running something like

```
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
```

in your setup script.

## Github Deploy Keys

Github has a
[deploy keys](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys)
feature, which allows you to set up a read-only key without a passphrase for the purpose of pulling down your autograder. Follow their instructions on how to generate a new keypair, and add the public key to your Github repository. Then, you can configure SSH to use the private key when connecting to github.com as described above.
2 changes: 1 addition & 1 deletion gradescope.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.wy-side-nav-search {
background-color: #1ba2bb
background-color: #1b827f;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* <li>name: String that specifies the name of the test.</li>
* <li>number: String that specifies the number of the test.</li>
* <li>points: Double that specifies the number of points that the test is worth.</li>
* <li>visibility: String that specifies the visibility condition for the test.</li>
* </ul>
*/
@Retention(RetentionPolicy.RUNTIME)
Expand All @@ -46,4 +47,5 @@ private None() {
String name() default "Unnamed test";
String number() default "";
double max_score() default 1.0;
String visibility() default "visible";
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ private static double getTestMaxScore(GradedTest x) throws
return getAnnotationDouble(x, "max_score");
}

private static String getTestVisibility(GradedTest x) throws
IllegalAccessException, InvocationTargetException {
return getAnnotationString(x, "visibility");
}

/** Returns the name of a test as stored in an annotation.
* TODO: Is there a more elegant way to do this? */
Expand All @@ -110,9 +114,9 @@ public void testStarted(Description description) throws Exception {
String testName = getTestName(gradedTestAnnotation);
String testNumber = getTestNumber(gradedTestAnnotation);
double testMaxScore = getTestMaxScore(gradedTestAnnotation);

String visibility = getTestVisibility(gradedTestAnnotation);
/* Capture StdOut (both ours and theirs) so that we can relay it to the students. */
currentTestResult = new TestResult(testName, testNumber, testMaxScore);
currentTestResult = new TestResult(testName, testNumber, testMaxScore, visibility);

/* By default every test passes. */
currentTestResult.setScore(testMaxScore);
Expand Down Expand Up @@ -157,4 +161,4 @@ public void testAssumptionFailure(Failure failure) {
public void testIgnored(Description description) throws Exception {
System.out.println("Ignored: " + description.getMethodName());
}
*/
*/
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ private static double getTestMaxScore(GradedTest x) throws
return getAnnotationDouble(x, "max_score");
}

private static String getTestVisibility(GradedTest x) throws
IllegalAccessException, InvocationTargetException {
return getAnnotationString(x, "visibility");
}


/** Returns the name of a test as stored in an annotation.
* TODO: Is there a more elegant way to do this? */
Expand Down Expand Up @@ -136,9 +141,10 @@ public void testStarted(Description description) throws Exception {
String testName = getTestName(gradedTestAnnotation);
String testNumber = getTestNumber(gradedTestAnnotation);
double testMaxScore = getTestMaxScore(gradedTestAnnotation);
String visibility = getTestVisibility(gradedTestAnnotation);

/* Capture StdOut (both ours and theirs) so that we can relay it to the students. */
currentTestResult = new TestResult(testName, testNumber, testMaxScore);
currentTestResult = new TestResult(testName, testNumber, testMaxScore, visibility);

/* By default every test passes. */
currentTestResult.setScore(testMaxScore);
Expand Down
11 changes: 6 additions & 5 deletions java/src/main/java/com/gradescope/jh61b/grader/TestResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
public class TestResult {
final String name;
final String number;
final double maxScore;
final double maxScore;
double score;

final String visibility;

/* outputSB is any text that we want to relay to the user when teh test is done running. */
private StringBuilder outputSB;


/* private List<String> tags; // Not yet implemented */
/* private String visibility; Can be always, published, or never. Not yet implemented. */


public TestResult(String name, String number, double maxScore) {
public TestResult(String name, String number, double maxScore, String visibility) {
this.name = name;
this.number = number;
this.maxScore = maxScore;
this.outputSB = new StringBuilder();
this.visibility = visibility;
}

public void setScore(double score) {
Expand All @@ -44,6 +44,7 @@ public String toJSON() {
String.format("\"%s\": \"%s\"", "number", number),
String.format("\"%s\": %s", "score", score),
String.format("\"%s\": %s", "max_score", maxScore),
String.format("\"%s\": \"%s\"", "visibility", visibility),
String.format("\"%s\": \"%s\"", "output", noQuotes)
}) + "}";
}
Expand Down
2 changes: 2 additions & 0 deletions java_template/src/com/gradescope/jh61b/grader/GradedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* <li>name: String that specifies the name of the test.</li>
* <li>number: String that specifies the number of the test.</li>
* <li>points: Double that specifies the number of points that the test is worth.</li>
* <li>visibility: String that specifies the visibility condition for the test.</li>
* </ul>
*/
@Retention(RetentionPolicy.RUNTIME)
Expand All @@ -46,4 +47,5 @@ private None() {
String name() default "Unnamed test";
String number() default "";
double max_score() default 1.0;
String visibility() default "visible";
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ private static double getTestMaxScore(GradedTest x) throws
return getAnnotationDouble(x, "max_score");
}

private static String getTestVisibility(GradedTest x) throws
IllegalAccessException, InvocationTargetException {
return getAnnotationString(x, "visibility");
}

/** Returns the name of a test as stored in an annotation.
* TODO: Is there a more elegant way to do this? */
Expand All @@ -110,9 +114,9 @@ public void testStarted(Description description) throws Exception {
String testName = getTestName(gradedTestAnnotation);
String testNumber = getTestNumber(gradedTestAnnotation);
double testMaxScore = getTestMaxScore(gradedTestAnnotation);

String visibility = getTestVisibility(gradedTestAnnotation);
/* Capture StdOut (both ours and theirs) so that we can relay it to the students. */
currentTestResult = new TestResult(testName, testNumber, testMaxScore);
currentTestResult = new TestResult(testName, testNumber, testMaxScore, visibility);

/* By default every test passes. */
currentTestResult.setScore(testMaxScore);
Expand Down Expand Up @@ -157,4 +161,4 @@ public void testAssumptionFailure(Failure failure) {
public void testIgnored(Description description) throws Exception {
System.out.println("Ignored: " + description.getMethodName());
}
*/
*/
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ private static double getTestMaxScore(GradedTest x) throws
return getAnnotationDouble(x, "max_score");
}

private static String getTestVisibility(GradedTest x) throws
IllegalAccessException, InvocationTargetException {
return getAnnotationString(x, "visibility");
}


/** Returns the name of a test as stored in an annotation.
* TODO: Is there a more elegant way to do this? */
Expand Down Expand Up @@ -136,9 +141,10 @@ public void testStarted(Description description) throws Exception {
String testName = getTestName(gradedTestAnnotation);
String testNumber = getTestNumber(gradedTestAnnotation);
double testMaxScore = getTestMaxScore(gradedTestAnnotation);
String visibility = getTestVisibility(gradedTestAnnotation);

/* Capture StdOut (both ours and theirs) so that we can relay it to the students. */
currentTestResult = new TestResult(testName, testNumber, testMaxScore);
currentTestResult = new TestResult(testName, testNumber, testMaxScore, visibility);

/* By default every test passes. */
currentTestResult.setScore(testMaxScore);
Expand Down
11 changes: 6 additions & 5 deletions java_template/src/com/gradescope/jh61b/grader/TestResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
public class TestResult {
final String name;
final String number;
final double maxScore;
final double maxScore;
double score;

final String visibility;

/* outputSB is any text that we want to relay to the user when teh test is done running. */
private StringBuilder outputSB;


/* private List<String> tags; // Not yet implemented */
/* private String visibility; Can be always, published, or never. Not yet implemented. */


public TestResult(String name, String number, double maxScore) {
public TestResult(String name, String number, double maxScore, String visibility) {
this.name = name;
this.number = number;
this.maxScore = maxScore;
this.outputSB = new StringBuilder();
this.visibility = visibility;
}

public void setScore(double score) {
Expand All @@ -44,6 +44,7 @@ public String toJSON() {
String.format("\"%s\": \"%s\"", "number", number),
String.format("\"%s\": %s", "score", score),
String.format("\"%s\": %s", "max_score", maxScore),
String.format("\"%s\": \"%s\"", "visibility", visibility),
String.format("\"%s\": \"%s\"", "output", noQuotes)
}) + "}";
}
Expand Down
8 changes: 8 additions & 0 deletions java_template/src/edu/youruniversity/hw1/MyTestClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@ public void test_1p1() {
System.out.println("Tested 1+1, got " + x);
assertEquals(x, 2);
}

@Test
@GradedTest(name="Test 1+1*2", max_score=1, visibility="after_published")
public void test_1p1t2() {
int x = 1 + 1 * 2;
System.out.println("Tested 1+1*2, got " + x);
assertEquals(x, 3);
}
// Add more tests...
}
Binary file added leaderboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added leaderboard_setting.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7f316cf

Please sign in to comment.