Skip to content

Testing Tango

daviddob edited this page Jun 15, 2017 · 3 revisions

Introduction

This is a guide to test whether the Tango server is functioning correctly. Make sure you have completed the set-up guide for Tango before attempting to follow the instructions below. We will be using the command-line client (clients/tango-rest.py) to send sample jobs to Tango via the REST interface. Example jobs to test Tango are also provided in the clients/ directory. This guide assumes an instance of Tango is already up and running. If not, see the start up guide.

Running a Sample Job with the Command-Line Client

  1. Open a courselab on Tango. This will create a directory for tango to store the files for the job.

    $ python clients/tango-rest.py -P <port> -k <key> -l <courselab> --open
  2. Upload files necessary for the job.

    $ python clients/tango-rest.py -P <port> -k <key> -l <courselab> \
        --upload --filename <.../Tango/clients/job1/hello.sh>
    $ python clients/tango-rest.py -P <port> -k <key> -l <courselab> \
        --upload --filename <.../Tango/clients/job1/autograde-Makefile>
  3. Add the job to the queue. Note: localFile is the name of the file that was uploaded and destFile is the name of the file that will be on the VM. One of the destFile attributes must be Makefile. Furthermore, image references the name of the VM image you want the job to be run on. If this is a normal VM image, then the image name will contain a .img suffix, whereas this may not be the case if this is a Docker container image.

    $ python clients/tango-rest.py -P <port> -k <key> -l <courselab> \
        --addJob --infiles \
        '{"localFile" : "hello.sh", "destFile" : "hello.sh"}' \
        '{"localFile" : "autograde-Makefile", "destFile" : "Makefile"}' \
        --image <image> --outputFile <outputFileName> \
        --jobname <jobname> --maxsize <maxOutputSize> --timeout <jobTimeout> 
  4. Get the job output.

    $ python clients/tango-rest.py -P <port> -k <key> -l <courselab> \
        --poll --outputFile <outputFileName>

    The output should look something like this:

    Autograder [<date-time>]: Received job <jobname>:<jobid>
    Autograder [<date-time>]: Success: Autodriver returned normally
    Autograder [<date-time>]: Here is the output from the autograder:
    ---
    ...

Advanced Testing with the Command-Line Client

The command-line client also implements an all-in-one command that simply runs a job from a directory of files by uploading all the files in the directory. Usage is as follows:

python clients/tango-rest.py -P <port> -k <key> -l <courselab> \
--runJob <.../Tango/clients/job1/> --image <image>