Skip to content
Snippets Groups Projects
Commit 01c7159f authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

clean up the packaging and distribution code

parent fd30e487
No related branches found
No related tags found
No related merge requests found
Showing
with 54 additions and 41 deletions
include README.md
include jass/swagger/swagger.yaml
recursive-include jass/static *
recursive-include celery_files *
# JASS # JASS
## setup ## install
The main requirement is **python 3**. To setup the server in a dedicated virtualenv (you need **virtualenv**), please execute the following from the root directory, once you have cloned the repository: You need **python3** to install and use JASS.
``` ```
virtualenv venv # install
. venv/bin/activate pip install [TODO upload to pypi]
pip3 install -r requirements.txt
# you can quit the virtualenv with
deactivate
``` ```
## run ## configure and import data
``` ```
# activate the virtualenv # configure
. venv/bin/activate export JASS_DATA_DIR=/tmp/JASSDATA
# run the server, [CTRL+C] to quit # import GWAS data into JASS
python -m swagger-server python -m jass create_init_table [TODO use IMpG format]
# you can quit the virtualenv with
deactivate
``` ```
## browse ## run a server
### for end users
TODO
### for developers
The Swagger UI is there:
``` ```
http://localhost:8080/ui/ # launch celery to process tasks
celery -A jass worker
# launch the web server
python -m jass serve
``` ```
The Swagger definition for this server's API lives here: ## use JASS on the command line
``` ```
http://localhost:8080/swagger.json # list available phenotypes on the command line
python -m jass list-phenotypes
# compute joint statistics on the command line into an HDF file
python -m jass create-worktable --phenotypes z_RA_RA z_ReproGen_AME --worktable-path testwt.h5
# create the global manhattan plot for a joint statistics file
python -m jass plot-manhattan --worktable-path testwt.h5 --plot-path testgm.png
# create the quadrant plot for a joint statistics file
python -m jass plot-quadrant --worktable-path testwt.h5 --plot-path testqd.png
``` ```
# tests
To launch the integration tests, use tox:
```
sudo pip install tox
tox
```
CELERYD_NODES="worker" CELERYD_NODES="worker"
CELERY_BIN="/opt/jass/venv/bin/celery" CELERY_BIN="/opt/jass/venv/bin/celery"
CELERY_APP="swagger_server.models.project" CELERY_APP="jass.models.project"
CELERYD_CHDIR="/opt/jass" CELERYD_CHDIR="/opt/jass"
CELERYD_OPTS="--time-limit=3000 --concurrency=1 --max-tasks-per-child=1 --executable=/opt/jass/venv/bin/python" CELERYD_OPTS="--time-limit=3000 --concurrency=1 --max-tasks-per-child=1 --executable=/opt/jass/venv/bin/python"
CELERYD_LOG_FILE="/opt/jass/log/celery%N.log" CELERYD_LOG_FILE="/opt/jass/log/celery%N.log"
......
...@@ -5,7 +5,7 @@ activate_this = '/opt/jass/venv/bin/activate_this.py' ...@@ -5,7 +5,7 @@ activate_this = '/opt/jass/venv/bin/activate_this.py'
exec(open(activate_this).read(), dict(__file__=activate_this)) exec(open(activate_this).read(), dict(__file__=activate_this))
sys.path.insert(0, '/opt/jass') sys.path.insert(0, '/opt/jass')
from swagger_server.server import get_jass_app from jass.server import get_jass_app
app = get_jass_app() app = get_jass_app()
application = app.app application = app.app
from celery import Celery
import jass.models.project
def make_celery(app):
celery = Celery(jass.models.project)
celery.conf.update(app.config)
TaskBase = celery.Task
class ContextTask(TaskBase):
abstract = True
def __call__(self, *args, **kwargs):
with app.app_context():
return TaskBase.__call__(self, *args, **kwargs)
celery.Task = ContextTask
return celery
from flask import Flask
flask_app = Flask(__name__)
celery = make_celery(flask_app)
File moved
...@@ -11,6 +11,6 @@ if 'JASS_HOST' in os.environ: ...@@ -11,6 +11,6 @@ if 'JASS_HOST' in os.environ:
if 'JASS_PORT' in os.environ: if 'JASS_PORT' in os.environ:
config['PORT'] = os.environ['JASS_PORT'] config['PORT'] = os.environ['JASS_PORT']
if 'JASS_DATA_DIR' in os.environ: if 'JASS_DATA_DIR' in os.environ:
config['JASS_DATA_DIR'] = os.environ['JASS_DATA_DIR'] config['DATA_DIR'] = os.environ['JASS_DATA_DIR']
if 'JASS_INITTABLE_CHUNKSIZE' in os.environ: if 'JASS_INITTABLE_CHUNKSIZE' in os.environ:
config['INITTABLE_CHUNKSIZE'] = int(os.environ['JASS_INITTABLE_CHUNKSIZE']) config['INITTABLE_CHUNKSIZE'] = int(os.environ['JASS_INITTABLE_CHUNKSIZE'])
File moved
...@@ -5,9 +5,9 @@ from six import iteritems ...@@ -5,9 +5,9 @@ from six import iteritems
from flask import send_file, abort from flask import send_file, abort
import connexion import connexion
from swagger_server.models.phenotype import Phenotype, get_available_phenotypes from jass.models.phenotype import Phenotype, get_available_phenotypes
from swagger_server.models.project import Project, create_project from jass.models.project import Project, create_project
from swagger_server.config import config from jass.config import config
PHENOTYPES = get_available_phenotypes(os.path.join(config['DATA_DIR'],'initTable.hdf5')) #FIXME part of the config PHENOTYPES = get_available_phenotypes(os.path.join(config['DATA_DIR'],'initTable.hdf5')) #FIXME part of the config
def phenotypes_get(): def phenotypes_get():
......
from connexion.apps.flask_app import FlaskJSONEncoder from connexion.apps.flask_app import FlaskJSONEncoder
#from connexion.decorators import produces #from connexion.decorators import produces
from six import iteritems from six import iteritems
from swagger_server.models.base_model_ import Model from jass.models.base_model_ import Model
from pandas import isnull from pandas import isnull
class JSONEncoder(FlaskJSONEncoder): class JSONEncoder(FlaskJSONEncoder):
......
File moved
File moved
File moved
...@@ -12,7 +12,7 @@ from .base_model_ import Model ...@@ -12,7 +12,7 @@ from .base_model_ import Model
from ..util import deserialize_model from ..util import deserialize_model
from .phenotype import Phenotype from .phenotype import Phenotype
from .worktable import create_worktable_file, get_worktable_summary, get_worktable_genomedata, get_worktable_local_manhattan_data, get_worktable_local_heatmap_data, create_global_plot, create_quadrant_plot from .worktable import create_worktable_file, get_worktable_summary, get_worktable_genomedata, get_worktable_local_manhattan_data, get_worktable_local_heatmap_data, create_global_plot, create_quadrant_plot
from swagger_server.config import config from jass.config import config
app = Celery('tasks', broker='pyamqp://guest@localhost//') app = Celery('tasks', broker='pyamqp://guest@localhost//')
......
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment