-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
59 changed files
with
1,883 additions
and
155 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,3 @@ | ||
[run] | ||
omit = test/* | ||
source = feeds |
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
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/kb_python | ||
|
||
ARG BUILD_DATE | ||
ARG VCS_REF | ||
ARG BRANCH=develop | ||
|
||
COPY ./ /kb/module | ||
|
||
RUN pip install --upgrade pip setuptools wheel | ||
RUN while read requirement; do conda install --yes $requirement || pip install $requirement; done < /kb/module/requirements.txt | ||
|
||
LABEL org.label-schema.build-date=$BUILD_DATE \ | ||
org.label-schema.vcs-url="https://github.com/kbase/feeds.git" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.schema-version="1.0.0-rc1" \ | ||
us.kbase.vcs-branch=$BRANCH \ | ||
maintainer="Steve Chan sychan@lbl.gov" | ||
|
||
ENV KB_DEPLOYMENT_CONFIG=/kb/module/deploy.cfg | ||
|
||
ENTRYPOINT [ "/kb/deployment/bin/dockerize" ] | ||
CMD [ "--template", \ | ||
"/kb/module/deployment/conf/.templates/deploy.cfg.templ:/kb/module/deploy.cfg" \ | ||
"make start" ] |
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
install: | ||
pip install -r requirements.txt | ||
|
||
build-docs: | ||
docs: | ||
-rm -r docs | ||
-rm -r docsource/internal_apis | ||
mkdir -p docs | ||
sphinx-apidoc --separate -o docsource/internal_apis src | ||
sphinx-apidoc --separate -o docsource/internal_apis feeds | ||
|
||
test: | ||
# flake8 feeds | ||
pytest --verbose test --cov feeds | ||
flake8 feeds | ||
pytest --verbose test --cov --cov-report html feeds -s | ||
|
||
start: | ||
gunicorn --worker-class gevent --timeout 300 --workers 10 --bind :5000 feeds.server:app | ||
gunicorn --worker-class gevent --timeout 300 --workers 17 --bind :5000 feeds.server:app | ||
|
||
.PHONY: test | ||
.PHONY: test docs |
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,53 @@ | ||
### Notification | ||
* handle plain string or structured note context | ||
* service-dependent | ||
* subclass, or otherwise mark context for each service | ||
* avoid subclassing, so we don't need to modify feeds whenever a new service is added | ||
|
||
### NotificationFeed | ||
* combine with global feed for maintenance, etc. | ||
|
||
### NotificatonManager | ||
* handle fanouts in a more consistent way | ||
|
||
### TimelineStorage | ||
* abstract caching | ||
* filters on | ||
* seen | ||
* service | ||
* level | ||
* add remove notification | ||
|
||
### ActivityStorage | ||
* caching to avoid lookups | ||
* expire activities after configured time | ||
|
||
### Storage | ||
* prototype with MongoDB adapter | ||
|
||
### Build & Deployment | ||
* build Dockerfile | ||
* build DockerCompose file | ||
* Dockerize | ||
* Sphinx docs | ||
* make service token and encrypt | ||
|
||
### Server | ||
* add params to GET notifications endpoint | ||
|
||
### Test Interface | ||
* make one. | ||
* maybe jump straight into KBase-UI module. | ||
|
||
### Actor | ||
* validate actor properly | ||
* include groups as an actor | ||
|
||
### Object | ||
* validate object of notification where appropriate | ||
* context dependent | ||
|
||
### Docs | ||
* Do so, in general | ||
* annotate deploy.cfg.example | ||
|
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
[feeds] | ||
# DB info | ||
# db-engine - allowed values = redis, mongodb. Others will raise an error on startup. | ||
db-engine = {{ default .Env.db_engine "mongodb" }} | ||
|
||
# db-name - name of the database to use. default = "feeds". | ||
db-name = {{ default .Env.db_name "feeds" }} | ||
|
||
# Other db info. The usual - host, port, user, and password. You know the drill. | ||
db-host = {{ default .Env.db_host "ci-mongo" }} | ||
db-port = {{ default .Env.db_port "27017" }} | ||
db-user = {{ default .Env.db_user "feedsserv" }} | ||
db-pw = {{ default .Env.db_pw "fake_password" }} | ||
|
||
# admins are allowed to use their auth tokens to create global notifications. | ||
# examples would be notices about KBase downtime or events. | ||
admins = wjriehl,scanon,kkeller,drakemm | ||
|
||
# fake user name for the global feed. Should be something that's not a valid | ||
# user name. | ||
global-feed = {{ default .Env.global_feed "_global_" }} | ||
# Default lifetime for each notification in days. Notes older than this won't be | ||
# returned without explicitly looking them up by either their id or external key | ||
# (when given). | ||
lifespan = {{ default .Env.lifespan "30" }} | ||
|
||
# In debug mode, auth is mostly ignored. | ||
# Useful for testing, etc. | ||
# SET TO FALSE IN PRODUCTION! | ||
debug = False | ||
|
||
auth-url = {{ default .Env.auth_url "https://ci.kbase.us/services/auth" }} | ||
workspace-url = {{ default .Env.workspace_url "https://ci.kbase.us/services/ws" }} | ||
groups-url = {{ default .Env.groups_url "https://ci.kbase.us/services/groups" }} |
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,36 @@ | ||
[feeds] | ||
# DB info | ||
# db-engine - allowed values = redis, mongodb. Others will raise an error on startup. | ||
db-engine=mongodb | ||
|
||
# db-name - name of the database to use. default = "feeds". | ||
db-name=feeds | ||
|
||
# Other db info. The usual - host, port, user, and password. You know the drill. | ||
db-host=localhost | ||
db-port=6379 | ||
db-user= | ||
db-pw= | ||
|
||
# Service urls | ||
auth-url=https://ci.kbase.us/services/auth | ||
workspace-url=https://ci.kbase.us/services/ws | ||
groups-url=https://ci.kbase.us/services/groups | ||
|
||
# admins are allowed to use their auth tokens to create global notifications. | ||
# examples would be notices about KBase downtime or events. | ||
admins=wjriehl,scanon,kkeller,mmdrake | ||
|
||
# fake user name for the global feed. Should be something that's not a valid | ||
# user name. | ||
global-feed=_global_ | ||
|
||
# Default lifetime for each notification in days. Notes older than this won't be | ||
# returned without explicitly looking them up by either their id or external key | ||
# (when given). | ||
lifespan=30 | ||
|
||
# In debug mode, auth is effectively ignored. | ||
# Useful for testing, etc. | ||
# SET TO FALSE IN PRODUCTION! | ||
debug=False |
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,28 @@ | ||
services: | ||
feeds: | ||
ports: | ||
- "5000":"5000" | ||
environment: | ||
- db-engine=mongodb | ||
- db-name=feeds | ||
- db-host=localhost | ||
- db-port=27017 | ||
- auth-url=https://ci.kbase.us/services/auth | ||
- workspace-url=https://ci.kbase.us/services/ws | ||
- groups-url=https://ci.kbase.us/services/groups | ||
- AUTH_TOKEN=fake_token | ||
command: | ||
- "-wait" | ||
- "tcp://ci-mongo:27017" | ||
- "-timeout" | ||
- "-template" | ||
- "/kb/module/deployment/conf/.templates/deploy.cfg.templ:/kb/module/deploy.cfg" | ||
- "make start" | ||
depends_on: ["ci-mongo"] | ||
|
||
ci-mongo: | ||
image: mongo:2 | ||
command: | ||
- "--smallfiles" | ||
ports: | ||
- "27017:27017" |
Empty file.
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
coverage==4.5.1 | ||
pytest-cov==2.6.0 | ||
flake8==3.5.0 | ||
pytest==3.8.2 | ||
pytest==3.8.2 | ||
coveralls==1.5.1 | ||
requests-mock==1.5.2 |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
from abc import abstractmethod | ||
|
||
|
||
class BaseActivity(object): | ||
""" | ||
Common parent class for Activity and Notification. | ||
Activity will be done later. But a Notification is an Activity. | ||
""" | ||
pass | ||
@abstractmethod | ||
def to_dict(self): | ||
pass |
Oops, something went wrong.