Version 1 (modified by minondoa, 5 years ago) (diff)

--

# Development

The aim of this section will be to explain the process we follow to contribute to the development of the DRM4G.

We use something similar to a gitflow workflow. Internally we synchronize our work with GitBucket, which is what will be considered as the central repository of the Santander Meteorology Group.

• You can find the project here, but to be able to access it you must first get a GitHub account and get access to the private repository.

## Necessary Steps

There are a lot of tutorials showing how to use git, including our own, but this is more straightforward explanation on how to get started.

In Linux operating systems:

• Open a terminal on the folder in which you wish your local copy of the repository to be stored (it's recommended to use an empty folder) and run the following commands:
git init  #to initialize an empty Git repository
git remote add origin https://meteo.unican.es/gitbucket/git/DRM4G/DRM4G.git #to make your local repository point to the remote repository in GitBucket
git checkout master #to create a local repository of the master branch
git checkout develop #to create a local repository of the develop branch


If you want to see the changes your doing, check the file ".git/config" under your repository directory.

With this, you will now have DRM4G's source code at your disposal.

From here you should create branches for every new feature you'd like to include to the DRM4G.

• To create a new branch and switch to it you can use the command git checkout -b <branch_name>.
• For a more in depth tutorial on how branching works, click here.

## Our Git workflow

In this section you'll find the guidelines of how we tackle the development process.

## Committing changes

After you've tested that everything is in working order it's time to update your local repository.

git add .
git commit -m "Description of the changes you've made"
git push origin <branch_name>


From here you'll have to create a Pull request.

## Testing the DRM4G

Once you've made the changes you wanted to, you'll want to install your version to be sure that your new feature is working properly.

Just in case you would like to try out different versions, we recommend you use a virtual environment to test it.

• Here you can find a tutorial on how to install a virtual environment, or you can look for one on your own.

Before you can install and try out your own version, you'll have to build your own package:

• Open a terminal in the folder where your repository is located.
• Run the command python setup.py sdist

This will create a a distribution package under a folder called dist.

### Installing your version in a virtual environment

Go to wherever you have your virtual environment, open a terminal and execute the following commands:

source bin/activate
export DRM4G_DIR = $PWD/conf pip install path/to/drm4g/package  DRM4G_DIR is where the configuration files will be installed. More information here. And that's it. Now you can use and test your own version of DRM4G. For other ways to install the DRM4G, you can check here. ### How to debug code You have at your disposal a number of ways to check what could have gone wrong when something breaks. Via the DRM4G CLI • All of the drm4g commands can be executed in debug mode by adding the option "--dbg". Via the logger • If there has been any error, chances are that you can find the cause by looking at DRM4G's log files, found in "$DRM4G_DIR/.drm4g/var"
• The DRM4G is divided into different parts, and each one of them has its own logger.
• By default, the logger level is set to INFO for all of them. To see all of the log messages that the DRM4G can record, you'll have to modify the file "$DRM4G_DIR/.drm4g/etc/logger.conf" and change the level of the logger to "DEBUG" for each part that you wish to check. Via the job's logs • In addition, all of the individual jobs submitted have their own log files. They can help you see in which phase did the program stop working. • They are grouped in folders by their job ID, every hundred jobs. They can be located in "$DRM4G_DIR/.drm4g/var".
• The folders will look like this: "000-099", "100-199", ...