Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Developing LHCb Software to use git #197

Merged
merged 3 commits into from
Nov 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion davinci-grid.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ To look at the `root` file produced by the job start a new terminal, and
type:

```bash
$ lb-run DaVinci v41r2 $SHELL
$ lb-run DaVinci/v41r2 $SHELL
$ root -l path/to/the/job/output
```

Expand Down
12 changes: 5 additions & 7 deletions davinci.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ One of the most important ones is *DaVinci*, which provides lots of *Algorithms*

You can run DaVinci using the following command:
```bash
lb-run DaVinci v41r2 gaudirun.py
lb-run DaVinci/v41r2 gaudirun.py
```

This will run the `gaudirun.py` command using version v41r2 of DaVinci.
Expand Down Expand Up @@ -89,15 +89,15 @@ During this run, DaVinci didn't do anything: We didn't specify any algorithms to
Usually, you will write an option file (e.g. `options.py`) and specify it as an argument to `gaudirun.py`:

```bash
lb-run DaVinci v41r2 gaudirun.py options.py
lb-run DaVinci/v41r2 gaudirun.py options.py
```

An `option.py` is just a regular Python script that specifies how to set things up in the software.
Many of the following lessons will teach you how to do something with DaVinci by showing you how to write or extend an `options.py`.
You can use the above command to test it.
You can also specify several option files like this:
```bash
lb-run DaVinci v41r2 gaudirun.py options1.py options2.py
lb-run DaVinci/v41r2 gaudirun.py options1.py options2.py
```
They will then both be used to set up DaVinci.

Expand All @@ -108,7 +108,7 @@ lb-run --list DaVinci
Do you want to start a shell that already contains the LHCb environment, so you don't have to use `lb-run`?
Execute
```bash
lb-run DaVinci v41r2 $SHELL
lb-run DaVinci/v41r2 $SHELL
```
A simple `gaudirun.py` should work as well now.
Typing `exit` will close the shell and leave the LHCb environment behind.
Expand All @@ -119,7 +119,5 @@ Typing `exit` will close the shell and leave the LHCb environment behind.
> `lb-run` is the new way of doing things and has some nice benefits over `SetupProject`.
> For most purposes, `SetupProject DaVinci v41r2` is equivalent to
> ```bash
> lb-run DaVinci v41r2 $SHELL
> lb-run DaVinci/v41r2 $SHELL
> ```


14 changes: 7 additions & 7 deletions interactive-dst.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ minutes: 10
> * Print all nodes in a DST
> * Explore the contents of the TES
> * Inspect a track
> * Inspect a stripping location
> * Inspect a stripping location

Data is stored in files called DSTs, which are processed
by DaVinci to make nTuples. However you can also explore
Expand Down Expand Up @@ -51,7 +51,7 @@ Place this into a file called `first.py` and run the following
command in a new terminal:

```bash
$ lb-run DaVinci v41r2 ipython -i first.py 00035742_00000002_1.allstreams.dst
$ lb-run DaVinci/v41r2 ipython -i first.py 00035742_00000002_1.allstreams.dst
```

This will open the DST and print out some of the TES locations
Expand Down Expand Up @@ -178,8 +178,8 @@ print_decay = appMgr.toolsvc().create(
print_decay.printTree(cands[0])
```

With our candidates in hand, it would be nice to be able to retrieve and
compute the variables we need for an analysis. On to [LoKi
With our candidates in hand, it would be nice to be able to retrieve and
compute the variables we need for an analysis. On to [LoKi
functors](loki-functors.html)!

> ## Fast DST browsing {.callout}
Expand All @@ -192,10 +192,10 @@ functors](loki-functors.html)!
> For example, to explore the `DST` we could have simply done:
>
> ```
> lb-run Bender bender 00035742_00000002_1.allstreams.dst
> lb-run Bender/latest bender 00035742_00000002_1.allstreams.dst
> ```
>
> This leaves us in a prompt in which we can proceed as discussed in this
> This leaves us in a prompt in which we can proceed as discussed in this
> lesson, with the advantage that some functions are already provided
> for us, such as `seekStripDecision` (which replaces our `advance`) or
> `ls` and `get`, which allow to list and get TES locations.
Expand All @@ -205,7 +205,7 @@ functors](loki-functors.html)!
> `Bender` also provides a useful command `dst-dump`, which is a quick way of
> figuring out what objects are present on a `DST` and where. Try out:
> ```
> lb-run Bender dst-dump -f -n 100 00035742_00000002_1.allstreams.dst
> lb-run Bender/latest dst-dump -f -n 100 00035742_00000002_1.allstreams.dst
> ```
> The `-f` option tells `Bender` to try and "unpack" the locations such as
> `/Event/AllStreams/pPhys/Particles` that we mentioned above, while `-n 100`
Expand Down
103 changes: 60 additions & 43 deletions lhcb-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ minutes: 10
> ## Learning Objectives {.objectives}
> * Learn the basics of how to work with and modify LHCb software packages

This lesson introduces you to two commands:
This lesson introduces you the commands:

- `lb-dev` for setting up a new development environment
- `getpack` for downloading LHCb software packages
- `git lb-use` and `git lb-checkout` for downloading LHCb software packages

If you want to make changes to a software package, you will need to set up a development environment. `lb-dev` is your friend here:

```bash
lb-dev --name DaVinciDev DaVinci v41r2
lb-dev --name DaVinciDev DaVinci/v41r2
```

The output should look similar to this:
Expand All @@ -43,6 +43,14 @@ You can customize the configuration by editing the files 'build.conf' and
'CMakeLists.txt' (see http://cern.ch/gaudi/CMake for details).
```

> ## `lb-dev` created local projects are Git repositories {.callout}
> When `lb-dev` creates the local project directory and create the initial files
> there, it also calls `git init` and commits to the local Git repository the
> first version of the files (try with `git log` in there).
>
> You can then use git to keep track of your development, and share your code
> with others (for example with a [new project in gitlab.cern.ch](https://gitlab.cern.ch/projects/new)).

Follow those instructions and once you've compiled your software run

```bash
Expand All @@ -52,7 +60,7 @@ Follow those instructions and once you've compiled your software run
inside the directory. This will (similar to `lb-run`) give you a new bash session with the right environment variables.

Your new development environment won't be very useful without any software to modify and build.
So why not check out out one of the existing LHCb packages, which are stored in the LHCb SVN repository?
So why not check out one of the existing LHCb packages, which are stored in the [LHCb Git repositories](https://gitlab.cern.ch/lhcb)?

Let's assume you have already used `lb-dev` to set up your development environment and you are currently inside it.
In order to obtain the source code of the package you want to work on, use the [Git4LHCb](https://twiki.cern.ch/twiki/bin/view/LHCb/Git4LHCb) scripts.
Expand All @@ -68,61 +76,72 @@ make configure
Under the hood, `git lb-use` will add the [`Stripping`](https://gitlab.cern.ch/lhcb/Stripping) repository as a remote in git.
`git lb-checkout` will then perform a partial checkout of the master branch of the Stripping repository, only adding the files under [`Phys/StrippingSelections`](https://gitlab.cern.ch/lhcb/Stripping/tree/master/Phys/StrippingSelections).

> ## Which project to use in `git lb-use`? {.callout}
> The project name to pass to `git lb-use` depends on the directories you want
> to check out and work on, and not on the project name you passed to `lb-dev`.
> Moreover you can call `git lb-use` several times for different remote
> projects in the same local project:
>
> ```bash
> lb-dev --name DaVinciDev DaVinci/v40r2
> cd DaVinciDev
> git lb-use Analysis
> git lb-use Stripping
> git lb-use DaVinci
> ```

You can now modify the `StrippingSelections` package and run `make purge && make` to build it with your changes.
You can test your changes with the `./run` script.
It works similar to `lb-run`, without the need to specify a package and version:
```bash
./run gaudirun.py options.py
```

> ## What if git asks for my password 1000 times? {.callout}
> `git` might ask you for your password several times.
> To avoid this, you can create a kerberos token with
> ```
> kinit $USER@CERN.CH
> ```
> You will have to enter your password once, and further password prompts will be skipped.

If you just want to take a look at a source file, without checking it out, you can comfortably access the repository through two different web UIs.

* [Trac](https://svnweb.cern.ch/trac/lhcb/)
* [SVNweb](http://svnweb.cern.ch/world/wsvn/lhcb)
> ## What if `git` asks for my password? {.callout}
> Make sure you followed the [prerequisites](https://twiki.cern.ch/twiki/bin/view/LHCb/Git4LHCb#Prerequisites)
> section in the [Git4LHCb TWiki page](https://twiki.cern.ch/twiki/bin/view/LHCb/Git4LHCb).

(which one to use? It is just a matter of taste, pick the one that looks nicest)
If you just want to take a look at a source file, without checking it out, you can comfortably access the repository through
the [Gitlab web interface](https://gitlab.cern.ch/lhcb).

To get an idea of how a certain component of the LHCb software works, you can access its doxygen documentation.
There is a page for each project, lists of projects can be found here:

* [https://lhcb-release-area.web.cern.ch/LHCb-release-area/DOC/davinci/latest_doxygen/index.html](https://lhcb-release-area.web.cern.ch/LHCb-release-area/DOC/davinci/latest_doxygen/index.html).
* [http://lhcb-comp.web.cern.ch/lhcb-comp/](http://lhcb-comp.web.cern.ch/lhcb-comp/)
To get an idea of how a certain component of the LHCb software works, you can access the doxygen documentation.
One set of doxygen web pages is generated for several related projects, and is linked in all the
projects web sites, like https://cern.ch/LHCb-release-area/DOC/davinci/.
See also the the [LHCb Computing web page](http://cern.ch/lhcb-comp/) for a list of projects.

Another useful tool available on lxplus machines is `Lbglimpse`. It allows you to search for a given string in the source code of LHCb software.
```bash
Lbglimpse "PVRefitter" DaVinci v41r2
```
It works with every LHCb project and released version.

If you have made changes that are supposed to be integrated into the official LHCb repositories, you can use `svn commit`.
But read the instructions in the SVN usage guidelines first.

* [SVNUsageGuidelines](https://twiki.cern.ch/twiki/bin/view/LHCb/SVNUsageGuidelines)
If you have made changes that are supposed to be integrated into the official LHCb repositories, you can use `git lb-push`.
But read the instructions in the [TWiki page](https://twiki.cern.ch/twiki/bin/view/LHCb/Git4LHCb#Using_Git_for_LHCb_development) first.

Be advised that you should always communicate with the package maintainers before committing changes!
The release managers have to find the packages to include in a new release. Therefore make sure
to document your changes in the release notes which are found in `doc/release.notes`.
After that put your commit into the tag collector.
Depending on the project, you may be required to document your changes in the
release notes which are found in `doc/release.notes`.

* [Tag collector FAQ](https://twiki.cern.ch/twiki/bin/view/LHCb/FAQ/TagCollectorFAQ)
* [LHCb Tag Collector](https://lhcb-tag-collector.web.cern.ch/lhcb-tag-collector/index.html)
After the call to `git lb-push`, go to the project repository web page to
create a new merge request, for example https://gitlab.cern.ch/lhcb/Stripping/merge_requests/new.

(The login button is in the top right corner.)
> ## Quick link to create a merge request {.callout}
> When pushing to a branch in a project in Gitlab you will see a message like:
>
> ```
> remote:
> remote: Create merge request for my-branch:
> remote: https://gitlab.cern.ch/lhcb/Stripping/merge_requests/new?merge_request%5Bsource_branch%5D=my-branch
> remote:
> ```
>
> You can use the URL in the message to quickly create a merge request for the
> changes you just pushed.

It is advisable to test new developments on the so-called nightly builds.
They take everything which is committed in the head versions of all packages
and try to build the given project.
You can checkout this version by doing:
It is advisable to test new developments on the so-called [nightly builds](https://lhcb-nightlies.cern.ch).
They take build all the projects with all pending merge requests.
You can use a nightly build version of a project with:
```bash
lb-dev DaVinci HEAD --nightly lhcb-head
lb-dev --nightly lhcb-head DaVinci/HEAD
```
A more detailed description of the command is found here:

Expand All @@ -133,10 +152,8 @@ Therefore the nightly tests are performed. They first try to build the full soft
If that is successful, they run some reference jobs and compare the output of the new build with a reference file.
The results of the nightly builds can be found here.

* [Nightly tests](https://buildlhcb.cern.ch/nightlies/)
* [Nightly builds summaries](https://lhcb-nightlies.cern.ch)

If the aim of the commit was to change the ouput, e.g. because you increased the
track reconstruction efficiency by a factor of two, inform the release manager of the package
such that he can update the reference file.


track reconstruction efficiency by a factor of two, mention it in the merge request
description, such that the manager of the affected project can update the reference file.
Loading