Skip to content

Commit afdf3ea

Browse files
authored
Merge pull request #91 from kbase/develop
D->M
2 parents ef7e319 + 6dac72b commit afdf3ea

25 files changed

+2179
-597
lines changed

.github/workflows/run_tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Run Staging Service Tests
5+
6+
on:
7+
[push, pull_request]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python 3.6
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.6
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
if [ -f requirements.txt ]; then pip install -r requirements-actions.txt; fi
24+
- name: Test with pytest
25+
run: |
26+
bash run_tests.sh

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,4 @@ ENV/
103103
data/
104104
.DS_Store
105105
.virtualenvs/
106+
test.env

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,3 +725,67 @@ Error Connecting to auth service ...
725725
}
726726
```
727727

728+
729+
730+
731+
## Get Importer Mappings
732+
733+
This endpoint returns a list of available staging importer apps that have been marked as supported. This endpoint also
734+
returns a mapping between a list of files and predicted importer app.
735+
736+
For example,
737+
* if we pass in nothing we get a response with a list of apps, and no mappings
738+
* if we pass in a list of files, such as ["file1.fasta", "file2.fq", "None"], we would get back a response
739+
that maps to Fasta Importers and FastQ Importers, with a weight of 0 to 1
740+
which represents the probability that this is the correct importer for you.
741+
* for files for which there is no predicted app, the return is a null value
742+
* output type is not currently used for anything
743+
* this endpoint is used to power the dropdowns for the staging service window in the Narrative
744+
745+
**URL** : `ci.kbase.us/services/staging_service/importer_mappings`
746+
747+
**local URL** : `localhost:3000/importer_mappings`
748+
749+
**Method** : `POST`
750+
751+
**Headers** : Not Required
752+
753+
## Success Response
754+
755+
**Code** : `200 OK`
756+
757+
**Content example**
758+
759+
```
760+
data = {"file_list": ["file1.txt", "file.zip"]}
761+
async with AppClient(config, username) as cli:
762+
resp = await cli.post(
763+
"importer_mappings/", data=data
764+
)
765+
```
766+
Response:
767+
```
768+
{
769+
"apps": {
770+
"decompress/unpack": {
771+
"title": "Decompress/Unpack",
772+
"app": "kb_uploadmethods/unpack_staging_file",
773+
"output_type": [null],
774+
"extensions": ["zip", "tar", "tgz", "tar.gz", "7z", "gz", "gzip", "rar"],
775+
"id": 7
776+
},
777+
"mappings": [null, [{
778+
"id": 7,
779+
"title": "decompress/unpack",
780+
"app_weight": 1
781+
}]]
782+
}
783+
```
784+
## Error Response
785+
**Code** : `400 Bad Request`
786+
787+
**Content**
788+
```
789+
must provide file_list field
790+
```
791+

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### Version 1.1.8
2+
- Added new endpoint `importer-mappings/` for getting a mapping of importers for file names
3+
- Ran black
14

25
### Version 1.1.7
36
- Add a file name check to void user uploading files with name starting with space

deployment/conf/deployment.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
META_DIR = /kb/deployment/lib/src/data/metadata/
33
DATA_DIR = /kb/deployment/lib/src/data/bulk/
44
AUTH_URL = https://ci.kbase.us/services/auth/api/V2/token
5-
CONCIERGE_PATH = /kbaseconcierge
5+
CONCIERGE_PATH = /kbaseconcierge
6+
FILE_EXTENSION_MAPPINGS = /kb/deployment/conf/supported_apps_w_extensions.json

0 commit comments

Comments
 (0)