Skip to content

Commit 5b54aa7

Browse files
josenavasantgonza
authored andcommitted
[DO NOT MERGE] Release candidate (#2298) (#2299)
Release candidate (#2298)
1 parent 6080742 commit 5b54aa7

File tree

112 files changed

+3506
-3648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+3506
-3648
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,5 @@ gg_13_8-*
5858
# sphinx documentation
5959
qiita_pet/static/doc/
6060

61-
# moi static files
62-
qiita_pet/static/vendor/js/moi.js
63-
qiita_pet/static/vendor/js/moi_list.js
61+
# webdis log
62+
webdis.log

.travis.yml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
dist: precise
12
language: python
23
sudo: false
34
env:
@@ -6,10 +7,10 @@ env:
67
matrix:
78
- TEST_ADD_STUDIES=False COVER_PACKAGE=qiita_db
89
- TEST_ADD_STUDIES=False COVER_PACKAGE=qiita_pet
9-
- TEST_ADD_STUDIES=False COVER_PACKAGE="qiita_core qiita_ware"
10-
- TEST_ADD_STUDIES=True
10+
- TEST_ADD_STUDIES=True COVER_PACKAGE="qiita_core qiita_ware"
1111
before_install:
1212
- redis-server --version
13+
- redis-server --port 7777 &
1314
- wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
1415
- chmod +x miniconda.sh
1516
- ./miniconda.sh -b
@@ -27,43 +28,54 @@ install:
2728
# install a few of the dependencies that pip would otherwise try to install
2829
# when intalling scikit-bio
2930
- travis_retry conda create --yes -n qiita python=$PYTHON_VERSION pip nose flake8
30-
pyzmq networkx pyparsing natsort mock future libgfortran seaborn
31+
pyzmq networkx pyparsing natsort mock future libgfortran seaborn nltk
3132
'pandas>=0.18' 'matplotlib>=1.1.0' 'scipy>0.13.0' 'numpy>=1.7' 'h5py>=2.3.1'
3233
- source activate qiita
3334
- pip install -U pip
34-
- pip install sphinx sphinx-bootstrap-theme 'ipython[all]==2.4.1' nose-timer codecov
35-
- travis_retry pip install . --process-dependency-links
35+
- pip install sphinx sphinx-bootstrap-theme nose-timer codecov
3636
- 'echo "backend: Agg" > matplotlibrc'
37+
- git clone https://github.com/nicolasff/webdis
38+
- pushd webdis
39+
- make
40+
- ./webdis &
41+
- popd
42+
- travis_retry pip install . --process-dependency-links
3743
# Install the biom plugin so we can run the analysis tests
3844
- pip install https://github.com/qiita-spots/qiita_client/archive/master.zip
3945
- pip install https://github.com/qiita-spots/qtp-biom/archive/master.zip --process-dependency-links
4046
- export QIITA_SERVER_CERT=`pwd`/qiita_core/support_files/server.crt
47+
# loading redbiom with Qiita's test set
48+
# but first let's make sure redis is empty
49+
# following https://github.com/biocore/redbiom/blob/master/Makefile
50+
- export REDBIOM_HOST=http://127.0.0.1:7379
51+
- curl -s http://127.0.0.1:7379/FLUSHALL > /dev/null
52+
- redbiom admin scripts-writable
53+
- redbiom admin create-context --name "qiita-test" --description "qiita-test context"
54+
- redbiom admin load-sample-metadata --metadata `pwd`/qiita_db/support_files/test_data/templates/1_19700101-000000.txt
55+
- redbiom admin load-sample-metadata-search --metadata `pwd`/qiita_db/support_files/test_data/templates/1_19700101-000000.txt
56+
- redbiom admin load-sample-data --table `pwd`/qiita_db/support_files/test_data/processed_data/1_study_1001_closed_reference_otu_table.biom --context qiita-test --tag 4
57+
- redbiom admin load-sample-data --table `pwd`/qiita_db/support_files/test_data/processed_data/1_study_1001_closed_reference_otu_table-for_redbiom_tests.biom --context qiita-test --tag 5
4158
- mkdir ~/.qiita_plugins
59+
- export REDBIOM_HOST=http://127.0.0.1:7379
4260
- cp $PWD/qiita_core/support_files/BIOM\ type_2.1.4.conf ~/.qiita_plugins
4361
before_script:
44-
# Some of the tests rely on the plugin system to complete successfuly.
45-
# Thus, we need a qiita webserver running to be able to execute the tests.
46-
- export MOI_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
4762
# EBI, see the end of before_install about why this block is commented out
4863
# - if [ ${TRAVIS_PULL_REQUEST} == "false" ]; then
4964
# export QIITA_CONFIG_FP=`pwd`/qiita_core/support_files/config_test_travis.cfg;
50-
# export MOI_CONFIG_FP=`pwd`/qiita_core/support_files/config_test_travis.cfg;
5165
# fi
52-
- ipython profile create qiita-general --parallel
53-
- qiita-env start_cluster qiita-general
5466
- qiita-env make --no-load-ontologies
55-
- |
56-
if [ ${TEST_ADD_STUDIES} == "False" ]; then
57-
qiita pet webserver --no-build-docs start &
58-
fi
67+
- qiita-test-install
5968
script:
69+
# Some of the tests rely on the plugin system to complete successfuly.
70+
# Thus, we need a qiita webserver running to be able to execute the tests.
71+
- qiita pet webserver --no-build-docs start &
6072
- sleep 5
73+
- QIITA_PID=$!
74+
- nosetests $COVER_PACKAGE --with-doctest --with-coverage --with-timer -v --cover-package=$COVER_PACKAGE
75+
- kill $QIITA_PID
6176
- if [ ${TEST_ADD_STUDIES} == "True" ]; then test_data_studies/commands.sh ; fi
6277
- if [ ${TEST_ADD_STUDIES} == "True" ]; then qiita-cron-job ; fi
63-
- if [ ${TEST_ADD_STUDIES} == "False" ]; then qiita-test-install ; fi
64-
- if [ ${TEST_ADD_STUDIES} == "False" ]; then nosetests $COVER_PACKAGE --with-doctest --with-coverage --with-timer -v --cover-package=$COVER_PACKAGE; fi
6578
- flake8 qiita_* setup.py scripts/*
66-
- ls -R /home/travis/miniconda3/envs/qiita/lib/python2.7/site-packages/qiita_pet/support_files/doc/
6779
- qiita pet webserver
6880
addons:
6981
postgresql: "9.3"

CONTRIBUTING.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#Contributing to Qiita
1+
# Contributing to Qiita
22

33
Qiita is an open source software package, and we welcome community contributions. You can find the source code and test code for Qiita under public revision control in the Qiita git repository on [GitHub](http://github.com/biocore/qiita). We very much welcome contributions.
44

55
This document covers what you should do to get started with contributing to Qiita. You should read this whole document before considering submitting code to Qiita. This will save time for both you and the Qiita developers.
66

7-
#General Notes on Development
7+
# General Notes on Development
88

99
Adding source code to Qiita, can take place in three different modules:
1010

@@ -17,7 +17,15 @@ always take into consideration how these new features affect users and whether
1717
or not adding a new section or document to the documentation (found under the
1818
`doc` folder) would be useful.
1919

20-
###The Qiita development rules
20+
### Repository branch structure
21+
22+
The Qiita repository contains three branches:
23+
24+
* `master`: This branch reflects the code deployed in our [main Qiita server](http://qiita.microbio.me).
25+
* `dev`: This branch is the active development branch. All new Pull Requests should be performed against this branch.
26+
* `release-candidate`: This branch is used to freeze the code from the `dev` branch, so we can deploy in our test servers and exercise the code extensively before deploying in our main system. Code freezes typically occur one week before the scheduled deployment. Check our [milestones page](https://github.com/biocore/qiita/milestones) to see the scheduled deployments.
27+
28+
### The Qiita development rules
2129

2230
Since Qiita is a package that is continuously growing, we found ourselves in a position where development rules needed to be established so we can reduce both development and reviewer time. These rules are:
2331

@@ -46,49 +54,47 @@ Since Qiita is a package that is continuously growing, we found ourselves in a p
4654
9. Last but not least, you are working as part of a team and you should try to help others when possible.
4755

4856

49-
###Configuration file
57+
### Configuration file
5058

51-
The Qiita configuration file determines how the package interacts with your system’s resources (redis, postgres and the IPython cluster). Thus you should review the documentation detailed [here](https://docs.google.com/document/d/1u7kwLP31NM513-8xwpwvLbSQxYu0ehI6Jau1APR13e0/edit#), but especially bear in mind the following points:
59+
The Qiita configuration file determines how the package interacts with your system’s resources (redis and postgres). Thus you should review the documentation detailed [here](https://docs.google.com/document/d/1u7kwLP31NM513-8xwpwvLbSQxYu0ehI6Jau1APR13e0/edit#), but especially bear in mind the following points:
5260

5361
* An example version of this file can be found here `qiita_core/support_files/qiita_config.txt` and if you don’t set a `QIITA_CONFIG_FP` environment variable, that’s the file that Qiita will use.
5462
* The `[main]` section sets a `TEST_ENVIRONMENT` variable, which determines whether your system will be running unit tests or if it a demo/production system. You will want to set the value to TRUE if you are running the unit tests.
5563

5664
**A note on data accumulation**: Qiita keeps data in the `BASE_DATA_DIR` as the system gets used. When you drop a Qiita environment and create a fresh testing environment, the “old” data that was generated from the previous environment should be **manually** deleted (or, at least, removed from the data directories in the `BASE_DATA_DIR`).
5765

58-
###Unit tests
66+
### Unit tests
5967

6068
Unit tests in Qiita are located inside the tests/test folder of every sub-module, for example `qiita_db/test/test_metadata_template.py`. These can be executed on a per-file basis or using `nosetests` from the base directory.
6169

6270
During test creation make sure the test class is decorated with `@qiita_test_checker()` if database modifications are done during tests. This will automatically drop and rebuild the qiita schema after the entire test class has been executed. This requires to all the tests in a single class be independent of each other, so stochastic failures do not occur due to different test order execution.
6371

6472
Coverage testing is in effect, so run tests using `nosetests --with-coverage [test_file.py]` to check what lines of new code in your pull request are not tested.
6573

66-
###Documentation
74+
### Documentation
6775

6876
The documentation for Qiita is maintained as part of this repository, under the
6977
`qiita_pet/support_files/doc` folder, for more information, see the README.md
7078
file in `qiita_pet/support_files/doc/README.md`.
7179

72-
###Scripts
80+
### Scripts
7381

7482
Scripts in Qiita are located inside the scripts directory, their actions will rely on the settings described in the Qiita config file, for example if you are dropping a database, the database that will be dropped is the one described by the `DATABASE` setting. The following is a list of the most commonly used commands during development:
7583

7684
* `qiita-env make` will create a new environment (as specified by the Qiita config file).
7785
* `qiita-env drop` will delete the environment (as specified by the Qiita config file).
78-
* `qiita-env start_cluster qiita-general`, starts an IPython cluster named ‘qiita-general’. Normally you’ll want to wait a few seconds for the engines to start and become responsive (30-40 seconds depending on your system).
79-
* `qiita-env stop_cluster qiita-general`, terminates a cluster named ‘qiita-general’.
8086
* `qiita pet webserver start`, will start the Qiita web-application running on port 21174, you can change this using the `--port` flag, for example `--port=7532`.
8187

82-
##Making Database Changes
88+
## Making Database Changes
8389
After the initial production release of Qiita, changes to the database schema will require patches; the database can no longer be dropped and recreated using the most recent schema because all the data would be lost! Therefore, patches must be applied instead.
8490

85-
###Approach
91+
### Approach
8692

8793
1. We keep "unpatched" versions of the SQL and DBS files in the repository
8894
2. We keep fully patched versions of the DBS and HTML files in the repository
8995
3. We keep a patch file for each patch as required in the `qiita_db/support_files/patches` directory. Note that **the patches will be applied in order based on the natural sort order of their filename** (e.g., `2.sql` will be applied before `10.sql`, and `10.sql` will be applied before `a.sql`)
9096

91-
###Developer Workflow
97+
### Developer Workflow
9298

9399
1. Load the fully patched DBS file (e.g., `qiita-db.dbs`) in [DBSchema](http://www.dbschema.com/)
94100
2. Make desired changes
@@ -101,17 +107,17 @@ After the initial production release of Qiita, changes to the database schema wi
101107

102108
One drawback is that developers will need to have [DBSchema](http://www.dbschema.com/) to develop for this project.
103109

104-
###Data Patches
110+
### Data Patches
105111

106112
If you need to submit a patch that changes only data but does not alter the schema, you should still create a patch file with the next name (e.g., `2.sql`) with your changes. Note that a patch should *not* be created if the modifications do not apply to Qiita databases in general; data patches are only necessary in some cases, e.g., if the terms in an ontology change.
107113

108-
###Python Patches
114+
### Python Patches
109115

110116
Occasionally, SQL alone cannot effect the desired changes, and a corresponding python script must be run after the SQL patch is applied. If this is the case, a python file should be created in the `patches/python_patches` directory, and it should have the same basename as the SQL file. For example, if there is a patch `4.sql` in the `patches` directory, and this patch requires a python script be run after the SQL is applied, then the python file should be placed at `patches/python_patches/4.py`. Note that not every SQL patch will have a corresponding python patch, but every python patch will have a corresponding SQL patch.
111117

112118
If in the future we discover a use-case where a python patch must be applied for which there *is no corresponding SQL patch*, then a blank SQL patch file will still need to be created.
113119

114-
##SQL coding guidelines
120+
## SQL coding guidelines
115121
Since the `qiita_db` code contains a mixture of python code and SQL code, here are some coding guidelines to add SQL code to Qiita:
116122

117123
1. Any SQL keyword should be written uppercased:

INSTALL.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Install the non-python dependencies
6060

6161
* [PostgreSQL](http://www.postgresql.org/download/) (minimum required version 9.3.5, we have tested most extensively with 9.3.6)
6262
* [redis-server](http://redis.io) (we have tested most extensively with 2.8.17)
63+
* [webdis] (https://github.com/nicolasff/webdis) (latest version should be fine but we have tested the most with 9ee6fe2 - Feb 6, 2016)
6364

6465
There are several options to install these dependencies depending on your needs:
6566

@@ -87,6 +88,27 @@ brew update
8788
brew install homebrew/versions/redis28
8889
```
8990

91+
### webdis
92+
93+
Note that this is the only package that assumes that Qiita is already installed (due to library dependencies). Also, that the general suggestion is to have 2 redis servers running, one for webdis/redbiom and the other for Qiita. The reason for multiple redis servers is so that the redbiom cache can be flushed without impacting the operation of the qiita server itself.
94+
95+
The following instructions install, compile and pre-populates the redbiom redis DB so we assume that redis is running on the default port and that Qiita is fully installed as the redbiom package is installed with Qiita.
96+
97+
```
98+
git clone https://github.com/nicolasff/webdis
99+
pushd webdis
100+
make
101+
./webdis &
102+
popd
103+
# note that this assumes that Qiita is already installed
104+
fp=`python -c 'import qiita_db; print qiita_db.__file__'`
105+
qdbd=`dirname $fp`
106+
redbiom admin scripts-writable
107+
redbiom admin create-context --name "qiita-test" --description "qiita-test context"
108+
redbiom admin load-sample-metadata --metadata ${qdbd}/support_files/test_data/templates/1_19700101-000000.txt
109+
redbiom admin load-sample-metadata-search --metadata ${qdbd}/support_files/test_data/templates/1_19700101-000000.txt
110+
redbiom admin load-sample-data --table ${qdbd}/support_files/test_data/processed_data/1_study_1001_closed_reference_otu_table.biom --context qiita-test --tag 1
111+
```
90112

91113
Install Qiita development version and its python dependencies
92114
-------------------------------------------------------------
@@ -110,11 +132,6 @@ Install Qiita (this occurs through setuptools' `setup.py` file in the qiita dire
110132
pip install -e . --process-dependency-links
111133
```
112134

113-
Install the development version of moi:
114-
```bash
115-
pip install https://github.com/biocore/mustached-octo-ironman/archive/master.zip --no-deps
116-
```
117-
118135
At this point, Qiita will be installed and the system will start. However,
119136
you will need to install plugins in order to process any kind of data. For a list
120137
of available plugins, visit the [Qiita Spots](https://github.com/qiita-spots)
@@ -145,22 +162,22 @@ Set your `QIITA_CONFIG_FP` environment variable to point to that file (into `.ba
145162

146163
```bash
147164
echo "export QIITA_CONFIG_FP=$HOME/.qiita_config_test.cfg" >> ~/.bashrc
148-
echo "export MOI_CONFIG_FP=$HOME/.qiita_config_test.cfg" >> ~/.bashrc
149165
source ~/.bashrc
150166
# Re-enable conda environment for qiita
151167
source activate qiita
152168
```
153169

154-
Setup ipython profile for qiita:
170+
Next, make a test environment:
155171

156172
```bash
157-
ipython profile create qiita-general --parallel
173+
qiita-env make --no-load-ontologies
158174
```
159175

160-
Next, make a test environment:
176+
Finally, redbiom relies on the REDBIOM_HOST environment variable to set the URL to query. By default is set to Qiita redbiom public repository. To change it you could do:
177+
161178

162179
```bash
163-
qiita-env make --no-load-ontologies
180+
export REDBIOM_HOST=http://my_host.com:7379
164181
```
165182

166183
## Start Qiita
@@ -173,12 +190,6 @@ Next, start redis server (the command may differ depending on your operating sys
173190
redis-server
174191
```
175192

176-
Start the IPython cluster:
177-
178-
```bash
179-
qiita-env start_cluster qiita-general && sleep 30
180-
```
181-
182193
Start the qiita server:
183194

184195
```bash

qiita_core/configuration_manager.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,6 @@ class ConfigurationManager(object):
5858
The host where the database lives
5959
port : int
6060
The port used to connect to the postgres database in the previous host
61-
ipyc_demo : str
62-
The IPython demo cluster profile
63-
ipyc_demo_n : int
64-
The size of the demo cluster
65-
ipyc_reserved : str
66-
The IPython reserved cluster profile
67-
ipyc_reserved_n : int
68-
The size of the reserved cluster
69-
ipyc_general : str
70-
The IPython general cluster profile
71-
ipyc_general_n : int
72-
The size of the general cluster
7361
smtp_host : str
7462
The SMTP host from which mail will be sent
7563
smtp_port : int
@@ -145,7 +133,7 @@ def __init__(self):
145133
config.readfp(conf_file)
146134

147135
_required_sections = {'main', 'redis', 'postgres', 'smtp', 'ebi',
148-
'ipython', 'portal'}
136+
'portal'}
149137
if not _required_sections.issubset(set(config.sections())):
150138
missing = _required_sections - set(config.sections())
151139
raise MissingConfigSection(', '.join(missing))
@@ -155,7 +143,6 @@ def __init__(self):
155143
self._get_postgres(config)
156144
self._get_redis(config)
157145
self._get_ebi(config)
158-
self._get_ipython(config)
159146
self._get_vamps(config)
160147
self._get_portal(config)
161148

@@ -283,10 +270,6 @@ def _get_ebi(self, config):
283270
self.ebi_center_name = sec_get('EBI_CENTER_NAME')
284271
self.ebi_organization_prefix = sec_get('EBI_ORGANIZATION_PREFIX')
285272

286-
def _get_ipython(self, config):
287-
self.ipython_contexts = config.get('ipython', 'context').split(',')
288-
self.ipython_default = config.get('ipython', 'default')
289-
290273
def _get_vamps(self, config):
291274
self.vamps_user = config.get('vamps', 'USER')
292275
self.vamps_pass = config.get('vamps', 'PASSWORD')

0 commit comments

Comments
 (0)