<commit_before>
[Take me to the cyber-dojo home page](https://github.com/cyber-dojo/cyber-dojo).

- - - -

[![Build Status](https://travis-ci.org/cyber-dojo/runner_stateless.svg?branch=master)](https://travis-ci.org/cyber-dojo/runner_stateless)

<img src="https://raw.githubusercontent.com/cyber-dojo/nginx/master/images/home_page_logo.png"
alt="cyber-dojo yin/yang logo" width="50px" height="50px"/>

# cyberdojo/runner_stateless docker image

- A stateless micro-service for [cyber-dojo](http://cyber-dojo.org)
- Runs an avatar's tests.
- Not Yet Live.

API:
  * All methods receive their arguments in a json hash.
  * All methods return a json hash with a single key.
  * If the method raises an exception, the key equals "exception".
  * If the method completes, the key equals the method's name.

- - - -

# image_exists?
Asks whether the image with the given image_name exists, as determined
by running [docker search].
- parameter, eg
```
  { "image_name": "cyberdojofoundation/gcc_assert" }
```
- raises exception if the image_name is invalid, eg
```
  { "image_name": "cyberdojofoundation/_cantStartWithUnderscore" }
```
- returns true if it does, false if it doesn't, eg
```
  { "image_exists?": true   }
  { "image_exists?": false  }
```

# image_pulled?
Asks whether the image with the given image_name has been pulled.
- parameter, eg
```
  { "image_name": "cyberdojofoundation/gcc_assert" }
```
- raises exception if the image_name is invalid, eg
```
  { "image_name": "cyberdojofoundation/_cantStartWithUnderscore" }
```
- returns true if it has, false if it hasn't, eg
```
  { "image_pulled?": true   }
  { "image_pulled?": false  }
```

# image_pull
Pulls the image with the given image_name.
- parameter, eg
```
  { "image_name": "cyberdojofoundation/gcc_assert" }
```
- raises an exception if the image_name is invalid, eg
```
  { "image_name": "cyberdojofoundation/_cantStartWithUnderscore" }
```
- returns true if the pull succeeds, false if it fails, eg
```
  { "image_pull": true  }
  { "image_pull": false }
```

- - - -

# run
Saves the visible_files in a container run from image_name and runs cyber-dojo.sh
- parameters, eg
```
  {        "image_name": "cyberdojofoundation/gcc_assert",
              "kata_id": "15B9AD6C42",
          "avatar_name": "salmon",
     "deleted_filenames: [ "wibble.h", ... ]
        "visible_files": { "fizz_buzz.h": "#ifndef FIZZ_BUZZ_INCLUDED...",
                           "fizz_buzz.c": "#include...",
                           "cyber-dojo.sh": "make",
                           ...
                         },
          "max_seconds": 10
  }
```
- returns an integer status, stdout, stderr, and colour, if the run completed in max_seconds.
Colour will be "red", "amber", or "green". eg
```
    { "run": {
        "status": 2,
        "stdout": "makefile:17: recipe for target 'test' failed\n",
        "stderr": "invalid suffix sss on integer constant",
        "colour": "red"
    }
```
- returns the string status "timed_out" if the run did not complete in max_seconds, eg
```
    { "run": { "status": "timed_out" } }
```

- - - -
- - - -

# build the docker images<commit_msg>[ci skip] readme update; also in the previous git-commit message s/add/all/<commit_after>
[Take me to the cyber-dojo home page](https://github.com/cyber-dojo/cyber-dojo).

- - - -

[![Build Status](https://travis-ci.org/cyber-dojo/runner_stateless.svg?branch=master)](https://travis-ci.org/cyber-dojo/runner_stateless)

<img src="https://raw.githubusercontent.com/cyber-dojo/nginx/master/images/home_page_logo.png"
alt="cyber-dojo yin/yang logo" width="50px" height="50px"/>

# cyberdojo/runner_stateless docker image

- A stateless micro-service for [cyber-dojo](http://cyber-dojo.org)
- Runs an avatar's tests.
- Not Yet Live.

API:
  * All methods receive their arguments in a json hash.
  * All methods return a json hash with a single key.
  * If the method raises an exception, the key equals "exception".
  * If the method completes, the key equals the method's name.

- - - -

# image_exists?
Asks whether the image with the given image_name exists, as determined
by running [docker search].
- parameter, eg
```
  { "image_name": "cyberdojofoundation/gcc_assert" }
```
- raises exception if the image_name is invalid, eg
```
  { "image_name": "cyberdojofoundation/_cantStartWithUnderscore" }
```
- returns true if it does, false if it doesn't, eg
```
  { "image_exists?": true   }
  { "image_exists?": false  }
```

# image_pulled?
Asks whether the image with the given image_name has been pulled.
- parameter, eg
```
  { "image_name": "cyberdojofoundation/gcc_assert" }
```
- raises exception if the image_name is invalid, eg
```
  { "image_name": "cyberdojofoundation/_cantStartWithUnderscore" }
```
- returns true if it has, false if it hasn't, eg
```
  { "image_pulled?": true   }
  { "image_pulled?": false  }
```

# image_pull
Pulls the image with the given image_name.
- parameter, eg
```
  { "image_name": "cyberdojofoundation/gcc_assert" }
```
- raises an exception if the image_name is invalid, eg
```
  { "image_name": "cyberdojofoundation/_cantStartWithUnderscore" }
```
- returns true if the pull succeeds, false if it fails, eg
```
  { "image_pull": true  }
  { "image_pull": false }
```

- - - -

# run
Saves the visible_files in a container run from image_name and runs cyber-dojo.sh
- parameters, eg
```
  {        "image_name": "cyberdojofoundation/gcc_assert",
              "kata_id": "15B9AD6C42",
          "avatar_name": "salmon",
     "deleted_filenames: [ "wibble.h", ... ]
        "visible_files": { "fizz_buzz.h": "#ifndef FIZZ_BUZZ_INCLUDED...",
                           "fizz_buzz.c": "#include...",
                           "cyber-dojo.sh": "make",
                           ...
                         },
          "max_seconds": 10
  }
```
- returns an integer status, stdout, stderr, and colour, if the run completed in max_seconds.
The [traffic-light colour](http://blog.cyber-dojo.org/2014/10/cyber-dojo-traffic-lights.html)
will be "red", "amber", or "green". eg
```
    { "run": {
        "status": 2,
        "stdout": "makefile:17: recipe for target 'test' failed\n",
        "stderr": "invalid suffix sss on integer constant",
        "colour": "red"
    }
```
- returns the string status "timed_out" if the run did not complete in max_seconds, eg
```
    { "run": { "status": "timed_out" } }
```

- - - -
- - - -

# build the docker images
{'fraction_non_alphanumeric': 0.14614070507842833, 'fraction_numerical': 0.00559093026867526, 'mean_word_length': 3.0759493670886076, 'pattern_counts': {'":': 54, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3239220', 'n_tokens_mistral': 2302, 'n_tokens_neox': 2194, 'n_words': 589}