diff --git a/nomad/api/repo.py b/nomad/api/repo.py index 6b7309a4be34388cbc57a5a98cc25d9721d4619f..a0081736ba74edbbe53b62d142329c93b4be07b5 100644 --- a/nomad/api/repo.py +++ b/nomad/api/repo.py @@ -24,7 +24,7 @@ from elasticsearch_dsl import Q from elasticsearch.exceptions import NotFoundError import datetime -from nomad import search, utils +from nomad import search from .app import api, rfc3339DateTime from .auth import login_if_available @@ -32,8 +32,6 @@ from .common import pagination_model, pagination_request_parser, calc_route ns = api.namespace('repo', description='Access repository metadata.') -logger = utils.get_logger(__name__) - @calc_route(ns) class RepoCalcResource(Resource): @@ -101,9 +99,8 @@ def add_common_parameters(request_parser): help='A yyyy-MM-ddTHH:mm:ss (RFC3339) maximum entry time (e.g. upload time)') for quantity in search.search_quantities.values(): - print('## %s: %s' % (quantity.name, quantity.multi)) request_parser.add_argument( - quantity.name, type=str, help=quantity.description, + quantity.name, help=quantity.description, action='append' if quantity.multi else None) @@ -155,9 +152,9 @@ def create_owner_query(): def create_search_parameters(): """ Helper that creates a request.args dict with isolated search parameters """ - logger.debug('create search parameter', request_args=str(dict(**request.args))) - - search_parameters = dict(**request.args) + search_parameters = { + key: request.args.getlist(key) if search.search_quantities[key] else request.args.get(key) + for key in request.args.keys()} search_parameters.pop('owner', None) search_parameters.pop('scroll', None) search_parameters.pop('scroll_id', None) @@ -257,7 +254,6 @@ class RepoCalcsResource(Resource): q = q & without_currupted_mainfile if q is not None else without_currupted_mainfile search_parameters = create_search_parameters() - logger.debug('repo search', search_parameters=str(search_parameters)) try: if scroll: diff --git a/nomad/search.py b/nomad/search.py index 7e56e422ff5fdbb0ee5b783cd65485126a55ed05..526428c30e96a18fc0bc6e51ef5f4e1bc161ef64 100644 --- a/nomad/search.py +++ b/nomad/search.py @@ -27,8 +27,6 @@ from datetime import datetime from nomad import config, datamodel, infrastructure, datamodel, coe_repo, utils -logger = utils.get_logger(__name__) - path_analyzer = analyzer( 'path_analyzer', tokenizer=tokenizer('path_tokenizer', 'pattern', pattern='/')) @@ -284,9 +282,7 @@ def _execute_paginated_search( search = search.sort('-%s' % order_by_quantity.elastic_field) paginated_search = search[(page - 1) * per_page: page * per_page] - logger.debug('search request', search_request=str(paginated_search.to_dict())) response = paginated_search.execute() # pylint: disable=E1101 - logger.debug('search response', search_request=str(response.to_dict())) total_results = response.hits.total search_results = [hit.to_dict() for hit in response.hits] diff --git a/ops/deployments/nomad.prod-1.values.yaml b/ops/deployments/nomad.prod-1.values.yaml index 0bd5fe74f36cb27f6ad2594edd116b6797d68dfb..87260faa39df48022bbe4565724b38f074c32675 100644 --- a/ops/deployments/nomad.prod-1.values.yaml +++ b/ops/deployments/nomad.prod-1.values.yaml @@ -2,7 +2,7 @@ proxy: nodePort: 30011 external: host: "repository.nomad-coe.eu" - path: "/uploads" + path: "/fairdi/nomad/prod" api: disableReset: false @@ -22,7 +22,7 @@ postgres: user: 'nomadrep' password_secret: 'nomad-production-repository-password' -uploadurl: 'https://repository.nomad-coe.eu/uploads/upload' +uploadurl: 'https://repository.nomad-coe.eu/fairdi/nomad/prod/gui/upload' volumes: prefixSize: 1 diff --git a/ops/deployments/nomad.prod.env.sh b/ops/deployments/nomad.prod.env.sh index d067f4947bc4b6ec81bfbeb27f5eaa6c98786b07..26075a65943e077eb978051c1893654f08b8ea58 100644 --- a/ops/deployments/nomad.prod.env.sh +++ b/ops/deployments/nomad.prod.env.sh @@ -1,8 +1,8 @@ -export NOMAD_CLIENT_URL=https://repository.nomad-coe.eu/uploads/api +export NOMAD_CLIENT_URL=https://labdev-nomad.esc.rzg.mpg.de/fairdi/nomad/prod/api export NOMAD_CLIENT_USER=admin export NOMAD_MONGO_DB_NAME=fairdi_nomad_prod export NOMAD_ELASTIC_INDEX_NAME=fairdi_nomad_prod export NOMAD_FS_LOCAL_TMP=/nomad/fairdi/prod/fs/tmp export NOMAD_FS_STAGING=/nomad/fairdi/prod/fs/staging export NOMAD_FS_PUBLIC=/nomad/fairdi/prod/fs/public -export NOMAD_FS_TMP=/nomad/fairdi/prod/fs/tmp \ No newline at end of file +export NOMAD_FS_TMP=/nomad/fairdi/prod/fs/tmp diff --git a/tests/test_api.py b/tests/test_api.py index 139db27a076f9e65350531e2cb51b537e24625ad..d2b9bf7c1c099977ab5b532c041a43ec4091d181 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -753,7 +753,7 @@ class TestRepo(): (0, 'system', 'atom'), (1, 'atoms', 'Br'), (1, 'atoms', 'Fe'), - (0, 'atoms', ['Fe', 'Br']), + (0, 'atoms', ['Fe', 'Br', 'A', 'B']), (0, 'only_atoms', ['Br', 'Si']), (1, 'only_atoms', ['Fe']), (1, 'only_atoms', ['Br', 'K', 'Si']),