-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from StochSS/dev
Release v0.9
- Loading branch information
Showing
50 changed files
with
2,480 additions
and
1,700 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 |
---|---|---|
|
@@ -3,4 +3,6 @@ | |
.venv | ||
.vscode | ||
dist | ||
**/*__pycache__ | ||
**/*__pycache__ | ||
.ipynb_checkpoints/ | ||
examples/ |
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,4 @@ | ||
export COMPOSE_PROJECT_NAME=stochss-compute | ||
export PYTHONDONTWRITEBYTECODE=true | ||
export FLASK_ENV=production | ||
export DOCKER_WEB_PORT=1234 | ||
export FLASK_PORT=1234 |
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
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,5 @@ | ||
- start kubecluster when api starts | ||
- handle replica sets and scheduler addressing and discovery | ||
- dynamic scaling??? | ||
- handle "plot not ready" error | ||
- error handling in general by trying to break it |
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,27 @@ | ||
FROM python:3.8.10-buster | ||
|
||
LABEL maintainer="Ethan Green <egreen4@unca.edu>" | ||
|
||
# set up virtual environment inside container | ||
ENV VIRTUAL_ENV=/opt/venv | ||
RUN python3 -m venv $VIRTUAL_ENV | ||
# activate the venv | ||
ENV PYTHONPATH="$VIRTUAL_ENV:$PYTHONPATH" | ||
ENV PATH="$VIRTUAL_ENV:$PATH" | ||
# make the venv a volume | ||
VOLUME [ "/opt/venv" ] | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY requirements.txt . | ||
RUN pip install -r requirements.txt | ||
|
||
COPY . /usr/src/app | ||
|
||
ARG FLASK_ENV="production" | ||
ENV FLASK_ENV="${FLASK_ENV}" \ | ||
PYTHONUNBUFFERED="true" | ||
|
||
EXPOSE 1234 | ||
|
||
CMD [ "python", "app.py" ] |
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,7 +1,7 @@ | ||
from stochss_compute.api import base | ||
from stochss_compute import api | ||
|
||
def server_start(): | ||
base.flask.run(host="0.0.0.0", port=1234) | ||
api.start_api(host="0.0.0.0", port=1234, debug=True) | ||
|
||
if __name__ == "__main__": | ||
server_start() | ||
server_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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import click | ||
|
||
from redis import Redis | ||
from distributed.diagnostics.plugin import SchedulerPlugin | ||
|
||
from stochss_compute.api.delegate import DaskDelegateConfig | ||
|
||
class DaskWorkerPlugin(SchedulerPlugin): | ||
name = "test_plugin" | ||
|
||
def __init__(self, redis_address, redis_port, redis_db): | ||
self.redis = Redis( | ||
host=redis_address, | ||
port=redis_port, | ||
db=redis_db | ||
) | ||
|
||
def transition(self, key, start, finish, *args, **kwargs): | ||
print(f"{key}: {finish}") | ||
if start == "memory" and finish == "forgotten": | ||
finish = "done" | ||
|
||
self.redis.set(f"state-{key}", finish) | ||
|
||
@click.command() | ||
def dask_setup(scheduler): | ||
config = DaskDelegateConfig() | ||
|
||
plugin = DaskWorkerPlugin(config.redis_address, config.redis_port, config.redis_db) | ||
scheduler.add_plugin(plugin) |
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,23 @@ | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app: stochss-compute | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- image: daskdev/dask:latest | ||
imagePullPolicy: IfNotPresent | ||
args: [dask-worker, --nthreads, '2', --no-dashboard, --memory-limit, 4GB, --death-timeout, '60'] | ||
name: dask | ||
env: | ||
- name: EXTRA_PIP_PACKAGES | ||
value: "git+https://github.com/dask/distributed gillespy2" | ||
- name: EXTRA_APT_PACKAGES | ||
value: "build-essential" | ||
resources: | ||
limits: | ||
cpu: "1" | ||
memory: 1G | ||
requests: | ||
cpu: "1" | ||
memory: "500Mi" |
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,8 @@ | ||
FROM daskdev/dask | ||
|
||
RUN dask-scheduler --host localhost | ||
|
||
RUN dask-worker localhost:8786 | ||
|
||
EXPOSE 8786 | ||
|
Oops, something went wrong.