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

Interactive apps #78

Merged
merged 51 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4eae4e1
Endpoint to upload a file to a completed job
sverhoeven Aug 25, 2023
a8d433d
Add `/api/job/{jobid}/tinyapp/rescore` endpoint
sverhoeven Sep 4, 2023
1c82e3a
Added /api/job/{jobid}/interactive/{application} endpoints from confi…
sverhoeven Sep 5, 2023
1f49c86
Revert "Endpoint to upload a file to a completed job"
sverhoeven Sep 5, 2023
5fd706f
Add Interactive applications to docs
sverhoeven Sep 5, 2023
bafcc3b
Add missing import
sverhoeven Sep 5, 2023
3189ba7
Add jobid to inter app get endpoints
sverhoeven Sep 5, 2023
0f5a55f
Escape newlines in command + stringify all command args
sverhoeven Sep 6, 2023
2b19b51
Add haddock3-re subcommands as interactive apps
sverhoeven Oct 3, 2023
346c3ef
Make linters happy
sverhoeven Oct 3, 2023
6edd4e5
Add re
sverhoeven Oct 9, 2023
6e17255
Remove newline escape
sverhoeven Oct 9, 2023
af04527
Comment out config section that does not work yet
sverhoeven Oct 12, 2023
65de039
Lower jsonschema version to be compat with poetry
sverhoeven Oct 12, 2023
5615cd6
Persist database in a Docker volume
sverhoeven Oct 13, 2023
4cac5e4
Sync with cli args fraction 2 fraction_cutoff
sverhoeven Nov 3, 2023
46cc790
Catchup to changed arguments of haddock3-re
sverhoeven Nov 3, 2023
0fc8183
Regenerate poetry.lock
sverhoeven Nov 3, 2023
02c142d
Use Jinja2 template in interactive app command
sverhoeven Nov 13, 2023
f86d57b
Lost a $
sverhoeven Nov 14, 2023
9b17967
Use emptier default for generate-token subcommand.
sverhoeven Nov 14, 2023
79924c8
More docs + embedded files + restrict on application of job + more tests
sverhoeven Nov 14, 2023
20cace0
Make Python 3.10 minimal version + fix rtd
sverhoeven Nov 14, 2023
16d9c17
Upgrade other ci to py310 + update sphinx autoapi
sverhoeven Nov 14, 2023
a3b517e
Making CI green
sverhoeven Nov 14, 2023
0d980c2
Better english
sverhoeven Nov 15, 2023
1391388
Bump to fastapi 0.99.0 + remove docs assets
sverhoeven Nov 15, 2023
d3303fe
Validate command template during startup
sverhoeven Nov 15, 2023
f4bb53d
Rename `command` to `command_template` + Rename `input` to `input_sch…
sverhoeven Nov 15, 2023
fb63bb6
Add q filter when validating command template during startup + add sk…
sverhoeven Nov 15, 2023
4ca82fe
Fix config examples
sverhoeven Nov 15, 2023
4d59f80
One more rename
sverhoeven Nov 15, 2023
58b0b3f
During startup rewrite openapi spec so applications and interactive a…
sverhoeven Jan 9, 2024
a03a13d
Trying to get openapi-generator to understand upload
sverhoeven Jan 9, 2024
98cb6c9
openapi generator is very picky.
sverhoeven Jan 9, 2024
55ef007
Give nice operation ids to apps + jobid is number
sverhoeven Jan 10, 2024
e293401
Fix tests
sverhoeven Jan 10, 2024
2c70ec3
Self review
sverhoeven Jan 10, 2024
d532117
Raise 503 when interactive application is started when load is above 1
sverhoeven Jan 10, 2024
2e08ec9
More tests
sverhoeven Jan 10, 2024
a0e60be
Call analyse so report.html can be read by webapp
sverhoeven Jan 12, 2024
db912c1
Add analyse to reclustfcc interactive app
sverhoeven Jan 15, 2024
0106108
Make application endpoints more like interactive endpoints
sverhoeven Jan 24, 2024
f07816f
Fix test
sverhoeven Jan 24, 2024
6adb63a
Do validation of form in route handler
sverhoeven Jan 24, 2024
7ec2571
Make upload_needs a list + more tests + updated docs
sverhoeven Jan 24, 2024
32c309b
No placeholders anymore
sverhoeven Jan 24, 2024
f3d68dc
Fix test
sverhoeven Jan 24, 2024
00acb9d
Set job dir in example + skipped test for non-string input
sverhoeven Jan 25, 2024
d7d61b2
Be more explicit about input types
sverhoeven Jan 25, 2024
87388f7
Merge pull request #81 from i-VRESSE/richer-application
sverhoeven Jan 25, 2024
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
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
Loading