-
Notifications
You must be signed in to change notification settings - Fork 12
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
Deploy snpseq metadata service #237
Merged
slohse
merged 6 commits into
NationalGenomicsInfrastructure:monthly
from
b97pla:deploy_snpseq_metadata_service
Apr 29, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
883c949
set up snpseq-metadata-service
d73bd57
set up snpseq_metadata package
7b36b02
fix task names
6d1a503
download xml schema and generate python models
9e885f0
set environment
432f7e8
use upcoming snpseq_metadata version
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
snpseq_metadata_env_name: snpseq_metadata | ||
snpseq_metadata_env_path: "{{ anaconda_path }}/envs/{{ snpseq_metadata_env_name }}" | ||
|
||
snpseq_metadata_repo: https://github.com/Molmed/snpseq_metadata.git | ||
snpseq_metadata_version: 2763cee | ||
xml_schema_source_url: ftp://ftp.ebi.ac.uk/pub/databases/ena/doc/xsd/sra_1_5 | ||
|
||
snpseq_metadata_src_path: "{{ sw_path }}/metadata/snpseq_metadata" | ||
|
||
snpseq_metadata_service_repo: https://github.com/Molmed/snpseq-metadata-service.git | ||
snpseq_metadata_service_version: 39752ef | ||
|
||
snpseq_metadata_service_log_dir: "{{ static_ngi_log_path }}/metadata/snpseq_metadata_service/{{ deployment_environment }}" | ||
snpseq_metadata_service_src_path: "{{ sw_path }}/metadata/snpseq_metadata_service" | ||
snpseq_metadata_service_config_root: "{{ ngi_pipeline_conf }}/metadata/snpseq_metadata_service" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dependencies: | ||
- { role: anaconda, tags: anaconda } | ||
- { role: setup_base_config, tags: setup_base_config } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
|
||
- name: ensure snpseq-metadata-service conf dir exists | ||
file: | ||
state: directory | ||
path: "{{ snpseq_metadata_service_config_root }}" | ||
|
||
- name: deploy snpseq-metadata-service app config | ||
template: | ||
src: snpseq_metadata_service_app.config.j2 | ||
dest: "{{ snpseq_metadata_service_config_root }}/app.yaml" | ||
|
||
- name: deploy snpseq-metadata-service logger config | ||
template: | ||
src: snpseq_metadata_service_logger.config.j2 | ||
dest: "{{ snpseq_metadata_service_config_root }}/logger.yaml" | ||
|
||
- name: modify uppsala's supervisord conf to set environment and program commands | ||
ini_file: | ||
dest: "{{ supervisord_conf }}" | ||
section: program:snpseq-metadata-service-{{ deployment_environment }} | ||
option: "{{ item.opt }}" | ||
value: "{{ item.val }}" | ||
backup: no | ||
loop: | ||
- opt: command | ||
val: "{{ snpseq_metadata_env_path}}/bin/metadata-service -c {{ snpseq_metadata_service_config_root }}" | ||
- opt: autorestart | ||
val: true | ||
- opt: directory | ||
val: "{{ snpseq_metadata_service_log_dir }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
- name: create virtual python env, shared with snpseq-metadata-service | ||
shell: "conda create --name {{ snpseq_metadata_env_name }} python={{ python3_version }}" | ||
args: | ||
creates: "{{ snpseq_metadata_env_path }}" | ||
|
||
- name: get snpseq_metadata from git | ||
git: | ||
repo: "{{ snpseq_metadata_repo }}" | ||
dest: "{{ snpseq_metadata_src_path }}" | ||
version: "{{ snpseq_metadata_version }}" | ||
|
||
- name: install snpseq_metadata | ||
pip: | ||
name: . | ||
chdir: "{{ snpseq_metadata_src_path }}" | ||
executable: "{{ snpseq_metadata_env_path }}/bin/pip" | ||
state: present | ||
extra_args: "-U -e" | ||
|
||
- name: download XML schema | ||
command: "{{ snpseq_metadata_env_path }}/bin/generate_python_models.sh {{ snpseq_metadata_env_path }}/bin/xsdata {{ xml_schema_source_url }}" | ||
environment: | ||
PATH: "{{ snpseq_metadata_env_path }}/bin" | ||
args: | ||
chdir: "{{ snpseq_metadata_src_path }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
- name: create virtual python env, shared with snpseq_metadata | ||
shell: "conda create --name {{ snpseq_metadata_env_name }} python={{ python3_version }}" | ||
args: | ||
creates: "{{ snpseq_metadata_env_path }}" | ||
|
||
- name: get snpseq-metadata-service from git | ||
git: | ||
repo: "{{ snpseq_metadata_service_repo }}" | ||
dest: "{{ snpseq_metadata_service_src_path }}" | ||
version: "{{ snpseq_metadata_service_version }}" | ||
|
||
- name: install snpseq-metadata-service | ||
pip: | ||
name: . | ||
chdir: "{{ snpseq_metadata_service_src_path }}" | ||
executable: "{{ snpseq_metadata_env_path }}/bin/pip" | ||
state: present | ||
extra_args: "-U" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
- block: | ||
- include: install_package.yml | ||
- include: install_service.yml | ||
- include: install_config.yml | ||
|
||
- name: add static folders to be created | ||
set_fact: | ||
static_folders: "{{ static_folders + [snpseq_metadata_runfolder_path, snpseq_metadata_service_log_dir] }}" | ||
|
||
- name: Store tool versions in deployment | ||
lineinfile: | ||
dest: "{{ deployed_tool_versions }}" | ||
line: "{{ item.tool }}: {{ item.ver }}" | ||
loop: | ||
- tool: snpseq-metadata-service | ||
ver: "{{ snpseq_metadata_service_version }}" | ||
- tool: snpseq_metadata | ||
ver: "{{ snpseq_metadata_version }}" | ||
|
||
when: site in ["upps"] |
18 changes: 18 additions & 0 deletions
18
roles/snpseq-metadata-service/templates/snpseq_metadata_service_app.config.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
# the service will listen on this port | ||
port: {{ snpseq_metadata_service_port }} | ||
|
||
# the base url preceding the service endpoint | ||
base_url: /api/1.0 | ||
|
||
# the location on the server under which runfolders are stored | ||
# {runfolder} and {host} are substituted at each request to snpseq-metadata-server | ||
datadir: "{{ snpseq_metadata_runfolder_path }}/{runfolder}" | ||
|
||
# the url where the snpseq-data service can be accessed | ||
# on miarka, it won't be used so let's just point back to kong | ||
snpseq_data_url: http://localhost:4444 | ||
|
||
# the path to the snpseq_metadata python package main script | ||
# will be deployed in the same env as the service | ||
snpseq_metadata_executable: snpseq_metadata |
28 changes: 28 additions & 0 deletions
28
roles/snpseq-metadata-service/templates/snpseq_metadata_service_logger.config.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
version: 1 | ||
|
||
disable_existing_loggers: False | ||
|
||
formatters: | ||
simple: | ||
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" | ||
|
||
handlers: | ||
console: | ||
class: logging.StreamHandler | ||
level: DEBUG | ||
formatter: simple | ||
stream: ext://sys.stdout | ||
|
||
file_handler: | ||
class: logging.handlers.RotatingFileHandler | ||
level: DEBUG # By default set to WARNING, but can be changed on runtime | ||
formatter: simple | ||
filename: "{{ snpseq_metadata_service_log_dir }}/snpseq_metadata_service.log" | ||
maxBytes: 10485760 # 10MB | ||
backupCount: 20 | ||
encoding: utf8 | ||
|
||
root: | ||
level: DEBUG | ||
handlers: [console, file_handler] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why the snpseq_metadata package is not installed as a dependency of the snpseq_metadata service?
And also, shouldn't you download the ENA/SRA xml schema after installing the package here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not other than I opted for not creating a separate role for
snpseq_metadata
since it will likely only be used by this service and also installed in the same environment, so I figured I could just as well deploy them together.good catch about the schema, I will definitely need that, yes 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...or I guess you maybe mean that it should be a python dependency? that could perhaps be an option, not sure how straightforward it would be to run the post-install stuff but I guess there's probably hooks for that in pyproject
... actually, no - that seems not to be possible (by design)