Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions analysis/webservice/algorithms/doms/DomsInitialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import configparser
import logging

import pkg_resources
from pathlib import Path

from cassandra.auth import PlainTextAuthProvider
from cassandra.cluster import Cluster
Expand Down Expand Up @@ -195,7 +195,7 @@ def _get_config_files(filename):
extensions = ['.default', '']
for extension in extensions:
try:
candidate = pkg_resources.resource_filename(__name__, filename + extension)
candidate = str(Path(__file__).parent / (filename + extension))
candidates.append(candidate)
except KeyError as ke:
log.warning('configuration file {} not found'.format(filename + extension))
Expand Down
6 changes: 3 additions & 3 deletions analysis/webservice/algorithms/doms/ResultsStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from datetime import datetime
from time import sleep

import pkg_resources
from pathlib import Path
from cassandra.auth import PlainTextAuthProvider
from cassandra.cluster import Cluster
from cassandra.concurrent import execute_concurrent_with_args
Expand Down Expand Up @@ -97,7 +97,7 @@ def _get_config_files(filename):
extensions = ['.default', '']
for extension in extensions:
try:
candidate = pkg_resources.resource_filename(__name__, filename + extension)
candidate = str(Path(__file__).parent / (filename + extension))
log.info('use config file {}'.format(filename + extension))
candidates.append(candidate)
except KeyError as ke:
Expand Down Expand Up @@ -267,7 +267,7 @@ def __prepare_result(self, execution_id, primaryId, result, insertStatement):
result["platform"] if "platform" in result else None,
result["device"] if "device" in result else None,
json.dumps(data, cls=DomsEncoder),
1 if primaryId is 'PRIMARY' else 0,
1 if primaryId == 'PRIMARY' else 0,
result["depth"],
result['fileurl']
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

import logging
import importlib
import importlib.metadata
import importlib.resources
from functools import partial
import pkg_resources
import tornado
from nexustiles.nexustiles import NexusTileService
from webservice import NexusHandler
Expand All @@ -31,14 +32,14 @@ def __init__(self):

class VersionHandler(tornado.web.RequestHandler):
def get(self):
self.write(pkg_resources.get_distribution("sdap-nexus").version)
self.write(importlib.metadata.version("sdap-nexus"))

self.handlers.append((r"/version", VersionHandler))

self.handlers.append(
(r'/apidocs', tornado.web.RedirectHandler, {"url": "/apidocs/"}))

apidocs_path = pkg_resources.resource_filename('webservice.apidocs', '')
apidocs_path = str(importlib.resources.files('webservice.apidocs'))
self.handlers.append(
(
r'/apidocs/(.*)', tornado.web.StaticFileHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# 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 pkg_resources
import importlib.resources


class SparkContextBuilder:
Expand All @@ -26,7 +26,7 @@ def get_spark_context(cls):
if cls.spark_context is None:
from pyspark.sql import SparkSession

scheduler_path = pkg_resources.resource_filename('webservice', "config/scheduler.xml")
scheduler_path = str(importlib.resources.files('webservice').joinpath("config/scheduler.xml"))

spark = SparkSession.builder.appName("nexus-analysis").config(
"spark.scheduler.allocation.file", scheduler_path
Expand Down
4 changes: 2 additions & 2 deletions analysis/webservice/webapp_livy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import logging
import sys
import os
import pkg_resources
from pathlib import Path
from webservice import nexus_tornado
from .nexus_tornado.options import define, options, parse_command_line
from webservice.NexusLivyHandler import LivyHandler
Expand Down Expand Up @@ -70,7 +70,7 @@ def post(self):

# Configure tornado.
webconfig = configparser.RawConfigParser()
webconfig.readfp(pkg_resources.resource_stream(__name__, "config/web.ini"), filename='web.ini')
webconfig.readfp(open(Path(__file__).parent / "config/web.ini"), filename='web.ini')
define("debug", default=False, help="run in debug mode")
define("port", default=webconfig.get("livy", "server.socket_port"), help="run on the given port", type=int)
define("address", default=webconfig.get("livy", "server.socket_host"), help="Bind to the given address")
Expand Down
4 changes: 2 additions & 2 deletions data-access/nexustiles/backends/nexusproto/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import numpy as np
import numpy.ma as ma
import pkg_resources
from pathlib import Path
from pytz import timezone, UTC
from shapely.geometry import MultiPolygon, box

Expand Down Expand Up @@ -575,7 +575,7 @@ def _get_config_files(filename):
extensions = ['.default', '']
for extension in extensions:
try:
candidate = pkg_resources.resource_filename(__name__, filename + extension)
candidate = str(Path(__file__).parent / (filename + extension))
log.info('use config file {}'.format(filename + extension))
candidates.append(candidate)
except KeyError as ke:
Expand Down
4 changes: 2 additions & 2 deletions data-access/nexustiles/nexustiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import numpy as np
import numpy.ma as ma
import pkg_resources
from pathlib import Path
import pysolr
from pytz import timezone, UTC
from shapely.geometry import box
Expand Down Expand Up @@ -947,7 +947,7 @@ def _get_config_files(filename):
extensions = ['.default', '']
for extension in extensions:
try:
candidate = pkg_resources.resource_filename(__name__, filename + extension)
candidate = str(Path(__file__).parent / (filename + extension))
log.info('use config file {}'.format(filename + extension))
candidates.append(candidate)
except KeyError as ke:
Expand Down
2 changes: 1 addition & 1 deletion docker/solr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# 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 bitnami/solr:8.11.1-debian-10-r0
FROM bitnamilegacy/solr:8.11.1-debian-11-r0
ADD https://repo1.maven.org/maven2/org/locationtech/jts/jts-core/1.15.0/jts-core-1.15.0.jar /opt/bitnami/solr/server/solr-webapp/webapp/WEB-INF/lib/jts-core-1.15.0.jar
USER root
RUN chmod a+r /opt/bitnami/solr/server/solr-webapp/webapp/WEB-INF/lib/jts-core-1.15.0.jar
Expand Down
Loading