vagrant 2


by Malik BOUGACHA, EBU on 03 Oct 2013

virtualenv

introduction

Last time, we discovered a problem inherant to the software world. Software change an d api to the software changes too. We also briefly talked about virtualenv in python. How does it work ?

Simple usage

You can specify a python virtualenv which is a set containing a python interpreter and a set of libraries. You can specify a version of each libary you want either by a specific version number or by a minimum version.
We define this set of libraries at the configuration time. Let's take a simple example :

mkdir mynewproject 
cd mynewproject 
touch pip_requirements.txt 

So now we will switch to the virtualenv

virtualenv . 
source bin/activate 

we can see that we have only a couple dependencies

pip freeze #this will list installed module that pip installed 

so let's add a couple of dependencies. To make it shorter and more easily manageable, we will put everything in the pip_requirements.txt.

http://example.com/baz-0.3.tar.gz #we can also specify a http or ftp tar containing a setup.py 
requests=0.10.0 #yes I love old version 

then we install them in the virtualenvironnement :

pip install -r pip_requirements.txt 

As you can see, this installed the module in the new virtualenv.

pip freeze 
```bash
Now that we installed new dependencies, we will leave the virtualenv. 

deactivate


we can check that we are outside of the virtualenv by doing  

pip freeze ```

python version

Now, imagine that you would like to test

System wide dependencies

Great now we can easily manage

  • python dependencies
  • python interepreter

What if we want to add system dependencies ? Say a mysql database and a memcache cache ? We could also want to test our system on multiple host configuration, some with mysql other with posgre, or even test it under different system, for example a BSD based system and a linux based one. both having their own library version or even software. We have another solution. Instead of a simple virtualenv, we will see how we can simply put all our environnement into a separated environnement.


python vagrant

MSMeter


by Igor VOKATCH-BOLDYREV, EBU on 16 Sep 2013

MSMeter is an application for the Benchmarking of network attached storage for file-based editing and other media streaming use cases. Used with a number of generic client workstation, it can simulate a typical work load and access pattern representing a real workingenvironment, like a newsroom or an editing suite. It is scriptable to automate long test sequences.

This tool can be used by broadcasters to test different storage solutions before they buy or before to put in production. It can also be used to fine tune parameters of the system to optimize the performances. Finally, it can be used as a research tool to understand the behavior of a storage system when the test conditions are being changed.

This was originally developed by the BBC. This version, developed at the EBU, add more granularity in the measurement to enable the evaluation the performance over short time windows. This, for instance, can test if a storage system can sustain real-time playback or recording. This version also introduces time stamping of measures to allow precise comparison of stream.


MSMeter Storage

Prediction functions


by Karim ZAHED, EBU on 16 Sep 2013

I worked on two tasks during my 2 month internship in the Technical & Innovation department at EBU under the supervision of Dr. Walid Sami. My first task had to do with updating an already existing prediction function for the field strength and path loss between two antennas. My major contribution to the update is implementing the designated algorithm for short distances smaller than 1 Km and clean up the code from repetitions while placing independent parts in sub functions.

The second task was to implement the Monte Carlo simulations and use Terrance O’Leary’s calculations made on Fortran as a standard reference to compare intermediate as well as final calculations. Due to suspected interference from the uplink Mobile User Equipment close to the 694 MHz frequency on Channel 48, Monte Carlo simulations are to be used to assess the interference as a percentage of time on the digital television reception at a specified pixel or random distribution of pixels in a hexagonal cell in consideration. Success in proving that interference percentage is above the threshold back us in requesting leakage reduction from the user equipment.

The importance of my tasks was to create sort of a back up of Terrance’s work done on Fortran to Matlab which is more common nowadays. It is important to note that while coding the Monte Carlo simulations, most functions were made to handle matrices as opposed to loops wherever needed. This would help avoid the obstacle of time consumption by loops in Matlab. Thus complications may arise and many ‘’if’’ conditions are replaced by the built-in ‘find’ function that returns a set of indices.

Testing was made for the first task and most cases were consistent with the old tests while new updates for short distances are not comparable due to absence of a reference. As for the second task, my internship duration was not sufficient to debug all calculation discrepancies but the curves do look similar to Terry’s calculations. The documentation for the second task is written in the form of a walkthrough for whoever is assigned to continue debugging the code and confirm the calculations. The documentation for task 1 is updated from the original version and describes what each function does.


Matlab Spectrum

vagrant 1


by Malik BOUGACHA, EBU on 14 Sep 2013

Developpement sandboxing

Vagrant is a way to sandbox the devloppement environement. I will take python as an example of sandbox and explain how we come from a simple os based devloppement environement and test to a vm env.

machine

Let's start with a simple machine environement

python server.py 

The server.py being a very simple flask server:

from Flask import Flask 

app = Flask() 

if __name__ == "__main__": 
    app.run() 

Great right ?
But what happens if we add more dependencies, for example requests, a python module for doing http request.

from Flask import Flask 
import requests 

app = Flask() 

@app.route("/") 
def main(): 
    return request.get("http://example.com/json").json() 

if __name__ == "__main__": 
    app.run() 

The example is pretty simple right ? What does happen when we want to deploy it ? It will crash depending on the version of the requests module we have. As we have a stable version of debian, we don't have the right version of the library and of course we don't want to install it at a system wide level But there is a solution for this in python: virtualenv.


dependencies python vagrant virtualenv