Beginning the GSoC Project

After 2 long exhausting weeks of exams, I am finally done with my graduation :). And now I have buckled up to code the summer away with Software Carpentry (NumFocus).

As I had figured out earlier, the installation data about the packages, like name and version is easily available in the installation test scripts in the form of a list. But this case is only for successful installs. For failures I don’t have a direct list, rather I have a list of messages that are displayed by the script to the users for each failure, which have been designed something like this:

def __str__(self):
        url = self.get_url()
        lines = [
            'check for {0} failed:'.format(self.checker.full_name()),
            '  ' + self.message,
            '  For instructions on installing an up-to-date version, see',
            '  ' + url,
            ]
        if self.causes:
            lines.append('  causes:')
            for cause in self.causes:
                lines.extend('  ' + line for line in str(cause).splitlines())
        return '\n'.join(lines)

So, I’ll have to format the data and make it appropriate to be sent to server.

As per the discussion with my mentor @pbanaszkiewicz, I will get back to installation scripts a litter later. Firstly I’ll be creating the server and API, it will help me in understanding the format and requirement of data which is to be prepared later during modification of installation test scripts.

So, I have begun working on the server side, the code of which resides in the github repository Result-aggregation-server. API is to be built using python’s micro web framwork flask. Following are the basic requirements of this API:

I have created an endpoint installation_data which sends the user’s system information, the installed packages by the user, and failed packages. The installation script should make a POST request with headers : “Content-Type : application/json” to this end point. Currently there are 3 tables in the database namely user_system_info, successful_installs, and failed_installs. Both successful_installs and failed installs contain a foreign key which references the id of user table. The schema is as follows: image

I have created the models and also the relationship between the tables (one to many). Each time there is any change in the schema I run the migration script manage.py which migrates and then upgrades the schema. This script uses Flask-migrate which is built on top of alembic. Data that is to be sent by installation test scripts will be a dictionary with 3 keys: user_system_info , succesful_installs, and failed_installs. Here, user_system_info will be a dictionary, successful_installs, a list of dictionaries, and failed_installs, a list of dictionaries too. I have written the endpoint and tested it using curl. Everything seems to be working correctly. Although, there are some constrains to be applied during the insertion of data. One user may run the script many times, in that case data should be updated instead of insertion. I’m planning to use the combination of email_id and workshop_id as the unique key to identify a user and update their data. Also, the response the API gives can be improved, as it may contain some useful information for the user. Will post further updates soon. Cheers! :)