Planned maintenance on Wednesday, 2021-01-20, 17:00-18:00. Expect some interruptions during that time

Commit 7f905180 authored by Markus Scheidgen's avatar Markus Scheidgen

Remove dependency on old metainfo.

parent 21a53541
......@@ -202,9 +202,6 @@ parserInfo = {'name':'dl_poly-parser', 'version': '0.0'}
# CUSTOMIZE CACHING
cachingLevelForMetaName = {}
import nomad_meta_info
metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(nomad_meta_info.__file__)), "dl_poly.nomadmetainfo.json"))
metaInfoEnv, warnings = loadJsonFile(filePath = metaInfoPath, dependencyLoader = None, extraArgsHandling = InfoKindEl.ADD_EXTRA_ARGS, uri = None)
class DlPolyParser():
""" A proper class envolop for running this parser from within python. """
......@@ -215,11 +212,11 @@ class DlPolyParser():
from unittest.mock import patch
logging.info('dl-poly parser started')
logging.getLogger('nomadcore').setLevel(logging.WARNING)
backend = self.backend_factory(metaInfoEnv)
backend = self.backend_factory("dl_poly.nomadmetainfo.json")
with patch.object(sys, 'argv', ['<exe>', '--uri', 'nmd://uri', mainfile]):
mainFunction(
mainFileDescription=mainFileDescription,
metaInfoEnv=metaInfoEnv,
metaInfoEnv=None,
parserInfo = parserInfo,
cachingLevelForMetaName = cachingLevelForMetaName,
superContext=DL_POLYParserContext(),
......@@ -228,17 +225,3 @@ class DlPolyParser():
defaultSectionCachingLevel = True)
return backend
if __name__ == "__main__":
mainFunction(mainFileDescription,
metaInfoEnv,
parserInfo,
superContext = DL_POLYParserContext(),
cachingLevelForMetaName = cachingLevelForMetaName,
onClose = {},
defaultSectionCachingLevel = False)
......@@ -21,7 +21,6 @@ import logging
import numpy as np
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
from nomadcore.parser_backend import JsonParseEventsWriterBackend
from contextlib import contextmanager
from dlpolyparser.libDlPolyParser import *
......@@ -110,13 +109,9 @@ class DlPolyParserWrapper():
self.backend_factory = backend
def parse(self, mainfile):
import nomad_meta_info
metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(nomad_meta_info.__file__)), "dl_poly.nomadmetainfo.json"))
metaInfoEnv, warnings = loadJsonFile(filePath = metaInfoPath, dependencyLoader = None, extraArgsHandling = InfoKindEl.ADD_EXTRA_ARGS, uri = None)
from unittest.mock import patch
logging.info('dl-poly parser started')
logging.getLogger('nomadcore').setLevel(logging.WARNING)
backend = self.backend_factory(metaInfoEnv)
backend = self.backend_factory("dl_poly.nomadmetainfo.json")
# Call the old parser without a class.
parserInfo = {'name': 'dl_poly-parser', 'version': '0.0'}
backend = parse_without_class(mainfile, backend, parserInfo)
......
# Copyright 2016-2018 Carl Poelking, Fawzi Mohamed, Ankit Kariryaa
#
# 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 sys, os, os.path
baseDir = os.path.dirname(os.path.abspath(__file__))
commonDir = os.path.normpath(os.path.join(baseDir,"../../../../python-common/common/python"))
if not commonDir in sys.path:
sys.path.insert(0, commonDir)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment