ganesh-k13 / titanium-silver

Docker based solution for lab automation
Creative Commons Attribution Share Alike 4.0 International
3 stars 5 forks source link
automation docker lab-automation python

Titanium-Silver

Build Status stability-wip licensebuttons by-sa

Description

Titanium-Silver is a python package for automating lab evalution using dockers.

Installation

This package requires:

Please verify docker's installation:

$ sudo docker run hello-world

Install Required Packages:

$ sudo pip3 install -r requirements.txt

Install Titanium-Silver:

$ sudo pip3 install -e . # PWD must be main folder with setup.py

Development:

Steps:

  1. Install nvm to install node and npm:
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
    source ~/.bashrc
    nvm install node
    cd <project_root>/frontend
    npm install
    <in one shell> $ npm run start
    <in another shell> $ ./run.sh

    Production:

    Steps:

  2. Do these:
$ cd frontend/ && npm run build
$ cd server/flaskr/ 
$ ln -s ../../frontend/build/static static
$ ln -s ../../frontend/build/ templates
  1. Open the file index.html in frontend/build. For each <script> tag, add this: type="text/babel"
  2. Remove the <link> for manifest.json
  3. For favicon.ico to load do this:
    1. Move favicon.ico to build/static.
    2. Change href of <link> to : {{url_for("static",filename="./favicon.ico")}}

Tests

$ pytest # Very Intensive, Less verbose
$ # Recommended:
$ sudo pytest tests/test_basic.py
$ sudo pytest tests/test_basic_100.py
$ sudo pytest tests/test_basic_50.py
$ sudo pytest tests/test_server_simulation.py

Usage

Docker module usage:

usage: script.py [-h] [-n [NUM]] [-s [SLEEP]]

optional arguments:
  -h, --help  show this help message and exit
  -n [NUM]    Number of containers=(0,50]
  -s [SLEEP]  Sleep duration of client file

# or as package:

>>> from titanium_silver.docker_client import Docker_Client
>>> dcli = Docker_Client()
>>> t = dcli.spawn_process(name='prototype%d'%i, num=i, sleep=5000, path=os.getcwd()+'/tests/SC') # returns a thread with container
>>> t.result_queue.get().decode('utf-8') # Get result

License: Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)

Authors: