Skip to content

Commit

Permalink
make it run locally
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeAeich committed Dec 19, 2024
1 parent 0b1548e commit 9f5e99d
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 173 deletions.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,19 @@ dev-app da:
.PHONY: dev-celery dc
dev-celery dc:
@echo "Starting Celery worker..."
cd pro_wes && celery -A celery_worker worker -E --loglevel=info
cd pro_wes && celery -A celery_worker worker -E --loglevel=info

.PHONY: lint fl
lint fl:

@echo "1.Formatting with black..."
black --exclude .venv pro_wes/ setup.py tests/
@echo "\n\n2.Checking style with flake8..."
black --exclude .venv pro_wes/ setup.py tests/
@echo "\n\n3.Running pylint..."
pylint pro_wes/ setup.py

.PHONY: type-check tc
type-check tc:
@echo "Running mypy..."
mypy pro_wes/ setup.py
2 changes: 1 addition & 1 deletion docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
image: mongo:3.2
restart: unless-stopped
volumes:
- ${PROWES_DATA_DIR:-../data/pro_wes}/db:${PWD}/data/db
- ${PROWES_DATA_DIR:-../data/pro_wes}/db:/data/db
ports:
- "27017:27017"

Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ services:
links:
- mongodb
ports:
- "5682:5672"
- "5672:5672"

mongodb:
image: mongo:3.2
restart: unless-stopped
volumes:
- ${PROWES_DATA_DIR:-../data/pro_wes}/db:/data/db
ports:
- "27027:27017"
- "27017:27017"

flower:
image: mher/flower:0.9.7
Expand All @@ -50,4 +50,4 @@ services:
- prowes-worker
command: flower --broker=amqp://guest:guest@rabbitmq:5672// --port=5555
ports:
- "5565:5555"
- "5555:5555"
9 changes: 1 addition & 8 deletions pro_wes/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""proWES application entry point."""

import os
from pathlib import Path

from connexion import App
Expand All @@ -17,13 +16,8 @@ def init_app() -> App:
Returns:
FOCA application.
"""
_parent_dir = Path(__file__).resolve().parent
if os.environ.get("ENVIRONMENT") == "DEV":
config_file = _parent_dir / "config.dev.yaml"
else:
config_file = _parent_dir / "config.yaml"
foca = Foca(
config_file=config_file,
config_file=Path(__file__).resolve().parent / "config.yaml",
custom_config_model="pro_wes.config_models.CustomConfig",
)
app = foca.create_app()
Expand Down Expand Up @@ -53,6 +47,5 @@ def run_app(app: App) -> None:


if __name__ == "__main__":
os.environ.setdefault("ENVIRONMENT", "DEV")
foca_app = init_app()
run_app(app=foca_app)
154 changes: 0 additions & 154 deletions pro_wes/config.dev.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions pro_wes/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ security:
# Database configuration
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html#foca.models.config.DBConfig
db:
host: mongodb
host: localhost
port: 27017
dbs:
runStore:
Expand Down Expand Up @@ -92,7 +92,7 @@ log:
# Background job configuration
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html#foca.models.config.JobsConfig
jobs:
host: rabbitmq
host: localhost
port: 5672
backend: "rpc://"
include:
Expand All @@ -116,7 +116,7 @@ custom:
id_length: 6
polling_attempts: 100
polling_wait: 3
storage_path: "/data"
storage_path: "./data"
timeout_job: null
timeout_post: null
list_runs:
Expand Down
4 changes: 3 additions & 1 deletion pro_wes/ga4gh/wes/workflow_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,9 @@ def _validate_run_request(
"""
dict_of_lists = form_data.to_dict(flat=False)
# flatten single item lists
dict_atomic = {k: v[0] if len(v) == 1 else v for k, v in dict_of_lists.items()}
dict_atomic: dict = {
k: v[0] if len(v) == 1 else v for k, v in dict_of_lists.items()
}
# remove 'workflow_attachment' field
dict_atomic.pop("workflow_attachment", None)
model_instance = RunRequest(**dict_atomic)
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
connexion<3
email-validator>=2.1.0,<3
foca>=0.12.1
foca==0.12.1
gunicorn>=20.1.0,<21
pymongo==4.7 # Cf. https://github.com/elixir-cloud-aai/foca/issues/246

0 comments on commit 9f5e99d

Please sign in to comment.