close

Вход

Забыли?

вход по аккаунту

?

How to develop with infandango Documentation - Read the Docs

код для вставки
How to develop with infandango
Documentation
Release
Mike Hull
July 14, 2014
Contents
1
Overview
1
2
Contents
2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Using Infandango . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 For Developers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
3
3
9
i
ii
CHAPTER 1
Overview
Infandango is a software infrastructure for automatic code submission, testing and analysis. It was built for a Year 1
undergraduate course in Java programming in the School of Informatics, University of Edinburgh. The code can be
used for a variety of tasks involving automated code testing; student programming courses; and code auto marking.
1
How to develop with infandango Documentation, Release
2
Chapter 1. Overview
CHAPTER 2
Contents
2.1 Overview
2.1.1 Features
2.1.2 Screenshots
2.1.3 Where is it being used
2.2 Using Infandango
2.2.1 Installation Guide
Contents
• Installation Guide
– Install Prerequisite Packages
– Clone the Repository
– Set environmental variables
– Install MathJax
– Add your machine’s hostname to the configuration:
– Install PostgreSQL
– Set up the PostgreSQL database
– Start the development server
– Jester
This document will walk you through an install of Infandango on a clean install of Ubuntu 11.10. There are also hints
for Fedora and MacOS X,
Install Prerequisite Packages
You will need the following packages:
• Mercurial
• Django (1.3)
3
How to develop with infandango Documentation, Release
• python-xlwt (Python libraries for reading/writing excel files for csv output) (which needs matplotlib...)
• Beautiful Soup (python-beautifulsoup)
• Postgresql
• Postgres python bindings (psycopg2)
• Cheetah
• Pygments
• Sphinx
• Latex (pdflatex) [For rendering formula; the base is not enough, because it won’t contain utf8x.def ]
• dvipng [for displaying equations]
• Java JRE & junit4
• MathJax
• reportlab
Todo
Divide list into Python vs the rest? Give links to PyPi? Pull out Ubuntu-specific instructions.
Todo
Check: Do we need dvipng and MathJax??
Debian/Ubuntu
If you are running a Debian/Ubuntu variant, most of this can be installed with apt.
$ sudo apt-get install python-django python-beautifulsoup \
python-cheetah python-pygments python-sphinx \
mercurial \
postgresql python-psycopg2 \
texlive-latex-base texlive-latex-extra dvipng
texlive-fonts-recommended \
openjdk-6-jre junit4 openjdk-6-jdk \
python-xlwt \
python-matplotlib \
Fedora
An installation was successfully created on Fedora. The following packages were installed; some may be unnecessary.
4
Chapter 2. Contents
How to develop with infandango Documentation, Release
• agg
• postgresql-docs
• python-matplotlib-doc
• django
• postgresql-libs
• python-nose
• dvipng
• postgresql-server
• python-psycopg2
• hamcrest
• pyparsing
• python-psycopg2-doc
• java-1.6.0-openjdk-devel
• python-babel
• python-pygments
• java-1.6.0-openjdk-javadoc
• python-cheetah
• python-reportlab
• junit4
• python-dateutil
• python-setuptools
• junit4-javadoc
• python-docutils
• python-sphinx
• junit4-manual
• python-imaging
• python-sphinx-doc
• kpathsea
• python-jinja2
• pytz
• mercurial
• python-markdown
• qdox
• numpy
• python-markupsafe
• rst2pdf
• postgresql
• python-matplotlib
• t1lib
texlive, texlive-latex, and many related packages were also installed.
MacOS X
If running MacOS, most of the packages can be obtained from from MacPorts. We’ll assume that you are using
python27 as your base installation, in which case something like the following should work:
$ sudo port install py27-django py27-beautifulsoup \
py27-cheetah py27-sphinx py27-matplotlib \
mercurial dvipng
It is advisable to use this One Click Installer for PostgreSQL (which includes the handy pgAdmin) rather than installing from MacPorts. After you have installed PostgreSQL, get xlwt and psycopg2 from http://pypi.python.org
(otherwise MacPorts will try to re-install PostgreSQL as a dependency):
$ easy_install xlwt psycopg2
The best way to install LaTeX is to download the latest TeXLive release from MacTex.
Before installing MathJax, set up your local repository for Infandango first, as described next.
2.2. Using Infandango
5
How to develop with infandango Documentation, Release
Clone the Repository
Clone the Infandango repository into a suitable directory on your local machine, such as /home/myaccount/hg.
In what follows, we’ll use <inf> to refer to this directory.
$ cd /home/myaccount/hg
$ hg clone ssh://[email protected]/ewan/infandango
This will create a new directory /home/myaccount/hg/infandango.
Set environmental variables
We need to add the command Infandango (which is actually an alias) to your shell PATH and to the PYTHONPATH.
We also need to point to the infandango directory, so that lots of things happen automatically. Put the following in
your shell startup file, e.g. ~/.bashrc:
export INFANDANGO_ROOT="<inf>/infandango/"
export INFANDANGO_CONFIGFILE="<inf>/infandango/examples/sample_config/infandango_conf.py"
# Add infandango to your executable path
export PATH="$PATH:$INFANDANGO_ROOT:"
In these instructions, replace <inf> by the full path of the directory into which you cloned the Infandango repository,
e.g., /home/myaccount/hg. The files in infandango/examples/sample_config are a subset of those
used for the University of Edinburgh’s INF1-OP course.
Source the ~/.bashrc to apply the changes:
$ source ~/.bashrc
Now if you run the command Infandango, you should be told that the database is not set up properly.
Install MathJax
You can install MathJax anywhere convenient. Let’s assume you put it in the directory ~/mjx. First off, download
the code from github:
$
$
$
$
cd ~
mkdir mjx
cd mjx
git clone git://github.com/mathjax/MathJax.git MathJax
In order for Infandango to find MathJax, add a symbolic link to Infandango’s Javascript directory, as follows:
$ cd <inf>/infandango/src/labs/frontend/infandango-fe/static/javascript/
$ ln -s ~/mjx/MathJax/ mathjax
Add your machine’s hostname to the configuration:
For both development and deployment, Infandango is run on many machines under various software configurations.
When developing locally, it is convienient to using the included Django web browser and sqlite, but on the production
server we use Apache and PostgreSQL. To allow everything to work, configuration is based on hostname. You can
find the hostname of your machine by typing the command hostname at a terminal.
Put this hostname (as a quoted string) into the list which is assigned as value of the variable development_hosts
in $INFANDANGO_ROOT/src/labs/infandango/locations.py.
6
Chapter 2. Contents
How to develop with infandango Documentation, Release
Install PostgreSQL
Infandango stores all of its information in a database called infandango_new, which is accessed through two usernames
wango and jester. The passwords are both the same as the usernames. The steps differ according to operating system.
Ubuntu
If you are running under Ubuntu, you will need to do the following.
1. Edit the pg_hba.conf file to allow local password logins:
$ sudo gvim /etc.postgresql/9.1/main/pg_hba.conf
2. Change the line near the bottom to accept local connections with passwords:
<FROM:> local all all peer
<TO:>
local all all md5
3. Then reload PostgreSQL:
$ sudo /etc/init.d/postgresql restart
MacOS X
The pg_hba.conf is already configured correctly if you use the MacOS X package for PostgreSQL recommended
above.
Fedora
The steps above are not required on Fedora; however PostgreSQL will not be configured to start automatically after
installation, so must be started manually. For example,
$ su - postgres
$ /usr/bin/postgres -D /var/lib/pgsql/data
Set up the PostgreSQL database
You will need to add the users wango and jester to the database. You can do this via the command-line as follows:
$ sudo -u
Shall the
Shall the
Shall the
postgres
new role
new role
new role
createuser wango
be a superuser? (y/n) n
be allowed to create databases? (y/n) y
be allowed to create more new roles? (y/n) n
$ sudo -u
Shall the
Shall the
Shall the
postgres
new role
new role
new role
createuser jester
be a superuser? (y/n) n
be allowed to create databases? (y/n) y
be allowed to create more new roles? (y/n) n
You can also add these users via the pgAdmin GUI.
Now change the password for the PostgreSQL superuser and the two new users:
2.2. Using Infandango
7
How to develop with infandango Documentation, Release
$ sudo -u postgres psql
postgres=# \password postgres
<type in password of your choice>
postgres=#
wango
\password wango
postgres=#
jester
\password jester
Next, create the infandango_new database:
# Exit back to shell & create the database:
$ createdb -U wango -O wango infandango_new
Again, you can also do this via pgAdmin.
Finally, tell Infandango to create the database structure:
# Load up the tables into the database
$ Infandango development rebuilddb
On Ubuntu, to avoid having to type the password for the database, you can make a file ~/.pgpass.
$ gvim ~/.pgpass
$ # add the line *:*:*:wango:wango
$ chmod 600 ~/.pgpass
$ cat ~/.pgpass
*:*:*:wango:wango
This is unnecessary on Fedora.
Start the development server
We assume that you will run the development version of infandango using the Django server:
$ Infandango development server &
Once the server has started, you can point your browser towards: http://locahost:8000.
Only registered users are able to access Infandango through the front end.
The list of users is
controlled by the files <inf>/infandango/examples/sample_config/students.csv and
<inf>/infandango/examples/sample_config/tutors.csv.
$ cat students.csv
"UserName","TutGrpId","Jim","Smith"
"UserName2","TutGrpId2","Bob","Johnson"
"sTest","Tutors","Test","User"
The fields in these files are specific to the University of Edinburgh’s INF1-OP course and for development purposes,
the only crucial field is the first one, which determines the user’s username.
Jester
Jester is the Java tester plugin for Infandango and runs JUnit 4 tests over Java code that is submitted.
8
Chapter 2. Contents
How to develop with infandango Documentation, Release
Configure Jester
Grant Jester the necessary database permissions
$
$
$
$
Infandango jester grant
Password: <sudo password for host>
could not identify current directory: Permission denied
Password: <postgres password>
Running Jester Locally
To run the Jester server use:
$ Infandango jester run
When Jester has no work to be done, its threads sleep while waiting for new submissions. When a new submission
is made, Infandango will notify Jester that there is work to be done automatically. However, if you need to do this
manually on an already running server, you can give the following command:
$ Infandango jester signal
2.2.2 Configuration
2.2.3 Administration
2.2.4 Writing Questions
2.2.5 Frequently Asked Questions
Contents
• Frequently Asked Questions
– How Do I ....
How Do I ....
Clear the database completely?
Infandango development rebuilddb
2.3 For Developers
2.3.1 Overview
2.3.2 Contribute/ToDo List (UG4 Projects?)
2.3.3 Referenence Documentation
2.3. For Developers
9
Документ
Категория
Без категории
Просмотров
8
Размер файла
113 Кб
Теги
1/--страниц
Пожаловаться на содержимое документа