-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 064ad3d
Showing
30 changed files
with
6,296 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test_local | ||
sdk.cfg |
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,2 @@ | ||
test_local | ||
sdk.cfg |
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,31 @@ | ||
language: python | ||
|
||
sudo: required | ||
|
||
services: | ||
- docker | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
env: | ||
|
||
before_install: | ||
- docker version | ||
|
||
install: | ||
- pushd .. | ||
- git clone https://github.com/kbase/jars | ||
- git clone https://github.com/kbase/kb_sdk | ||
- cd kb_sdk | ||
- make bin | ||
- make sdkbase | ||
- export PATH=$(pwd)/bin:$PATH | ||
- source src/sh/sdk-completion.sh | ||
- popd | ||
|
||
script: | ||
- kb-sdk validate | ||
|
||
after_script: |
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,24 @@ | ||
FROM kbase/sdkbase2:python | ||
MAINTAINER KBase Developer | ||
# ----------------------------------------- | ||
# In this section, you can install any system dependencies required | ||
# to run your App. For instance, you could place an apt-get update or | ||
# install line here, a git checkout to download code, or run any other | ||
# installation scripts. | ||
|
||
# RUN apt-get update | ||
|
||
|
||
# ----------------------------------------- | ||
|
||
COPY ./ /kb/module | ||
RUN mkdir -p /kb/module/work | ||
RUN chmod -R a+rw /kb/module | ||
|
||
WORKDIR /kb/module | ||
|
||
RUN make all | ||
|
||
ENTRYPOINT [ "./scripts/entrypoint.sh" ] | ||
|
||
CMD [ ] |
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,7 @@ | ||
Copyright (c) 2015 The KBase Project and its Contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,65 @@ | ||
SERVICE = kb_cobrapy | ||
SERVICE_CAPS = kb_cobrapy | ||
SPEC_FILE = kb_cobrapy.spec | ||
URL = https://kbase.us/services/kb_cobrapy | ||
DIR = $(shell pwd) | ||
LIB_DIR = lib | ||
SCRIPTS_DIR = scripts | ||
TEST_DIR = test | ||
LBIN_DIR = bin | ||
WORK_DIR = /kb/module/work/tmp | ||
EXECUTABLE_SCRIPT_NAME = run_$(SERVICE_CAPS)_async_job.sh | ||
STARTUP_SCRIPT_NAME = start_server.sh | ||
TEST_SCRIPT_NAME = run_tests.sh | ||
|
||
.PHONY: test | ||
|
||
default: compile | ||
|
||
all: compile build build-startup-script build-executable-script build-test-script | ||
|
||
compile: | ||
kb-sdk compile $(SPEC_FILE) \ | ||
--out $(LIB_DIR) \ | ||
--pysrvname $(SERVICE_CAPS).$(SERVICE_CAPS)Server \ | ||
--pyimplname $(SERVICE_CAPS).$(SERVICE_CAPS)Impl; | ||
|
||
build: | ||
chmod +x $(SCRIPTS_DIR)/entrypoint.sh | ||
|
||
build-executable-script: | ||
mkdir -p $(LBIN_DIR) | ||
echo '#!/bin/bash' > $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME) | ||
echo 'script_dir=$$(dirname "$$(readlink -f "$$0")")' >> $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME) | ||
echo 'export PYTHONPATH=$$script_dir/../$(LIB_DIR):$$PATH:$$PYTHONPATH' >> $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME) | ||
echo 'python -u $$script_dir/../$(LIB_DIR)/$(SERVICE_CAPS)/$(SERVICE_CAPS)Server.py $$1 $$2 $$3' >> $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME) | ||
chmod +x $(LBIN_DIR)/$(EXECUTABLE_SCRIPT_NAME) | ||
|
||
build-startup-script: | ||
mkdir -p $(LBIN_DIR) | ||
echo '#!/bin/bash' > $(SCRIPTS_DIR)/$(STARTUP_SCRIPT_NAME) | ||
echo 'script_dir=$$(dirname "$$(readlink -f "$$0")")' >> $(SCRIPTS_DIR)/$(STARTUP_SCRIPT_NAME) | ||
echo 'export KB_DEPLOYMENT_CONFIG=$$script_dir/../deploy.cfg' >> $(SCRIPTS_DIR)/$(STARTUP_SCRIPT_NAME) | ||
echo 'export PYTHONPATH=$$script_dir/../$(LIB_DIR):$$PATH:$$PYTHONPATH' >> $(SCRIPTS_DIR)/$(STARTUP_SCRIPT_NAME) | ||
echo 'uwsgi --master --processes 5 --threads 5 --http :5000 --wsgi-file $$script_dir/../$(LIB_DIR)/$(SERVICE_CAPS)/$(SERVICE_CAPS)Server.py' >> $(SCRIPTS_DIR)/$(STARTUP_SCRIPT_NAME) | ||
chmod +x $(SCRIPTS_DIR)/$(STARTUP_SCRIPT_NAME) | ||
|
||
build-test-script: | ||
echo '#!/bin/bash' > $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
echo 'script_dir=$$(dirname "$$(readlink -f "$$0")")' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
echo 'export KB_DEPLOYMENT_CONFIG=$$script_dir/../deploy.cfg' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
echo 'export KB_AUTH_TOKEN=`cat /kb/module/work/token`' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
echo 'echo "Removing temp files..."' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
echo 'rm -rf $(WORK_DIR)/*' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
echo 'echo "...done removing temp files."' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
echo 'export PYTHONPATH=$$script_dir/../$(LIB_DIR):$$PATH:$$PYTHONPATH' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
echo 'cd $$script_dir/../$(TEST_DIR)' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
echo 'python -m nose --with-coverage --cover-package=$(SERVICE_CAPS) --cover-html --cover-html-dir=/kb/module/work/test_coverage --nocapture --nologcapture .' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
chmod +x $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
|
||
test: | ||
if [ ! -f /kb/module/work/token ]; then echo -e '\nOutside a docker container please run "kb-sdk test" rather than "make test"\n' && exit 1; fi | ||
bash $(TEST_DIR)/$(TEST_SCRIPT_NAME) | ||
|
||
clean: | ||
rm -rfv $(LBIN_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 @@ | ||
# kb_cobrapy | ||
|
||
This is a [KBase](https://kbase.us) module generated by the [KBase Software Development Kit (SDK)](https://github.com/kbase/kb_sdk). | ||
|
||
You will need to have the SDK installed to use this module. [Learn more about the SDK and how to use it](https://kbase.github.io/kb_sdk_docs/). | ||
|
||
You can also learn more about the apps implemented in this module from its [catalog page](https://narrative.kbase.us/#catalog/modules/kb_cobrapy) or its [spec file]($module_name.spec). | ||
|
||
# Setup and test | ||
|
||
Add your KBase developer token to `test_local/test.cfg` and run the following: | ||
|
||
```bash | ||
$ make | ||
$ kb-sdk test | ||
``` | ||
|
||
After making any additional changes to this repo, run `kb-sdk test` again to verify that everything still works. | ||
|
||
# Installation from another module | ||
|
||
To use this code in another SDK module, call `kb-sdk install kb_cobrapy` in the other module's root directory. | ||
|
||
# Help | ||
|
||
You may find the answers to your questions in our [FAQ](https://kbase.github.io/kb_sdk_docs/references/questions_and_answers.html) or [Troubleshooting Guide](https://kbase.github.io/kb_sdk_docs/references/troubleshooting.html). |
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,6 @@ | ||
# kb_cobrapy release notes | ||
========================================= | ||
|
||
0.0.0 | ||
----- | ||
* Module created by kb-sdk init |
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 @@ | ||
This directory contains any reference data required for this module to run that is not already present in KBase. | ||
|
||
For any reference data that is too large to host on Github (greater than 100MB), follow the [Reference Data Guide](https://kbase.github.io/kb_sdk_docs/howtos/work_with_reference_data.html) for an alternative. |
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,9 @@ | ||
[ { | ||
"module_name" : "KBaseReport", | ||
"type" : "sdk", | ||
"version_tag" : "release" | ||
}, { | ||
"module_name" : "Workspace", | ||
"type" : "core", | ||
"file_path" : "https://raw.githubusercontent.com/kbase/workspace_deluxe/master/workspace.spec" | ||
} ] |
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,11 @@ | ||
[kb_cobrapy] | ||
kbase-endpoint = {{ kbase_endpoint }} | ||
job-service-url = {{ job_service_url }} | ||
workspace-url = {{ workspace_url }} | ||
shock-url = {{ shock_url }} | ||
handle-service-url = {{ handle_url }} | ||
srv-wiz-url = {{ srv_wiz_url }} | ||
njsw-url = {{ njsw_url }} | ||
auth-service-url = {{ auth_service_url }} | ||
auth-service-url-allow-insecure = {{ auth_service_url_allow_insecure }} | ||
scratch = /kb/module/work/tmp |
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 @@ | ||
/* | ||
A KBase module: kb_cobrapy | ||
*/ | ||
|
||
module kb_cobrapy { | ||
typedef structure { | ||
string report_name; | ||
string report_ref; | ||
} ReportResults; | ||
|
||
/* | ||
This example function accepts any number of parameters and returns results in a KBaseReport | ||
*/ | ||
funcdef run_kb_cobrapy(mapping<string,UnspecifiedObject> params) returns (ReportResults output) authentication required; | ||
|
||
}; |
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,15 @@ | ||
module-name: | ||
kb_cobrapy | ||
|
||
module-description: | ||
A KBase module | ||
|
||
service-language: | ||
python | ||
|
||
module-version: | ||
0.0.1 | ||
|
||
owners: | ||
[jjeffryes] | ||
|
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 @@ | ||
This directory contains the module's source code and any installed clients for other SDK modules. | ||
|
||
To re-generate any templated source code in this directory, run `make` in the root of this module. |
Oops, something went wrong.