From 0754135cd42b7dea8dff0a48e4c4013342e9a8ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Mon, 22 Mar 2021 14:55:57 +0000 Subject: [PATCH] MAINT: add troubleshooting docs --- .gitlab-ci.yml | 15 ++++++++------- CHANGELOG.md | 3 +++ README_SETUP.md | 3 +++ setup.py | 4 ++-- src/caosdb/common/models.py | 3 +++ unittests/docker/Dockerfile | 2 +- unittests/test_query.py | 7 +++++-- 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b45dde5d..7b24c1ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,7 @@ variables: DEPLOY_REF: dev - CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/caosdb-pylib/testenv:latest + CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-pylib/testenv:latest # When using dind, it's wise to use the overlayfs driver for # improved performance. @@ -65,7 +65,7 @@ trigger_build: stage: deploy script: - /usr/bin/curl -X POST - -F token=$DEPLOY_TRIGGER_TOKEN + -F token=$CI_JOB_TOKEN -F "variables[F_BRANCH]=$CI_COMMIT_REF_NAME" -F "variables[PYLIB]=$CI_COMMIT_REF_NAME" -F "variables[TriggerdBy]=PYLIB" @@ -92,15 +92,16 @@ build-testenv: - docker push $CI_REGISTRY_IMAGE # Build the sphinx documentation and make it ready for deployment by Gitlab Pages -# documentation: -# stage: deploy - # Special job for serving a static website. See https://docs.gitlab.com/ee/ci/yaml/README.html#pages pages: stage: deploy only: - # TODO this should be for master only, once releases are more regularly - - dev + refs: + - /^release-.*$/i + - master + variables: + # run pages only on gitlab.com + - $CI_SERVER_HOST == "gitlab.com" script: - echo "Deploying" - make doc diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e190313..6defee79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### +* `etag` property for the `caosdb.Query` class. The etag allows to debug the + caching and to decide whether the server has changed between queries. + ### Changed ### ### Deprecated ### diff --git a/README_SETUP.md b/README_SETUP.md index 2db73cfa..4980b850 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -156,3 +156,6 @@ Build documentation in `build/` with `make doc`. - `sphinx` - `sphinx-autoapi` - `recommonmark` + +### Troubleshooting ## +If the client is to be executed directly from the `/src` folder, an initial `.\setup.py install --user` must be called. \ No newline at end of file diff --git a/setup.py b/setup.py index 1a6cb7b5..d491a1d3 100755 --- a/setup.py +++ b/setup.py @@ -47,9 +47,9 @@ from setuptools import find_packages, setup MAJOR = 0 MINOR = 5 -MICRO = 1 +MICRO = 2 PRE = "" # e.g. rc0, alpha.1, 0.beta-23 -ISRELEASED = True +ISRELEASED = False if PRE: VERSION = "{}.{}.{}-{}".format(MAJOR, MINOR, MICRO, PRE) diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py index 9592e484..d8f42a3f 100644 --- a/src/caosdb/common/models.py +++ b/src/caosdb/common/models.py @@ -3661,6 +3661,7 @@ class Query(): self.flags = dict() self.messages = _Messages() self.cached = None + self.etag = None if isinstance(q, etree._Element): self.q = q.get("string") @@ -3670,6 +3671,7 @@ class Query(): self.cached = False else: self.cached = q.get("cached").lower() == "true" + self.etag = q.get("etag") for m in q: if m.tag.lower() == 'warning' or m.tag.lower() == 'error': @@ -3714,6 +3716,7 @@ class Query(): cresp = Container._response_to_entities(http_response) self.results = cresp.query.results self.cached = cresp.query.cached + self.etag = cresp.query.etag if self.q.lower().startswith('count') and len(cresp) == 0: # this was a count query diff --git a/unittests/docker/Dockerfile b/unittests/docker/Dockerfile index e41fb91b..7fa3f75b 100644 --- a/unittests/docker/Dockerfile +++ b/unittests/docker/Dockerfile @@ -5,6 +5,6 @@ RUN apt-get update && \ curl pycodestyle \ python3-sphinx ARG COMMIT="dev" -RUN git clone -b dev https://gitlab.com/caosdb/caosdb-pylib.git && \ +RUN git clone -b dev https://gitlab.indiscale.com/caosdb/src/caosdb-pylib.git && \ cd caosdb-pylib && git checkout $COMMIT && pip3 install . RUN pip3 install recommonmark sphinx-rtd-theme diff --git a/unittests/test_query.py b/unittests/test_query.py index f4b3ee97..12622ea4 100644 --- a/unittests/test_query.py +++ b/unittests/test_query.py @@ -26,20 +26,23 @@ import caosdb as db def test_query_parsing(): - s = '<Query string="FIND bla" results="0" cached="true"/>' + s = '<Query string="FIND bla" results="0" cached="true" etag="asdf"/>' q = db.Query(etree.fromstring(s)) assert q.q == "FIND bla" assert q.results == 0 assert q.cached is True + assert q.etag == "asdf" - s = '<Query string="COUNT bla" results="1" cached="false"/>' + s = '<Query string="COUNT bla" results="1" cached="false" etag="asdf"/>' q = db.Query(etree.fromstring(s)) assert q.q == "COUNT bla" assert q.results == 1 assert q.cached is False + assert q.etag == "asdf" s = '<Query string="COUNT blub" results="4"/>' q = db.Query(etree.fromstring(s)) assert q.q == "COUNT blub" assert q.results == 4 assert q.cached is False + assert q.etag is None -- GitLab