Skip to content
README.md 2.27 KiB
Newer Older

## Utils

Centralized repo to update utils functions that are used in multiple omnibenchmark projects. 

## FAQ

### - How does it work ?

All omnibenchmark that are created from [omnibenchmark templates](https://github.com/ansonrel/contributed-project-templates) have a `src/utils` directory connected to this repo via [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules). Any new commits in this repo will be transfered to the directory of all omnibenchmark projects. 

### - How is it updated ? 

ATM, the update is made with a `post-init.sh` script that is called at the start of any new interactive environment of an omnibenchmark project. 

### - How can I manually update the utils ? 

If the `utils` submodule is already in your project (under `src`), run

```
git submodule update --remote --merge
git add src/utils
git commit -m 'Update utils.'
```

Anthony Sonrel's avatar
Anthony Sonrel committed
Or, if your project comes from an omnibenchmark template, run the `post-init.sh` script

```
bash post_init.sh
```

### - How can I manually add this feature to an existing project ? 

1. In a bash terminal, run

```
git submodule add https://renkulab.io/gitlab/omnibenchmark/utils src/utils/
git submodule update --init --recursive
git commit -am 'Add utils submodule.'
git push
```

2. In the root directory, create the `post-init.sh` that will perform the update by running

```
cat >post-init.sh <<EOL
#!/bin/bash
# update git submodule
git submodule update --remote --merge
git add src/utils
git commit -m 'Update utils.'
EOL
```

Anthony Sonrel's avatar
Anthony Sonrel committed
3. In any script requiring the utils functions, write

```
source /work/$CI_PROJECT/src/utils/import.sh
```

Anthony Sonrel's avatar
Anthony Sonrel committed
### - How can I get all functions from the utils repo ? 

Source all scripts in this repo by running 

```
source src/utils/import.sh
```

You may get the following message: 

```
bash: /work/utils/src/config.sh: No such file or directory
Warning, /work/utils/src/config.sh does not exist and may be required for some functions
```

Which is normal if you just started a new project. Just be aware: to correctly run, most omnibenchmark rely on a `config.sh`, which contains user-specific parameters for the dataset/ method/ evaluation. 
## Upcoming 

- [ ] R/python script with installation of dependencies with `install.R`/`requirements.txt`. 

Anthony Sonrel's avatar
Anthony Sonrel committed
- [ ] Automatically source the utils .. ? (to discuss)