Skip to content

Commit

Permalink
Merge pull request #91 from kbase/develop
Browse files Browse the repository at this point in the history
D->M
  • Loading branch information
bio-boris authored Oct 30, 2020
2 parents ef7e319 + 6dac72b commit afdf3ea
Show file tree
Hide file tree
Showing 25 changed files with 2,179 additions and 597 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Run Staging Service Tests

on:
[push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements-actions.txt; fi
- name: Test with pytest
run: |
bash run_tests.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ ENV/
data/
.DS_Store
.virtualenvs/
test.env
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -725,3 +725,67 @@ Error Connecting to auth service ...
}
```




## Get Importer Mappings

This endpoint returns a list of available staging importer apps that have been marked as supported. This endpoint also
returns a mapping between a list of files and predicted importer app.

For example,
* if we pass in nothing we get a response with a list of apps, and no mappings
* if we pass in a list of files, such as ["file1.fasta", "file2.fq", "None"], we would get back a response
that maps to Fasta Importers and FastQ Importers, with a weight of 0 to 1
which represents the probability that this is the correct importer for you.
* for files for which there is no predicted app, the return is a null value
* output type is not currently used for anything
* this endpoint is used to power the dropdowns for the staging service window in the Narrative

**URL** : `ci.kbase.us/services/staging_service/importer_mappings`

**local URL** : `localhost:3000/importer_mappings`

**Method** : `POST`

**Headers** : Not Required

## Success Response

**Code** : `200 OK`

**Content example**

```
data = {"file_list": ["file1.txt", "file.zip"]}
async with AppClient(config, username) as cli:
resp = await cli.post(
"importer_mappings/", data=data
)
```
Response:
```
{
"apps": {
"decompress/unpack": {
"title": "Decompress/Unpack",
"app": "kb_uploadmethods/unpack_staging_file",
"output_type": [null],
"extensions": ["zip", "tar", "tgz", "tar.gz", "7z", "gz", "gzip", "rar"],
"id": 7
},
"mappings": [null, [{
"id": 7,
"title": "decompress/unpack",
"app_weight": 1
}]]
}
```
## Error Response
**Code** : `400 Bad Request`

**Content**
```
must provide file_list field
```

3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### Version 1.1.8
- Added new endpoint `importer-mappings/` for getting a mapping of importers for file names
- Ran black

### Version 1.1.7
- Add a file name check to void user uploading files with name starting with space
Expand Down
3 changes: 2 additions & 1 deletion deployment/conf/deployment.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
META_DIR = /kb/deployment/lib/src/data/metadata/
DATA_DIR = /kb/deployment/lib/src/data/bulk/
AUTH_URL = https://ci.kbase.us/services/auth/api/V2/token
CONCIERGE_PATH = /kbaseconcierge
CONCIERGE_PATH = /kbaseconcierge
FILE_EXTENSION_MAPPINGS = /kb/deployment/conf/supported_apps_w_extensions.json
Loading

0 comments on commit afdf3ea

Please sign in to comment.