wiki:DSC/zdc_framework-ext

Version 11 (modified by seskar, 10 years ago) ( diff )

Tournament Scripts

Objective

The page describes a pair of scripts that are used to execute the set of matches for both competitive and cooperative tournaments. The scripts will, based on configuration files and input arguments, image the appropriate nodes, turn them on and execute the match.

Team Configuration File

A YAML file is used as a team configuration file specifying team names and the corresponding images. Each team is identified with the team number which is used by the match configuration file to specify the pair (in the case of a competitive match) or triplet (in the case of a cooperative match) of teams for each round of the tournament. Note that the YAML format insists on leading spaces (i.e. TABs are not allowed). An example of a team configuration file is:

T0:
  name: ORBIT team 1
  image: dsc-bot1.ndz
T1:
  name: ORBIT team 2
  image: dsc-bot2.ndz 
T2:
  name: ORBIT team 3
  image: dsc-bot3.ndz

Competitive Configuration File

This is a YAML file that specifies matches. The number defining the match is used by the framework to select the match.

G1:
   1: T1
   2: T2
G2:
   1: T0
   2: T2
G3:
   1: T0
   2: T1

In this file we have 3 matches defined. The first match (i.e. match 1) teams 1 and 2 will be playing and in A configuration X nodes will get image from team 1 and Y nodes will be imaged with team 2 image; B match will have team 2 image on X nodes and team 1 image on Y nodes. Similarly, match 2 will be played between team 0 and team 2 while match 3 will be played between teams 0 and 1. Default file name is comp_matches.yaml in current working directory (can be changed with the command line option).

Cooperative Configuraiton File

Format of the configuration YAML file that defines cooperative matches is:.

G1:
   1: T0
   2: T1
   3: T2

In this example the match number 1 will be played between teams 0, 1 and 2.

The three example configuration files teams.yaml, comp_matches.yaml and coop_matches.yaml can be used as a starting point; they should be downloaded into the desired directory and modified to include the appropriate team image(s). The teams.yaml file includes all released bot images as teams !#0 - !#5 (T0-T5) and has team !#6 (T6) as a placeholder for the actual testing team image.

Running Competitive Matches

Script for running competitive matches is dsc-comp. The synopsis of the command is:

Usage: /usr/local/bin/dsc-comp [OPTIONS] MATCHNUMBER MATCHVARIANT

where
    MATCHNUMBER - ordinal number of the match to be played form the match configuration file
    MATCHVARIANT - A for first variant of the match; B for second variant of the match

Example: /usr/local/bin/dsc-comp 7 B

OPTIONS
    -s, --secondary                  Play the match in the secondary arena [default: false]
    -l, --loadonly                   Only load images but do NOT execute the match [default: false]
    -v, --verbose                    Turn on more verbose output [default: false]
    -n, --notexecute                 Only explain what is being done rather than doing it
    -t, --teams FILE                 Teams file [default: teams.yaml]
    -m, --matches FILE               Competitive matches configuration file [default: comp_matches.yaml
    -h, --help                       Show this usage message and quit.

With the default configuration files, the output is:

user@console.grid:~/$ dsc-comp 1 A
Running match 1:
  dsc-wtest2.ndz -> Team Xp
  dsc-wtest3.ndz -> Team Yp
2014-01-31 09:57:34 -0500 Loading image: dsc-wtest2.ndz for team Xp
2014-01-31 09:57:36 -0500 Loading image: dsc-wtest3.ndz for team Yp
2014-01-31 10:03:04 -0500 Telling team Xp: on
2014-01-31 10:03:10 -0500 Telling team Yp: on
2014-01-31 10:03:46 -0500 Executing competitive match on PRI arena

Running Cooperative Matches

Script for running competitive matches is dsc-coop. The synopsis of the command is:

Usage: /usr/local/bin/dsc-coop [OPTIONS] MATCHNUMBER

where
    MATCHNUMBER - ordinal number of the match to be played form the match configuration file

Example: dsc-coop 3

OPTIONS
    -s, --secondary                  Play the match in the secondary arena [default: false]
    -l, --loadonly                   Only load images but do NOT execute the match [default: false]
    -v, --verbose                    Turn on more verbose output [default: false]
    -n, --notexecute                 Only explain what is being done rather than doing it
    -t, --teams FILE                 Teams file [default: teams.yaml]
    -m, --matches FILE               Cooperative matches configuration file [default: coop_matches.yaml
    -h, --help                       Show this usage message and quit.

For example, executing match #1 on the secondary arena with default configuration files results in the following output:

user@console.grid:~/$ dsc-coop -s 1
Running match 1:
  dsc-wtest1.ndz -> Team As
  dsc-wtest2.ndz -> Team Bs
  dsc-wtest3.ndz -> Team Cs
2014-02-01 15:38:02 -0500 Loading image: dsc-wtest1.ndz for team As
2014-02-01 15:38:04 -0500 Loading image: dsc-wtest2.ndz for team Bs
2014-02-01 15:38:06 -0500 Loading image: dsc-wtest3.ndz for team Cs
2014-02-01 15:45:25 -0500 Telling team ABCs: on
2014-02-01 15:46:01 -0500 Executing co-operative match on SEC arena

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.