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

Roslin qc #151

Open
wants to merge 46 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
08ae5a0
fix merge conflict
stevekm Jan 22, 2020
9bf2ce7
Merge branch 'develop' into test-pairing
stevekm Jan 28, 2020
d77be1d
add tests for base RoslinQcOperator class
stevekm Jan 29, 2020
563009c
add test to Makefile
stevekm Feb 4, 2020
ce2a2c5
Merge branch 'develop' into roslin-qc
stevekm Feb 4, 2020
0d4dfb9
merge against develop
stevekm Feb 5, 2020
da2449a
update fixture dump script for dumping Run's
stevekm Feb 5, 2020
bd4bf07
start Roslin QC operator and input parsing with tests and fixtures
stevekm Feb 5, 2020
a4816de
merge against develop
stevekm Feb 5, 2020
83bf428
add tests for serializer using output_metadata field
stevekm Feb 11, 2020
b1406d9
merge against develop
stevekm Feb 11, 2020
9e3419b
update demo run methods and input.json template
stevekm Feb 12, 2020
33a8c19
add fixture duplication script
stevekm Feb 15, 2020
6cd29d2
Merge branch 'duplication-script' into roslin-qc
stevekm Feb 15, 2020
d452748
add multiple run handling for roslin qc input, update fixtures and sc…
stevekm Feb 16, 2020
1464afc
merge against develop
stevekm Feb 16, 2020
40f49f6
merge against develop
stevekm Feb 16, 2020
300bea2
add RoslinQCOperator to get by classname for Operator Factory
stevekm Feb 18, 2020
de58404
make Roslin operator data easier to read
stevekm Feb 19, 2020
e9670d1
update Makefile and operator tests
stevekm Feb 19, 2020
30284a2
add roslin qc pipeline fixture
stevekm Feb 19, 2020
84d182a
clean up Roslin operator
stevekm Feb 19, 2020
5eccbf1
add sorting to QC inputs for reproducibility
stevekm Feb 19, 2020
851ad77
update Roslin qc operator and tests
stevekm Feb 19, 2020
cdeb92d
disable bid to cwl conversion since its handled elsewhere
stevekm Feb 20, 2020
40869d4
remove CWL conversion
stevekm Feb 20, 2020
2787baa
refactor job data generation methods
stevekm Feb 24, 2020
0d2bc2b
update Roslin QC operator tests
stevekm Feb 24, 2020
e615bf4
update test for input generation
stevekm Feb 24, 2020
0a7c95a
merge against develop and fix conflicts
stevekm Feb 24, 2020
145fd99
merge against develop
stevekm Feb 25, 2020
39f13c8
merge against roslin-qc
stevekm Feb 25, 2020
c43cc7d
update serializer tests
stevekm Feb 25, 2020
8e70561
merge against roslin-qc
stevekm Feb 25, 2020
70e55ae
update import recipe
stevekm Feb 25, 2020
188eddf
move server log to logs dir
stevekm Feb 25, 2020
fbd7acb
update API run view to support Run IDs, fixes #157
stevekm Feb 25, 2020
b235fc6
fix service checking in Makefile before trying to start server
stevekm Feb 26, 2020
89d58b6
add job JSON dumping
stevekm Feb 26, 2020
8e43ac9
remove exception
stevekm Feb 27, 2020
1f8643a
change filemetadata query method
stevekm Feb 27, 2020
0b68c26
add completion script
stevekm Feb 27, 2020
24e3902
merge against develop
stevekm Feb 27, 2020
9490db8
merge against develop
stevekm Mar 3, 2020
dd7070e
add dump all pipelines to script
stevekm Mar 3, 2020
eb100ce
refactor roslin qc operator to use updated roslin pipeline output
stevekm Mar 4, 2020
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ db*
scripts/*.json
conda*
input.json
scripts/*.json*
*.swp
65 changes: 49 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ check-env:
BEAGLE_AUTH_LDAP_SERVER_URI \
BEAGLE_LIMS_PASSWORD \
BEAGLE_LIMS_USERNAME; do \
[ -z "$$(printenv BEAGLE_LIMS_USERNAME)" ] && echo ">>> env variable $$i is not set; some features may not work" || : ; done
[ -z "$$(printenv $$i)" ] && echo ">>> env variable $$i is not set; some features may not work" || : ; done

# start the RabbitMQ server in the background
rabbitmq-start: $(LOG_DIR_ABS)
Expand Down Expand Up @@ -273,7 +273,7 @@ celery-start:

# check that the Celery processes are running
celery-check:
-ps auxww | grep 'celery' | grep -v 'grep' | grep -v 'make' | grep '$(CURDIR)'
ps auxww | grep 'celery' | grep -v 'grep' | grep -v 'make' | grep '$(CURDIR)'

# kill all the Celery processes started from this dir
celery-stop:
Expand All @@ -291,11 +291,14 @@ start-services: check-env
$(MAKE) celery-start

stop-services:
$(MAKE) celery-stop
$(MAKE) rabbitmq-stop
$(MAKE) db-stop

-$(MAKE) celery-stop
-$(MAKE) rabbitmq-stop
-$(MAKE) db-stop

check-services:
$(MAKE) celery-check
$(MAKE) db-check
$(MAKE) rabbitmq-check

# ~~~~~ Set Up Django ~~~~~ #
export DJANGO_BEAGLE_IP:=localhost
Expand All @@ -311,15 +314,20 @@ export DJANGO_RIDGEBACK_IP:=localhost
export DJANGO_RIDGEBACK_PORT:=7001
export BEAGLE_RIDGEBACK_URL=http://$(DJANGO_RIDGEBACK_IP):$(DJANGO_RIDGEBACK_PORT)
export DJ_DEBUG_LOG:=$(LOG_DIR_ABS)/dj.debug.log

export BEAGLE_LOG_PATH:=$(LOG_DIR_ABS)/beagle-server.log
export DUMP_JSON:=False

# initialize the Django app in the database
# do this after setting up the db above
django-init:
python manage.py makemigrations --merge
python manage.py makemigrations # --merge
python manage.py migrate
$(MAKE) django-load-fixtures
python manage.py createsuperuser

django-load-fixtures:
python manage.py loaddata \
beagle_etl.operator.json \
file_system.filegroup.json \
file_system.filetype.json \
file_system.storage.json \
Expand All @@ -336,6 +344,7 @@ test-lims: check-env

# start the Django development server
runserver: check-env
if $(MAKE) check-services ; then : ; else echo ">>> ERROR: some services are not started"; exit 1 ; fi
python manage.py runserver $(DJANGO_BEAGLE_IP):$(DJANGO_BEAGLE_PORT)

MIGRATION_ARGS?=
Expand Down Expand Up @@ -377,9 +386,10 @@ REQID:=07264_G
TOKEN:=IUzI1NiJ9.eyJ0
# import files data about samples in a request from the IGO LIMS
import:
token=$$( jq -r '.token' "$(AUTH_FILE)" ) && \
curl -H "Content-Type: application/json" \
-X POST \
-H "Authorization: Bearer $(TOKEN)" \
-H "Authorization: Bearer $$token" \
--data '{"request_ids":["$(REQID)"]}' \
http://$(DJANGO_BEAGLE_IP):$(DJANGO_BEAGLE_PORT)/v0/etl/import-requests/

Expand Down Expand Up @@ -430,6 +440,7 @@ files-request:
--data '{"request_ids":["$(REQID)"]}' \
http://$(DJANGO_BEAGLE_IP):$(DJANGO_BEAGLE_PORT)/v0/fs/files/
# python ./beagle_cli.py files list --metadata='requestId:$(REQID)'
# http://localhost:6991/v0/fs/files/?metadata=requestId:DemoRequest1

# get info on a single file
REQFILE:=b37.fasta
Expand All @@ -440,22 +451,26 @@ file-get:
http://$(DJANGO_BEAGLE_IP):$(DJANGO_BEAGLE_PORT)/v0/fs/files/?filename=$(REQFILE)

# start a Roslin run for a given request in the Beagle db
run-request:
PIPELINE:=roslin
run-request: $(AUTH_FILE)
token=$$( jq -r '.token' "$(AUTH_FILE)" ) && \
curl -H "Content-Type: application/json" \
-X POST \
-H "Authorization: Bearer $(TOKEN)" \
--data '{"request_ids":["$(REQID)"], "pipeline_name": "roslin"}' \
-H "Authorization: Bearer $$token" \
--data '{"request_ids":["$(REQID)"], "pipeline_name": "$(PIPELINE)"}' \
http://$(DJANGO_BEAGLE_IP):$(DJANGO_BEAGLE_PORT)/v0/run/request/

# send a pipeline input to the API to start running
REQJSON:=fixtures/tests/run_roslin.json
run-request-api: $(AUTH_FILE)
@token=$$( jq -r '.token' "$(AUTH_FILE)" ) && \
token=$$( jq -r '.token' "$(AUTH_FILE)" ) && \
curl -H "Content-Type: application/json" \
-X POST \
-H "Authorization: Bearer $$token" \
--data @$(REQJSON) \
http://$(DJANGO_BEAGLE_IP):$(DJANGO_BEAGLE_PORT)/v0/run/api/
# http://localhost:6991/v0/run/api/?metadata=requestId:10277_C
# http://localhost:6991/v0/run/api/?requestId%3D10277_C/

# make a demo Roslin input.json file from the template fixture;
# need to update the fixture with the app ID of the demo pipeline that was loaded in the database
Expand All @@ -471,12 +486,32 @@ $(DEMO_INPUT): $(INPUT_TEMPLATE) $(AUTH_FILE)
.PHONY: $(DEMO_INPUT)

# submit a demo Roslin run using the dev Roslin pipeline entry in the database
demo-run: register-dev-pipeline $(DEMO_INPUT)
# submit using the API endpoint; bypasses the Operator
demo-run-api: register-dev-pipeline $(DEMO_INPUT)
@python manage.py loaddata fixtures/tests/juno_roslin_demo2.file.json
@python manage.py loaddata fixtures/tests/juno_roslin_demo2.filemetadata.json
@python manage.py loaddata fixtures/tests/roslin_reference_files.json
@$(MAKE) run-request-api REQID=DemoRequest1 REQJSON=$(DEMO_INPUT)

demo-roslin-qc:
python manage.py loaddata fixtures/tests/ca18b090-03ad-4bef-acd3-52600f8e62eb.run.full.json && \
token=$$( jq -r '.token' "$(AUTH_FILE)" ) && \
curl -H "Content-Type: application/json" \
-X POST \
-H "Authorization: Bearer $$token" \
--data '{"request_ids":[], "run_ids":["ca18b090-03ad-4bef-acd3-52600f8e62eb"], "pipeline_name": "roslin-qc"}' \
http://$(DJANGO_BEAGLE_IP):$(DJANGO_BEAGLE_PORT)/v0/run/request/
# python manage.py loaddata fixtures/tests/8f44d2f8-15c0-4d97-a966-6ad0b916bb41.run.ALN-REQ-ID.json && \

# run the update-request endpoint for a request ID in order to update the metadata about a request
update-request:
@token=$$( jq -r '.token' "$(AUTH_FILE)" ) && \
curl -H "Content-Type: application/json" \
-X POST \
-H "Authorization: Bearer $$token" \
--data '{"request_ids":["$(REQID)"], "pipeline_name": "roslin"}' \
http://$(DJANGO_BEAGLE_IP):$(DJANGO_BEAGLE_PORT)/v0/etl/update-requests/

# check if the ports needed for services and servers are already in use on this system
ifeq ($(UNAME), Darwin)
# On macOS High Sierra, use this command: lsof -nP -i4TCP:$PORT | grep LISTEN
Expand Down Expand Up @@ -514,5 +549,3 @@ PORT=
port-check:
ss -lntup | grep ':$(PORT)'
endif


1 change: 1 addition & 0 deletions beagle/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,4 @@
PROJECT_DIR = os.path.dirname(os.path.realpath(__file__))
ROOT_DIR = os.path.dirname(PROJECT_DIR)
TEST_FIXTURE_DIR = os.path.join(ROOT_DIR, "fixtures", "tests")
DUMP_JSON = os.environ.get('DUMP_JSON') == 'True'
10 changes: 10 additions & 0 deletions beagle_etl/fixtures/beagle_etl.operator.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,15 @@
"class_name": "AccessOperator",
"slug": "access"
}
},
{
"model": "beagle_etl.operator",
"pk": 3,
"fields": {
"active": true,
"recipes": "[]",
"class_name": "RoslinQcOperator",
"slug": "roslin-qc"
}
}
]
Loading