Skip to content

Commit

Permalink
Restricted health check, reverted docker and base
Browse files Browse the repository at this point in the history
  • Loading branch information
ArunPsiog committed Sep 26, 2023
1 parent 44061cb commit aff0799
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 40 deletions.
24 changes: 5 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ FROM base AS build_base
RUN <<EOL
apt-get update
apt-get install -y --no-install-recommends \
curl \
git \
rsync \
unzip \
Expand Down Expand Up @@ -224,14 +223,13 @@ COPY --from=covalent_src $BUILDROOT/ $BUILDROOT

RUN <<EOL
if [ ! -d $BUILDROOT/dist ] ; then
#cd $BUILDROOT/covalent_ui/webapp
#yarn install --network-timeout 100000
#yarn build --network-timeout 100000
cd $BUILDROOT/covalent_ui/webapp
yarn install --network-timeout 100000
yarn build --network-timeout 100000
cd $BUILDROOT
python setup.py sdist
fi
tarball=`find dist -type f -name 'covalent-*.tar.gz'`
python -m pip install ${tarball}[postgres]
python -m pip install dist/covalent-*.tar.gz
EOL

##############################
Expand Down Expand Up @@ -308,18 +306,6 @@ COPY --from=build_base /usr/bin/wget /usr/bin/wget
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libpsl.so.5 /usr/lib/x86_64-linux-gnu/libpsl.so.5

COPY --from=build_base /usr/bin/curl /usr/bin/curl
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libcurl.so.4 /usr/lib/x86_64-linux-gnu/libcurl.so.4
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libnghttp2.so.14 /usr/lib/x86_64-linux-gnu/libnghttp2.so.14
COPY --from=build_base /usr/lib/x86_64-linux-gnu/librtmp.so.1 /usr/lib/x86_64-linux-gnu/librtmp.so.1
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libssh2.so.1 /usr/lib/x86_64-linux-gnu/libssh2.so.1
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2
COPY --from=build_base /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libbrotlidec.so.1 /usr/lib/x86_64-linux-gnu/libbrotlidec.so.1
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libsasl2.so.2 /usr/lib/x86_64-linux-gnu/libsasl2.so.2
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libbrotlicommon.so.1 /usr/lib/x86_64-linux-gnu/libbrotlicommon.so.1
COPY --from=build_base /usr/lib/x86_64-linux-gnu/libpsl.so.5 /usr/lib/x86_64-linux-gnu/libpsl.so.5

USER root

RUN <<EOL
Expand All @@ -342,7 +328,7 @@ ENV COVALENT_SVC_PORT=${COVALENT_SVC_PORT} \

EXPOSE ${COVALENT_SVC_PORT}

#HEALTHCHECK CMD wget --no-verbose --tries=1 --spider http://localhost:${COVALENT_SVC_PORT} || exit 1
HEALTHCHECK CMD wget --no-verbose --tries=1 --spider http://localhost:${COVALENT_SVC_PORT} || exit 1

ENTRYPOINT [ "/bin/bash" ]

Expand Down
6 changes: 1 addition & 5 deletions covalent/triggers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(
None # to attach the event loop when directly using dispatcher's functions
)
self.use_internal_funcs = (
False # whether to use dispatcher's functions directly instead of through API calls
True # whether to use dispatcher's functions directly instead of through API calls
)
self.stop_flag = None # to handle stopping mechanism in a thread safe manner in case observe() is a blocking call (e.g. see TimeTrigger)

Expand Down Expand Up @@ -107,9 +107,6 @@ def _get_status(self) -> Status:
status: Status
"""

app_log.debug("GET STATUS")
app_log.debug(f"use_internal_funcs: {self.use_internal_funcs}")

if self.use_internal_funcs:
from covalent_dispatcher._service.app import get_result

Expand Down Expand Up @@ -171,7 +168,6 @@ def trigger(self) -> None:
)

status = self._get_status()
app_log.debug(f"STATUS: {status}")

if status == Result.NEW_OBJ or status is None:
# To continue the pending dispatch
Expand Down
1 change: 1 addition & 0 deletions covalent_dispatcher/_triggers_app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@

from .app import router as triggers_router # nopycln: import
from .app import triggers_only_app # nopycln: import
from .app import trigger_only_router
4 changes: 3 additions & 1 deletion covalent_dispatcher/_triggers_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
log_stack_info = logger.log_stack_info

router = APIRouter()
trigger_only_router = APIRouter()
triggers_only_app = FastAPI()

active_triggers = {}
Expand Down Expand Up @@ -76,7 +77,7 @@ def get_threadpool():
return ThreadPoolExecutor()


@router.get("/triggers/healthcheck")
@trigger_only_router.get("/triggers/healthcheck")
async def healthcheck(request: Request):
return {"status": "ok"}

Check warning on line 82 in covalent_dispatcher/_triggers_app/app.py

View check run for this annotation

Codecov / codecov/patch

covalent_dispatcher/_triggers_app/app.py#L82

Added line #L82 was not covered by tests

Expand Down Expand Up @@ -140,3 +141,4 @@ async def stop_observe(request: Request):


triggers_only_app.include_router(router, prefix="/api", tags=["Triggers"])
triggers_only_app.include_router(trigger_only_router, prefix="/api", tags=["Triggers"])
4 changes: 3 additions & 1 deletion covalent_ui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def get_home(request: Request, rest_of_path: str):
)
fastapi_app.mount("/", socketio_app)


if __name__ == "__main__":
ap = argparse.ArgumentParser()

Expand Down Expand Up @@ -116,7 +115,10 @@ def get_home(request: Request, rest_of_path: str):

app_name = "app:fastapi_app"
if args.triggers_only:
from covalent_dispatcher._triggers_app import trigger_only_router # nopycln: import

Check warning on line 118 in covalent_ui/app.py

View check run for this annotation

Codecov / codecov/patch

covalent_ui/app.py#L118

Added line #L118 was not covered by tests

app_name = "app:triggers_only_app"
fastapi_app.include_router(trigger_only_router, prefix="/api", tags=["Triggers"])

Check warning on line 121 in covalent_ui/app.py

View check run for this annotation

Codecov / codecov/patch

covalent_ui/app.py#L121

Added line #L121 was not covered by tests
elif args.no_triggers:
import covalent_dispatcher._triggers_app.app as tr_app

Expand Down
23 changes: 9 additions & 14 deletions tests/covalent_tests/triggers/database_trigger_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@
#
# This file is part of Covalent.
#
# Licensed under the GNU Affero General Public License 3.0 (the "License").
# A copy of the License may be obtained with this software package or at
# Licensed under the Apache License 2.0 (the "License"). A copy of the
# License may be obtained with this software package or at
#
# https://www.gnu.org/licenses/agpl-3.0.en.html
# https://www.apache.org/licenses/LICENSE-2.0
#
# Use of this file is prohibited except in compliance with the License. Any
# modifications or derivative works of this file must retain this copyright
# notice, and modified files must contain a notice indicating that they have
# been altered from the originals.
#
# Covalent is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
#
# Relief from the License may be granted by purchasing a commercial license.

# Use of this file is prohibited except in compliance with the License.
# 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 pytest

Expand Down

0 comments on commit aff0799

Please sign in to comment.