How to automatically gather or collect assignments?


(Geoffrey Ryan) #1

Hi all,

Once an assignment has been created and the due date has come up, is there any quick way of cloning all the submissions to my local machine? Preferably adding a tag to mark the commit that is being graded? I remember hearing about a tool, teachers_pet (?), that may have had this sort of functionality but I’m not sure if its still supported.

Thanks!

Best,

Geoff


Is there any way to automatically enable TravisCI for assignments?
(Yann Le Scouarnec) #2

Looks like a match?


(Geoffrey Ryan) #3

It is, but I wasn’t sure if its supported to work with Classroom, or what the recommended way of collecting assignments is.


(Berg Prof J) #4

teachers_pet was created before GitHub Classroom came along, I believe…so it’s unclear to me how to gather/collect work from student’s individual copies of the assignment repository (i.e. the copies they made by “accepting” the assignment thru GitHub Classroom), since they are not necessarily in teams. I tried to use it to do so using the “clone_repos” command, including my organization name and the “prefix” for the assignment repository, but it errors out because there are no teams for each student.


(Keith Chappelow) #5

I was wondering the same thing. I’ve created a couple of windows batch files to clone and tag the student’s repositories. I also created one that would do a pull from each since they sometimes turn things in late. :slight_smile:


cloneHW.bat

@echo off
REM ---------------------------------------------------------------------------
REM     GitHub Classroom clone homework
REM 
REM		INSTRUCTIONS:
REM		1) Run this file specifying the homework name
REM ---------------------------------------------------------------------------

setlocal
@echo 

if "x%1x" == "xx" goto displayUsage
set "CURRENT_DIR=%cd%"

git clone https://github.com/KVCC-Java/%1-student1.git
cd "%1-student1"
git tag -a grading -m "grading this version"
git push origin grading
cd "%CURRENT_DIR%"

git clone https://github.com/KVCC-Java/%1-student2.git
cd "%1-student2"
git tag -a grading -m "grading this version"
git push origin grading
cd "%CURRENT_DIR%"

goto end

:displayUsage
echo.
echo Usage: cloneHW [homework name]
pause
goto end

:end

pullHW.bat

@echo off
REM ---------------------------------------------------------------------------
REM     GitHub Classroom pull homework
REM 
REM		INSTRUCTIONS:
REM		1) Run this file specifying the homework name
REM ---------------------------------------------------------------------------

setlocal
@echo 

if "x%1x" == "xx" goto displayUsage

set "CURRENT_DIR=%cd%"

cd "%CURRENT_DIR%\%1-student1"
git pull
git tag -a grading -m "grading this version"
git push origin grading

cd "%CURRENT_DIR%\%1-student2"
git pull
git tag -a grading -m "grading this version"
git push origin grading

goto end

:displayUsage
echo.
echo Usage: pullHW [homework name]
pause
goto end

:end
cd "%CURRENT_DIR%"

(Geoffrey Ryan) #6

Thanks all!

Turns out there have been a few threads looking at this. Sounds like they’re working on adding it as a feature to Classrooms, but its not there yet. I’m taking the route of @kchappelow, and writing a bash script to automate it in the meantime. Good opportunity to learn bash!


(Sdexter72) #7

I feel compelled to add my voice to this thread. I’ve been using teachers_pet for a couple years with great success; I’m a huge fan. It seems like GitHub Classroom is a direct spinoff from that project, but Classroom has only 10% of the functionality. There’s no way for me to break my ‘classroom’ into sections, there’s no obvious way (as discussed on this thread) to do a mass clone for grading. I’m not sure why teachers_pet is advising people to move to Classroom at this time. For my next assignment, I’ll be going back to teachers_pet—it takes a little more setup, in that the instructor has to provide a list of students’ GitHub usernames, but there is ample documentation (unlike Classroom), and it does what you want it to do.


(Keith Chappelow) #8

I’ve converted these scripts to bash scripts:


#!/bin/bash
# ---------------------------------------------------------------------------
#     GitHub Classroom clone homework
# 
#		INSTRUCTIONS:
#		1) Run this file specifying the homework name and optional tagname
# ---------------------------------------------------------------------------
if [ -z "$1" ]
then
   echo Usage: cloneHW [homework_name] [tagname]
   exit 1
fi
if [ -z "$2" ]
then
  tagname="grading"
else
  tagname="$2"
fi

currentdir=$(pwd)

git clone https://github.com/KVCC-Java/$1-student1.git
cd "$1-student1"
git tag -a $tagname -m "grading this version"
git push origin $tagname
cd "$currentdir"

git clone https://github.com/KVCC-Java/$1-student2.git
cd "$1-student2"
git tag -a $tagname -m "grading this version"
git push origin $tagname
cd "$currentdir"

#!/bin/bash
# ---------------------------------------------------------------------------
#     GitHub Classroom pull homework
# 
#		INSTRUCTIONS:
#		1) Run this file specifying the homework name and tagname
# ---------------------------------------------------------------------------
if [ -z "$1" ]
then
   echo Usage: pullHW [homework_name] [tagname]
   exit 1
fi
if [ -z "$2" ]
then
  tagname="grading"
else
  tagname="$2"
fi

currentdir=$(pwd)

cd "$currentdir/$1-student1"
git pull
git tag -a $tagname -m "grading this version"
git push origin $tagname

cd "$currentdir/$1-student2"
git pull
git tag -a $tagname -m "grading this version"
git push origin $tagname

cd "$currentdir"

(Geoffrey Ryan) #9

I wrote a bash script to automate most of this! https://github.com/geoffryan/classroom-util

It’s initial form was based on what @kchappelow posted above. Thanks!

The script has a few modes, and assumes there is a file students.txt that is a list of usernames to expect assignments from.

  • “Collect” either clones/pulls (as appropriate) all submissions for a particular assignment
  • “Grade” Loops through all repos in an assignment, finds the most recent commit before a given due date, tags it as “Graded” and makes a new grading branch at that commit.
  • “Return” will loop through all repos, merge the grading branch into master, and push to origin.

The “Grade” will just a be file I add grade.txt with the score and comments, so automatically merging the grading branch back into master shouldn’t be a problem I think.

Is this similar to how any of you have been using Classroom?


(Dhowe) #10

I was hoping such things would be built in to classroom – no such luck. But yes, this sounds like a good workflow…


(Peter Dave Hello) #11

Agree, teachers_pet is good and useful, really hope GitHub can keep the development works their to make it much more powerful.


(Joey Freund) #12

Warning: Shameless promotion ahead (-:

Allowing for various batch operations and flexible workflows is one of the main reasons why I built https://gitomator.github.io/

It’s still in pre-alpha, but is already serving a few of us (at the University of Toronto) very well. Iwill be really happy to get more people to start using it (and, perhaps, even contributing changes).


(Richard) #13

Hi @joeyfreund that seems very interesting. I currently have a set of teachers_pet and travis scripts that do pretty much the same thing, but this may be tidier.


(Joey Freund) #14

@rcraggs , thanks. I would love to have a few more people using it (right now, it’s only myself and a few colleagues here at UofT) and be able to move from pre-alpha to alpha as soon as possible.

If you need any help using Gitomator, please let me know - Since the project is at such an early stage, you can expect the occasional bug here and there, but you also get to enjoy a highly personalized tech-support service :slight_smile:


(Rob Hess) #15

Since several folks have shared their scripts for downloading student assignments, I figured I’d share mine:

GitHub Classroom Desktop looks like it could be a great tool, but it also looks like development on it has stalled (no commits for more than a month). Anyone know the status of that project?


(John Britton) #16

We are still planning to release GitHub Classroom Desktop, but don’t have an ETA right now.


(Dov Kruger) #17

I take it there is no automatic way to find out what repos start with homework1- ?
It’s not the worst thing in the world to have to build a file with the students names, but I would rather not maintain that.

Is there any way to download all the repos for my organization? I can get it on screen:

Feature request! I want a REST API that returns a list of:

github.com/api/v1/getrepos?org=StevensDeptECE&prefix=CPE593HW

it would return some JSON like:
[
[“CPE593HWinsertion-sort-student1”, 20170118175803],
[“CPE593HWinsertion-sort-student2”, 20170118181015]
]

where the second number is a timestamp.
This way, we could just go for the ones that have changed.


(Rob Hess) #18

@hydrodog, check out the get_repo_urls() function in my script above. It uses the GitHub API to get a list of all the repos in an organization, selects only the repos that start with a given prefix, and then gets the clone URLs for those repos. Sounds like that’s close to what you want to do.


(Oliver Steele) #19

Also check out the download_repo_fork_files.py script in https://github.com/olin-computing/classroom-tools, documented here. Used as:

./scripts/download_repo_fork_files.py org_name/repo_name

it downloads forks of the given repository. As:

./scripts/download_repo_fork_files.py --classroom org_name/repo_name

it downloads repos username/repo_name-$login in the same account. (This is the schema used by GitHub Classroom.)

This script omits repos that belong to members of org_name, and it omits files that are unchanged between the source repo and the fork.


(Bramus!) #20

If the student projects have dependencies installed by a dependency manager such as Composer (PHP) or NPM (Node), then https://www.bram.us/2014/02/16/installing-dependencies-in-all-subfolder-organised-projects/ might come in handy. It’s a one-liner to installing all dependencies for all (cloned) repos.