Skip to content

Commit

Permalink
Merge pull request #1247 from StochSS/develop
Browse files Browse the repository at this point in the history
Release v2.4
  • Loading branch information
briandrawert authored Sep 8, 2021
2 parents 33d86b1 + 2558112 commit b6316a4
Show file tree
Hide file tree
Showing 93 changed files with 6,136 additions and 5,742 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on: [push, pull_request]

jobs:
run_tests:
runs-on: ubuntu-16.04
runs-on: ubuntu-20.04
name: StochSS Continuous Testing
steps:
# Checkout
Expand Down
31 changes: 22 additions & 9 deletions .github/workflows/pylint_on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PyLint On Pull Request
on: [pull_request]
jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Set Up Python
uses: actions/setup-python@v2
Expand All @@ -26,37 +26,50 @@ jobs:
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
if: always()
- name: Set Base Lint to 0
run: echo BASE_LINT=0 >> $GITHUB_ENV
if: env.BASE_LINT == ''
- name: Checkout Head
run: git checkout $HEAD_REF
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
- name: Get Lint Delta Sign (+/-)
run: |
echo PASSING_SCORE=$(git diff --name-only --diff-filter=M $BASE_REF | grep -E "\.py" | xargs pylint | grep -Eo "10, [+-]" | grep -Eo [+-] ) >> $GITHUB_ENV
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
if: always()
- name: Get Head Lint Score
run: |
echo HEAD_LINT=$(git diff --name-only --diff-filter=M $BASE_REF | grep -E "\.py" | xargs pylint | grep -E -o "at [0-9.-]+" | grep -E -o [0-9.-]+) >> $GITHUB_ENV
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
if: always()
- name: Set Head Lint to 0
run: echo HEAD_LINT=0 >> $GITHUB_ENV
if: env.HEAD_LINT == ''
- name: Get Added Files Lint Score
run: |
echo ADDED_LINT=$(git diff --name-only --diff-filter=A $BASE_REF | grep -E "\.py" | xargs pylint | grep -E -o "at [0-9.-]+" | grep -E -o [0-9.-]+) >> $GITHUB_ENV
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
if: always()
- name: Get Delta
run: |
import os
base = float(os.environ['BASE_LINT'])
head = float(os.environ['HEAD_LINT'])
delta = head - base
os.popen(f"echo DELTA={round(delta, 2)} >> $GITHUB_ENV")
shell: python
- name: Display Results
run: |
echo "Lint of modified files in base:"
echo ${{ env.BASE_LINT }}
echo "Lint of modified files in head:"
echo ${{ env.HEAD_LINT }}
echo "Delta (+/-):"
echo ${{ env.DELTA }}
echo "Lint of files added by head:"
echo ${{ env.ADDED_LINT }}
if: always()
- name: Fail If Negative Delta
run: exit 1
if: env.PASSING_SCORE == '-'
run: |
import os
if float(os.environ['HEAD_LINT']) < 9 and float(os.environ['DELTA']) < 0:
raise Exception("Head lint score < 9 and negative delta.")
shell: python
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ stochss/dist/stochss-project-manager.html
stochss/dist/multiple-plots-page.html
stochss/dist/stochss-domain-editor.html
stochss/dist/stochss-loading-page.html
stochss/dist/stochss-project-browser.html
stochss/dist/stochss-quick-start.html
stochss/dist/stochss-user-home.html
jupyterhub/templates/page.html
jupyterhub/templates/stochss-home.html
jupyterhub/templates/stochss-job-presentation.html
jupyterhub/templates/stochss-model-presentation.html
jupyterhub/templates/stochss-notebook-presentation.html
jupyterhub/templates/multiple-plots-page.html

*.swp
*.swo
package-lock.json
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ COPY --chown=jovyan:users public_models/ /home/jovyan/Examples

COPY --chown=jovyan:users . /stochss

COPY --chown=jovyan:users /stochss/dist/favicon.ico $JUPYTER_CONFIG_DIR/custom/favicon.ico

COPY --chown=jovyan:users custom.js $JUPYTER_CONFIG_DIR/custom/custom.js

COPY --chown=jovyan:users stochss-logo.png $JUPYTER_CONFIG_DIR/custom/logo.png

COPY --chown=jovyan:users custom.css $JUPYTER_CONFIG_DIR/custom/custom.css
Expand Down
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,19 @@ jupyterhub/secrets/postgres.env:
jupyterhub/userlist:
@echo "You're missing a userlist file. We'll make a blank one for you."
@echo "If you'd like to set admins to jupyterhub, add entries to the userlist file"
@echo "in the jupyterhub/ directory like this (one user per line):"
@echo "[email protected] admin"
@echo " in the jupyterhub/ directory like this (one user per line):"
@echo " [email protected] admin"
@echo "If you'd like to set power users who are exempt from resource constraints"
@echo " use entries like this:"
@echo " [email protected] power"
@echo ""
@touch $@

check-files: jupyterhub/userlist jupyterhub/secrets/.oauth.dummy.env jupyterhub/secrets/postgres.env

check_files_staging: check-files jupyterhub/secrets/.oauth.staging.env

check_files_prod: check-files jupyterhub/secrets/.oauth.prod.env
check_files_prod: check-files jupyterhub/secrets/.oauth.prod.env jupyterhub/.power_users

cert:
@echo "Generating certificate..."
Expand Down Expand Up @@ -126,37 +130,37 @@ hub: build_hub build run_hub_dev
build_clean:
docker build \
--build-arg JUPYTER_CONFIG_DIR=$(JUPYTER_CONFIG_DIR) \
--no-cache -t $(DOCKER_STOCHSS_IMAGE):latest .
--no-cache -t $(DOCKER_STOCHSS_IMAGE):latest .

create_working_dir:
$(DOCKER_SETUP_COMMAND)

build:
build:
docker build \
--build-arg JUPYTER_CONFIG_DIR=$(JUPYTER_CONFIG_DIR) \
-t $(DOCKER_STOCHSS_IMAGE):latest .
-t $(DOCKER_STOCHSS_IMAGE):latest .

test: create_working_dir
test: create_working_dir
docker run --rm \
--name $(DOCKER_STOCHSS_IMAGE) \
--env-file .env \
-v $(DOCKER_ROOT_DIR):/stochss \
-v $(DOCKER_WORKING_DIR):/home/jovyan/ \
-p 8888:8888 \
$(DOCKER_STOCHSS_IMAGE):latest \
/stochss/stochss/tests/run_tests.py
/stochss/stochss/tests/run_tests.py

build_and_test: build test

run: create_working_dir
run: create_working_dir
$(PYTHON_EXE) launch_webbrowser.py &
docker run --rm \
--name $(DOCKER_STOCHSS_IMAGE) \
--env-file .env \
-v $(DOCKER_WORKING_DIR):/home/jovyan/ \
-p 8888:8888 \
$(DOCKER_STOCHSS_IMAGE):latest \
bash -c "cd /home/jovyan; start-notebook.sh "
bash -c "cd /home/jovyan; start-notebook.sh "


build_and_run: build run
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ StochSS uses [JupyterHub](https://jupyterhub.readthedocs.io/en/stable/#) as the

- [Optional] To set admins for JupyterHub, make a file called `userlist` in the `jupyterhub/` directory. On each line of this file place a username followed by the word 'admin'. For example: `myuser admin`. If using Google OAuth, the uesername will be a Gmail address. Navigate to `/hub/admin` to use the JupyterHub admin interface.

- [Optional] By default multi-user StochSS is set up to allocate 2 logical cpus per user, reserving 2 logical cpus for the hub container and underlying OS. You can define a list of "power users" that are excluded from resource limitations by adding a text file called `.power_users` (note the leading period) to the `jupyterhub/` directory with one username/email address on each line of the file.
- [Optional] By default multi-user StochSS is set up to allocate 2 logical cpus per user, reserving 2 logical cpus for the hub container and underlying OS. You can define "power users" that are excluded from resource limitations using the same method as above for adding an admin, but instead of following the username with 'admin', use the keyword 'power' instead.

### Run Locally

Expand Down
2 changes: 1 addition & 1 deletion __version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# @website https://github.com/stochss/stochss
# =============================================================================

__version__ = '2.3.12'
__version__ = '2.4'
__title__ = 'StochSS'
__description__ = 'StochSS is an integrated development environment (IDE) \
for simulation of biochemical networks.'
Expand Down
36 changes: 24 additions & 12 deletions client/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,21 @@ let getBrowser = () => {
return {"name":BrowserDetect.browser,"version":BrowserDetect.version};
}

let validateName = (input, rename = false) => {
var error = ""
let validateName = (input, {rename=false, saveAs=true}={}) => {
var error = "";
if(input.endsWith('/')) {
error = 'forward'
error = 'forward';
}
var invalidChars = "`~!@#$%^&*=+[{]}\"|:;'<,>?\\"
if(rename) {
invalidChars += "/"
var invalidChars = "`~!@#$%^&*=+[{]}\"|:;'<,>?\\";
if(rename || !saveAs) {
invalidChars += "/";
}
for(var i = 0; i < input.length; i++) {
if(invalidChars.includes(input.charAt(i))) {
error = error === "" || error === "special" ? "special" : "both"
error = error === "" || error === "special" ? "special" : "both";
}
}
return error
return error;
}

let newWorkflow = (parent, mdlPath, isSpatial, type) => {
Expand All @@ -157,7 +157,7 @@ let newWorkflow = (parent, mdlPath, isSpatial, type) => {
let ext = isSpatial ? /.smdl/g : /.mdl/g
let typeCode = type === "Ensemble Simulation" ? "_ES" : "_PS";
let name = mdlPath.split('/').pop().replace(ext, typeCode)
let modal = $(modals.newWorkflowHtml(name, type)).modal();
let modal = $(modals.createWorkflowHtml(name, type)).modal();
let okBtn = document.querySelector('#newWorkflowModal .ok-model-btn');
let input = document.querySelector('#newWorkflowModal #workflowNameInput');
okBtn.disabled = false;
Expand Down Expand Up @@ -213,12 +213,22 @@ documentSetup = () => {
}

copyToClipboard = (text, success, error) => {
fullURL = window.location.protocol + '//' + window.location.hostname + text;
if (window.clipboardData && window.clipboardData.setData) {
// Internet Explorer-specific code path to prevent textarea being shown while dialog is visible.
return window.clipboardData.setData("Text", text);
return window.clipboardData.setData("Text", fullURL);
}
else {
navigator.clipboard.writeText(text).then(success, error)
navigator.clipboard.writeText(fullURL).then(success, error)
}
}

let switchToEditTab = (view, section) => {
let elementID = Boolean(view.model && view.model.elementID) ? view.model.elementID + "-" : "";
if($(view.queryByHook(elementID + 'view-' + section)).hasClass('active')) {
$(view.queryByHook(elementID + section + '-edit-tab')).tab('show');
$(view.queryByHook(elementID + 'edit-' + section)).addClass('active');
$(view.queryByHook(elementID + 'view-' + section)).removeClass('active');
}
}

Expand All @@ -234,7 +244,9 @@ module.exports = {
postXHR: postXHR,
tooltipSetup: tooltipSetup,
documentSetup: documentSetup,
copyToClipboard: copyToClipboard
copyToClipboard: copyToClipboard,
switchToEditTab: switchToEditTab,
validateName: validateName
};


Loading

0 comments on commit b6316a4

Please sign in to comment.