diff --git a/Dockerfile b/Dockerfile index 2729076..05434b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ FROM python:3.9-slim # Set the working directory in the container WORKDIR /app -# Copy the current directory contents into the container at /app -COPY . /app +# Copy base project files into the container at /app +COPY LICENSE NOTICE README.md package_info.json requirements.txt /app/ # groupadd --system - create a system account # useradd --system - create a system account @@ -41,5 +41,9 @@ ENV PIP_CONFIG_FILE="${HOME}/.pip/pip.conf" RUN mkdir -p "${PYTHON_SHARED_LIB_PATH}" RUN echo 'umask 0007' >> "${HOME}/.bashrc" +# Copy the json_stream_provider contents into the container at /app +COPY json_stream_provider /app/json_stream_provider +COPY server.py /app/ + ENTRYPOINT ["python", "/app/server.py"] CMD ["/var/th2/config/custom.json"] \ No newline at end of file diff --git a/README.md b/README.md index ec0dc69..fc4e485 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,10 @@ docker compose build ## Release notes: +### 0.0.7 + +* Custom engine holds separate papermill notebook client for each file. + ### 0.0.6 * Added papermill custom engine to reuse it for notebook execution. diff --git a/json_stream_provider/__init__.py b/json_stream_provider/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/custom_engines.py b/json_stream_provider/custom_engines.py similarity index 100% rename from custom_engines.py rename to json_stream_provider/custom_engines.py diff --git a/log_configuratior.py b/json_stream_provider/log_configuratior.py similarity index 100% rename from log_configuratior.py rename to json_stream_provider/log_configuratior.py diff --git a/papermill_execute_ext.py b/json_stream_provider/papermill_execute_ext.py similarity index 92% rename from papermill_execute_ext.py rename to json_stream_provider/papermill_execute_ext.py index 7d25a29..6cdabb6 100644 --- a/papermill_execute_ext.py +++ b/json_stream_provider/papermill_execute_ext.py @@ -11,6 +11,18 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. from pathlib import Path @@ -22,7 +34,7 @@ from papermill.parameterize import add_builtin_parameters, parameterize_notebook, parameterize_path from papermill.utils import chdir -from custom_engines import exactpro_papermill_engines +from json_stream_provider.custom_engines import exactpro_papermill_engines # The code of this method is derived from https://github.com/nteract/papermill/blob/2.6.0 under the BSD License. diff --git a/package_info.json b/package_info.json index b445491..c34cbec 100644 --- a/package_info.json +++ b/package_info.json @@ -1,4 +1,4 @@ { "package_name": "th2-json-stream-provider", - "package_version": "0.0.6" + "package_version": "0.0.7" } \ No newline at end of file diff --git a/server.py b/server.py index b7a16ad..e2a944c 100644 --- a/server.py +++ b/server.py @@ -11,6 +11,42 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import asyncio import json @@ -22,7 +58,7 @@ from enum import Enum from typing import Coroutine, Any -import papermill_execute_ext as epm +from json_stream_provider import papermill_execute_ext as epm import papermill as pm from papermill.utils import chdir from aiohttp import web @@ -31,8 +67,8 @@ from aiojobs import Job from aiojobs.aiohttp import setup -from custom_engines import CustomEngine, EngineBusyError -from log_configuratior import configure_logging +from json_stream_provider.custom_engines import CustomEngine, EngineBusyError +from json_stream_provider.log_configuratior import configure_logging os.system('pip list')