forked from zonca/jupyterhub-deploy-kubernetes-jetstream
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:zonca/jupyterhub-deploy-kubernete…
…s-jetstream
- Loading branch information
Showing
6 changed files
with
60 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,15 @@ | ||
FROM continuumio/miniconda3 | ||
|
||
# Update | ||
RUN conda install --yes -c conda-forge flask zarr s3fs xarray ipython && conda clean --yes --all | ||
RUN pip install python-openstackclient | ||
|
||
# Bundle app source | ||
COPY gateway.py /src/gateway.py | ||
|
||
# Object store credentials | ||
RUN mkdir -p ~/.aws | ||
COPY my_aws_config /root/.aws/config | ||
|
||
EXPOSE 8000 | ||
CMD ["python", "/src/gateway.py", "-p 8000"] |
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,4 @@ | ||
[default] | ||
region=RegionOne | ||
aws_access_key_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ||
aws_secret_access_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
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,29 @@ | ||
from flask import Flask | ||
import sys | ||
import s3fs | ||
import xarray as xr | ||
import numpy as np | ||
import subprocess | ||
import os | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route("/") | ||
def hello(): | ||
|
||
return "Gateway up and running!\n" | ||
|
||
@app.route("/submit_job/<job_id>") | ||
def submit_job(job_id): | ||
#fs = s3fs.S3FileSystem(use_ssl=True, client_kwargs=dict(endpoint_url="https://tacc.jetstream-cloud.org:8080", region_name="RegionOne")) | ||
#d = s3fs.S3Map("gateway_results/{}".format(job_id), s3=fs, create=False) | ||
ds = xr.Dataset({'foo': np.zeros(10), 'bar': ('x', [1, 2]), 'baz': np.pi}) | ||
out = "{}.nc".format(job_id) | ||
ds.to_netcdf(out, mode='w') | ||
subprocess.run("openstack object create dummy_gateway {}".format(out).split()) | ||
os.remove(out) | ||
|
||
return "Submitted job {}\n".format(job_id) | ||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0', port=8000, 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 @@ | ||
docker run -d --env-file openrc.sh --name gateway -p 80:8000 gateway |
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 @@ | ||
while read f; do | ||
echo $f | ||
cd $f | ||
sudo runuser -l $f -c 'bash ../clean_one.sh' | ||
cd .. | ||
done < use.txt |
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 @@ | ||
source openrc.sh | ||
cd jetstream_kubespray/inventory/$(whoami) | ||
echo $(pwd) | ||
export CLUSTER=$(whoami) | ||
nohup bash terraform_destroy.sh & |