Skip to content

Commit

Permalink
Adds inactivity detection (#27)
Browse files Browse the repository at this point in the history
adds inactivity detection
bumps major version
  • Loading branch information
GitHK authored Apr 8, 2024
1 parent 3efcfbe commit e4c83b6
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.0.10
current_version = 3.0.0
commit = False
message = service version: {current_version} → {new_version}
tag = False
Expand Down
Binary file added .coverage
Binary file not shown.
8 changes: 4 additions & 4 deletions .github/workflows/check-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
- name: Checkout repo content
uses: actions/checkout@v2
- name: ooil version
uses: docker://itisfoundation/ci-service-integration-library:v1.0.3-dev-4
uses: docker://itisfoundation/ci-service-integration-library:v1.0.4
with:
args: ooil --version
- name: Assemble docker-compose spec
uses: docker://itisfoundation/ci-service-integration-library:v1.0.3-dev-4
- name: Assemble docker compose spec
uses: docker://itisfoundation/ci-service-integration-library:v1.0.4
with:
args: ooil compose
- name: Build all images if multiple
uses: docker://itisfoundation/ci-service-integration-library:v1.0.3-dev-4
uses: docker://itisfoundation/ci-service-integration-library:v1.0.4
with:
args: docker compose build
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ docker-compose.yml
# ignore all files in validation
validation/

*.ignore.*
*.ignore.*
2 changes: 1 addition & 1 deletion .osparc/jupyter-math/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description:
"
key: simcore/services/dynamic/jupyter-math
version: 2.0.10
version: 3.0.0
integration-version: 2.0.0
type: dynamic
authors:
Expand Down
5 changes: 5 additions & 0 deletions .osparc/jupyter-math/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ paths-mapping:
outputs_path: /home/jovyan/work/outputs
state_paths:
- /home/jovyan/work/workspace
callbacks-mapping:
inactivity:
service: container
command: ["python", "/usr/local/bin/service-monitor/activity.py"]
timeout: 1
25 changes: 23 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ RUN jupyter serverextension enable voila && \
# Import matplotlib the first time to build the font cache.
ENV XDG_CACHE_HOME /home/$NB_USER/.cache/
RUN MPLBACKEND=Agg .venv/bin/python -c "import matplotlib.pyplot" && \
fix-permissions /home/$NB_USER
# run fix permissions only once. This can be probably optimized, so it is faster to build
fix-permissions /home/$NB_USER
# run fix permissions only once. This can be probably optimized, so it is faster to build

# copy README and CHANGELOG
COPY --chown=$NB_UID:$NB_GID CHANGELOG.md ${NOTEBOOK_BASE_DIR}/CHANGELOG.md
Expand All @@ -92,6 +92,27 @@ ENV JP_LSP_VIRTUAL_DIR="/home/${NB_USER}/.virtual_documents"
# Copying boot scripts
COPY --chown=$NB_UID:$NB_GID docker /docker

# install service activity monitor
ARG ACTIVITY_MONITOR_VERSION=v0.0.3

# Detection thresholds for application
ENV ACTIVITY_MONITOR_BUSY_THRESHOLD_CPU_PERCENT=0.5
ENV ACTIVITY_MONITOR_BUSY_THRESHOLD_DISK_READ_BPS=0
ENV ACTIVITY_MONITOR_BUSY_THRESHOLD_DISK_WRITE_BPS=0
ENV ACTIVITY_MONITOR_BUSY_THRESHOLD_NETWORK_RECEIVE_BPS=1024
ENV ACTIVITY_MONITOR_BUSY_THRESHOLD_NETWORK_SENT_BPS=1024

# install service activity monitor
RUN apt-get update && \
apt-get install -y curl && \
# install using curl
curl -sSL https://raw.githubusercontent.com/ITISFoundation/service-activity-monitor/main/scripts/install.sh | \
bash -s -- ${ACTIVITY_MONITOR_VERSION} && \
# cleanup and remove curl
apt-get purge -y --auto-remove curl && \
rm -rf /var/lib/apt/lists/*


RUN echo 'export PATH="/home/${NB_USER}/.venv/bin:$PATH"' >> "/home/${NB_USER}/.bashrc"

EXPOSE 8888
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SHELL = /bin/sh
.DEFAULT_GOAL := help

export DOCKER_IMAGE_NAME ?= jupyter-math
export DOCKER_IMAGE_TAG ?= 2.0.10
export DOCKER_IMAGE_TAG ?= 3.0.0


# PYTHON ENVIRON ---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -35,7 +35,7 @@ define _bumpversion
# upgrades as $(subst $(1),,$@) version, commits and tags
@docker run -it --rm -v $(PWD):/${DOCKER_IMAGE_NAME} \
-u $(shell id -u):$(shell id -g) \
itisfoundation/ci-service-integration-library:v1.0.3-dev-4 \
itisfoundation/ci-service-integration-library:v1.0.4 \
sh -c "cd /${DOCKER_IMAGE_NAME} && bump2version --verbose --list --config-file $(1) $(subst $(2),,$@)"
endef

Expand All @@ -49,7 +49,7 @@ version-patch version-minor version-major: .bumpversion.cfg ## increases service
compose-spec: ## runs ooil to assemble the docker-compose.yml file
@docker run -it --rm -v $(PWD):/${DOCKER_IMAGE_NAME} \
-u $(shell id -u):$(shell id -g) \
itisfoundation/ci-service-integration-library:v1.0.3-dev-4 \
itisfoundation/ci-service-integration-library:v1.0.4 \
sh -c "cd /${DOCKER_IMAGE_NAME} && ooil compose"

build: | compose-spec ## build docker image
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
jupyter-math:
image: simcore/services/dynamic/jupyter-math:2.0.10
image: simcore/services/dynamic/jupyter-math:3.0.0
ports:
- "8888:8888"
environment:
Expand Down
1 change: 1 addition & 0 deletions docker/entrypoint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ chmod gu-w "/home/${NB_USER}/work"

echo
echo "$INFO" "Starting notebook ..."
exec gosu "$NB_USER" python /usr/local/bin/service-monitor/activity_monitor.py &
exec gosu "$NB_USER" /docker/boot_notebook.bash
2 changes: 1 addition & 1 deletion kernels/python-maths/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=kernels/python-maths/requirements.txt --resolver=backtracking kernels/python-maths/requirements.in
# pip-compile --output-file=kernels/python-maths/requirements.txt kernels/python-maths/requirements.in
#
aiofiles==22.1.0
# via ypy-websocket
Expand Down

0 comments on commit e4c83b6

Please sign in to comment.