Skip to content

Commit

Permalink
Merge pull request #78 from i-VRESSE/interactive_apps
Browse files Browse the repository at this point in the history
Interactive apps
  • Loading branch information
sverhoeven authored Jan 25, 2024
2 parents b4b35a7 + 87388f7 commit d9833fc
Show file tree
Hide file tree
Showing 31 changed files with 3,566 additions and 1,812 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ ignore =
WPS332,
; Found protected module import: _runner
WPS436,
; Found `noqa` comments overuse
WPS402,

per-file-ignores =
; all tests
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.10'
- name: Install deps
run: |
pip install -U pip wheel
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.10'
- name: Install deps
run: |
pip install -U pip wheel
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.10'
- name: Install deps
run: |
pip install -U pip wheel
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.10'
- name: Install deps
run: |
pip install -U pip wheel
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: '3.9'
python: '3.10'
jobs:
# https://github.com/readthedocs/readthedocs.org/issues/4912#issuecomment-1143587902
post_install:
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ moving the input and output files to the right place. To pick where an
application should be run you can choose from a list of existing Python
functions or supply your own.

Bartender can run quick interactive applications on completed jobs.
This is handy if you want to run a quick analysis on the output of a job.

Bartender can be used as the computational backend for a web application, the
web application should guide visitors into the submission and show the results.
See <https://github.com/i-VRESSE/haddock3-webapp> for an example.
Expand All @@ -44,17 +47,20 @@ at <https://i-vresse-bartender.readthedocs.io> .
curl -o config.yaml https://raw.githubusercontent.com/i-VRESSE/bartender/main/config-example.yaml
```

1. In another terminal, start up a database for storing users and jobs.
1. In another terminal, start up a database for storing jobs.

```bash
docker run \
-p "5432:5432" \
-e "POSTGRES_PASSWORD=bartender" \
-e "POSTGRES_USER=bartender" \
-e "POSTGRES_DB=bartender" \
--mount type=volume,source=bartender-db,target=/var/lib/postgresql/data \
postgres:15.2-bullseye
```

(Use `docker volume rm bartender-db` to clear the database storage`)
1. Create tables in the database
```bash
Expand Down Expand Up @@ -115,11 +121,10 @@ following steps to run a job:
4. Use authorize button on top of page to login with username
`user@example.com` and password `string`.
4. Submit archive.
1. Try out the `POST /api/application/{application}/job` route.
2. Use `wc` as application parameter
3. Upload the `README.zip` as request body.
4. Press execute button
5. The response contains a job identifier (`id` property) that can be used
1. Try out the `PUT /api/application/wc/job` route.
2. Upload the `README.zip` as request body.
3. Press execute button
4. The response contains a job identifier (`id` property) that can be used
to fetch the job state.
5. Fetch job state
1. Try out the `GET /api/job/{jobid}`
Expand Down
49 changes: 47 additions & 2 deletions config-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,57 @@ job_root_dir: /tmp/jobs
destination_picker: bartender.picker:pick_first
applications:
wc:
command: wc $config
config: README.md
command_template: wc README.md
upload_needs:
- README.md
count:
command_template: >
{% set flag = {
'lines': '-l',
'words': '-w',
'chars': '-m',
'bytes': '-c',
}[what] -%}
wc {{ flag|q }} README.md > count.txt
upload_needs:
- README.md
summary: Count in README.md
description: Count the number of lines, words, chars or bytes in a file called README.md in a uploaded zip file.
input_schema:
additionalProperties: false
type: object
properties:
what:
type: string
enum: [lines, words, chars, bytes]
description: What to count
default: lines
du:
command_template: du -hs . > du.txt
destinations:
local:
scheduler:
type: memory
slots: 1
filesystem:
type: local
interactive_applications:
count:
command_template: >
{% set flag = {
'lines': '-l',
'words': '-w',
'chars': '-m',
'bytes': '-c',
}[what] -%}
cat README.md | wc {{ flag|q }} > README.md.count
description: Count the number of lines, words, chars or bytes in README.md file.
job_application: wc
input_schema:
additionalProperties: false
type: object
properties:
what:
type: string
enum: [lines, words, chars, bytes]
default: lines
139 changes: 122 additions & 17 deletions config-haddock3.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,133 @@
destination_picker: bartender.config:pick_first
# Example configuration file for haddock3 and haddock3-re.
# Expects executables to be in PATH,
# if not edit this file to use absolute path to executables
job_root_dir: jobs
destination_picker: bartender.picker:pick_first
applications:
haddock3:
command: haddock3 $config
config: workflow.cfg
command_template: haddock3 workflow.cfg
upload_needs:
- workflow.cfg
# Below are other haddock3 commands,
# that could be hosted by bartender web service.
# TODO add support for label and parameters keys
haddock3-pp:
label: HADDOCK3 preprocess PDB files
command: haddock3-pp --output-directory . *.pdb
haddock3-analyse:
command: haddock3-analyse --run-dir . --modules $modules
parameters:
modules:
type: array
items:
type: int
haddock3-score:
command: haddock3-score --outputpdb --outputpsf $config
config: complex.pdb
# haddock3-pp:
# summary: HADDOCK3 preprocess PDB files
# command_template: haddock3-pp --output-directory . *.pdb
# haddock3-analyse:
# command_template: haddock3-analyse --run-dir . -m {{ modules|q }}
# input_schema:
# additionalProperties: false
# type: object
# properties:
# modules:
# type: string
# description: List of module numbers to analyse. Space separated.
destinations:
local:
scheduler:
type: memory
slots: 1
filesystem:
type: local
interactive_applications:
rescore:
command_template: >
haddock3-re score
--w_elec {{w_elec|q}} --w_vdw {{w_vdw|q}} --w_desolv {{w_desolv|q}} --w_bsa {{w_bsa|q}} --w_air {{w_air|q}}
{{ capri_dir|q }}
&&
haddock3-analyse --is_cleaned True --inter True -m {{ module_nr|q }} -r output/
description: Rescore a HADDOCK run with different weights.
job_application: haddock3
input_schema:
additionalProperties: false
properties:
module_nr:
type: number
capri_dir:
type: string
w_air:
type: number
w_bsa:
type: number
w_desolv:
type: number
w_elec:
type: number
w_vdw:
type: number
required:
- module_nr
- capri_dir
- w_elec
- w_vdw
- w_desolv
- w_bsa
- w_air
type: object
reclustrmsd:
command_template: >
haddock3-re clustrmsd
{% if criterion == 'maxclust' -%}
--n_clusters {{n_clusters|q}}
{% else -%}
--clust_cutoff {{clust_cutoff|q}}
{% endif -%}
{% if min_population -%}
--min_population {{min_population|q}}
{% endif -%}
{{clustrmsd_dir|q}}
&&
haddock3-analyse --is_cleaned True --inter True -m {{ module_nr|q }} -r output/
description: Recluster a HADDOCK run with RSMD and different parameters.
job_application: haddock3
input_schema:
additionalProperties: false
properties:
module_nr:
type: number
clustrmsd_dir:
type: string
criterion:
type: string
enum: [maxclust, distance]
clust_cutoff:
type: number
n_clusters:
type: number
min_population:
type: number
required:
- module_nr
- criterion
- clustrmsd_dir
type: object
reclustfcc:
command_template: >
haddock3-re clustfcc
--clust_cutoff {{clust_cutoff|q}} --strictness {{strictness|q}} --min_population {{min_population|q}}
{{clustfcc_dir|q}}
&&
haddock3-analyse --is_cleaned True --inter True -m {{ module_nr|q }} -r output/
description: Recluster a HADDOCK run with FCC and different parameters.
job_application: haddock3
input_schema:
additionalProperties: false
properties:
module_nr:
type: number
clustfcc_dir:
type: string
clust_cutoff:
type: number
strictness:
type: number
min_population:
type: number
required:
- module_nr
- clustfcc_dir
- clust_cutoff
- strictness
- min_population
type: object
Loading

0 comments on commit d9833fc

Please sign in to comment.