Skip to content

Commit

Permalink
- Merged master
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaellh0079 committed Nov 5, 2024
2 parents fbd7ee2 + 6483926 commit d344522
Show file tree
Hide file tree
Showing 7 changed files with 381 additions and 28 deletions.
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM opendap/besd:3.21.0-501 AS base
FROM opendap/besd:3.21.0-526 AS base
HEALTHCHECK NONE

RUN yum -y update && \
Expand All @@ -23,16 +23,17 @@ RUN pip install ipython && \

COPY setup.py requirements*txt generate_dmrpp.py ./
COPY dmrpp_generator ./dmrpp_generator/
COPY dmrpp_generator/handler.py ./dmrpp_generator/
COPY tests ./tests/
RUN pip install -r requirements.txt && \
python setup.py install

RUN coverage run -m pytest && \
coverage report && \
coverage lcov -o ./coverage/lcov.info && \
rm -rf tests .coverage .pytest_cache && \
pip uninstall pytest -y && \
pip uninstall coverage -y
coverage report && \
coverage lcov -o ./coverage/lcov.info && \
rm -rf tests .coverage .pytest_cache && \
pip uninstall pytest -y && \
pip uninstall coverage -y

RUN pip install --target $BUILD awslambdaric
COPY site.conf /etc/bes/
Expand Down
273 changes: 273 additions & 0 deletions bes.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
#------------------ OPeNDAP BES Initialization file --------------------#
# #
# Key entries for OPeNDAP BES run time behavior #
# #
#-----------------------------------------------------------------------#

# Set this parameter to the email address for the server's
# administrator. This is the address where users should send basic
# questions about the server and the data it provides.

[email protected]

BES.ServerAdministrator=email:[email protected]
BES.ServerAdministrator+=organization:OPeNDAP Inc.
BES.ServerAdministrator+=street:165 NW Dean Knauss Dr.
BES.ServerAdministrator+=city:Narragansett
BES.ServerAdministrator+=region:RI
BES.ServerAdministrator+=postalCode:02882
BES.ServerAdministrator+=country:US
BES.ServerAdministrator+=telephone:+1.401.575.4835
BES.ServerAdministrator+=website:http://www.opendap.org

# User and Group for the BES
#
# The BES.user and BES.group can be either user and group names or id
# numbers. To use numbers in place of names, prefix the values with a
# number sign (#).
# For example: BES.User=#172

BES.User=bes
BES.Group=bes

# Where should the BES keep its log file?

# BES.LogName=/var/log/bes/bes.log
BES.LogName=/tmp/bes.log

# Verbose logging records all five phases of evaluation of each command.
# Regular mode only records 'get' commands.
BES.LogVerbose=no

# By setting BES.LogUnixTime to true the server will make loge entries using
# the value of UNIX time (seconds since 1970-01-01T00:00:00 UTC). Any other
# value, or omitting the key wil cause the server to ouput times as in
# ISO-8601 date format
BES.LogUnixTime=false

# Set to 'yes' to use local time in the bes log. UTC is used by default.
# BES.LogTimeLocal=yes

# Set this to true to suppress source file name from the log file. The
# default value is false.
# BES.DoNotLogSourceFilenames

# Set the value of BES.Catalog.catalog.RootDirectory to the root
# directory of the data this BES will serve. If you are not using the
# BES in conjunction with Hyrax, but as a standalone server, set this
# to null and use the parameter BES.Data.RootDirectory defined later on
# in this file.

BES.Catalog.catalog.RootDirectory=/tmp

# Set BES.Catalog.catalog.FollowSymLinks to true/yes if the BES should
# follow symbolic links in the BES.Catalog.catalog.RootDirectory. If
# the BES is not being used in conjunction with Hyrax, but is being used
# as a standalone server, use the similarly-named parameter defined below.

BES.Catalog.catalog.FollowSymLinks=No

# The BES uncompress cache directory is used to store decompressed
# data files. This directory will be shared by all of the BES processes
# running on a given host. The directory should not be an NFS mount
# unless the NFS option enabling fcntl(2) locking has been set. The
# caching software will purge older files from the cache when 100% of
# the cache size is reached; removing 20% of the files (in terms of size)
# using a least-recently-used test. The cache size is given in megabytes.
# Note cached files are named using the UncompressCache.prefix, so it's
# easy to see what's in the cache at any given time, even when it's a
# directory like /tmp that's used by many programs.

BES.UncompressCache.dir=/var/cache/bes/hyrax_ux
BES.UncompressCache.prefix=ux_
BES.UncompressCache.size=500

# Configure the BES timeout feature. In practice, the timeout value is
# set by the Hyrax front-end, so the value of BES.TimeOutInSeconds is
# ignored. The value here is a fallback in case the Hyrax front-end
# configuration file does not provide a value.

# BES.TimeOutInSeconds=600

# For the BES timeout, should the timeout period include sending data
# back to a client, or should it just include the time required to
# prepare the response for transmission. For the latter, define the
# parameter BES.CancelTimeoutOnSend and set it to true. If not set
# the value of this parameter defaults to false.

BES.CancelTimeoutOnSend=true

# Experimental: Annotation service URL. Set this parameter to the URL
# of an annotation service. If the value is not null, then a global
# attribute will be added to the DAS/DMR response for every dataset
# available using this server so that clients can access the annotation
# service. The name of the attribute will be 'Annotation'.

BES.AnnotationServiceURL =

# BES.AnnotationServiceURL = http://localhost:8083/Feedback/form


#########################################################################
# #
# NOTE: It is unlikely that you will need to change anything below #
# this comment. #
#-----------------------------------------------------------------------#

# Because the Hyrax is often tasked with accessing services using the
# internets we maintain a list of allowed hosts which Hyrax is allowed
# to access. By default, Hyrax is allowed to access itself. If additional
# services are to be added to the whitelist do so by adding the new
# service URL to the site.conf file using += syntax like this:
#
# AllowedHosts+=^http:\/\/test\.opendap\.org\/.*$
#
#
AllowedHosts=^https?:\/\/localhost(:8080)?\/.*$

# If you intend to use the BES as a standalone server, set the value
# of BES.Data.RootDirectory to point to your data and disregard the
# BES.Catalog.catalog.RootDirectory parameter in dap.conf.

BES.Data.RootDirectory=/dev/null

# When using the BES as a standalone server, set BES.FollowSymLinks to
# true/yes if the BES should follow symbolic links. When the BES is
# part of Hyrax, look in the modules/dap.conf for the parameter that
# controls this feature.

BES.FollowSymLinks=No

# The TCP port on which the BES listens for commands

BES.ServerPort=10022

# Listen on this address - useful for multi-homed hosts. The BES uses
# any interface by default.

# BES.ServerIP = 127.0.0.1

# The BES supports an administrative interface. It accepts specific BES
# admin commands and is used by Hyrax to support administrator actions
# accessible via the browser based Hyrax Admin Interface. Use the
# BES.DaemonPort parameter to set the port on which the BES admin
# interface listens. The OLFS configuration for the BES admin port must
# match this value.

# BES.DaemonPort=11002

# Security information for this server. ServerSecure specifies whether
# the server requires authentication by the client using SSL
# certificates and keys. If ServerSecure is true/yes, then use
# ServerSecurePort to set the port number and the subsequent six
# parameters to set the server and client certificate, authentication
# and key files.

BES.ServerSecure=no

# BES.ServerSecurePort=10003
# BES.ServerCertFile=/etc/pki/bes/cacerts/file.pem
# BES.ServerCertAuthFile=/full/path/to/serverside/certificate/authority/file.pem
# BES.ServerKeyFile=/etc/pki/bes/public/file.pem
# BES.ClientCertFile=/etc/pki/bes/cacerts/file.pem
# BES.ClientCertAuthFile=/full/path/to/clientside/certificate/authority/file.pem
# BES.ClientKeyFile=/etc/pki/bes/public/file.pem

# Help file locations, for text, html, and xml versions

BES.Help.TXT=/usr/share/bes/bes_help.txt
BES.Help.HTML=/usr/share/bes/bes_help.html
BES.Help.XML=/usr/share/bes/bes_help.xml

# Should informational response objects be buffered, or streamed
# Should informational objects be formatted as text, html, or xml

BES.Info.Buffered=no
BES.Info.Type=xml

# If the symbolic name cannot be found in persistence, nice means simply
# log an error, strict means throw an exception

BES.Container.Persistence=strict

#-----------------------------------------------------------------------#
# Defines the TCP buffer size to use in sending and receiving data in #
# the BES. With these parameters you will be able to maximize the #
# TCP capacity of the client and server communication by setting the #
# size of the internal BES buffers to match that of your systems TCP #
# window sizes. System administrators can tune the TCP window sizes in #
# the kernel. If this is done, set these parameters to match those #
# buffer sizes set in the kernel. Or, if your system supports dynamic #
# TCP window sizes, as many are doing these days, then leave the #
# SetSock*Size parameters to No and the BES will interrogate the socket #
# for the buffer sizes. #
# #
# The TCP window size should be equal to the Bandwidth*Delay Product #
# (BDP). This is the number of bytes in flight to fill the entire path, #
# and is equal to the connection speed times the RTT( Round-Trip Time) #
# divided by 2. For example, if you have a 100 Mbps path and the RTT is #
# 75 ms, the BDP = 100 * 0.075 / 2 = 3.75 Mbits (470 KB). #
# #
# If you are not sure what to do here, we recommend that you leave #
# these values set as is. #
# #
# BES.SetSockRecvSize=No|Yes - if set to no, then do not set the TCP #
# TCP receive buffer size. If set to yes #
# then set the TCP receive buffer size to #
# the value specified by BES.SockRecvSize #
# Default is No, use the system TCP window #
# size. #
# BES.SockRecvSize=<number> - This value should be set to the size, in #
# bytes, of the TCP receive buffer size. #
# BES.SetSockSendSize=No|Yes - if set to no, then do not set the TCP #
# TCP send buffer size. If set to yes #
# then set the TCP send buffer size to #
# the value specified by BES.SockSendSize. #
# Default is No, use the system TCP window #
# size. #
# BES.SockSendSize=<number> - This value should be set to the size, in #
# bytes, of the TCP send buffer size. #
#-----------------------------------------------------------------------#

BES.SetSockRecvSize=No
BES.SockRecvSize=65535
BES.SetSockSendSize=No
BES.SockSendSize=65535

# Defines size of system global memory pool, in megabytes

BES.Memory.GlobalArea.EmergencyPoolSize=1
BES.Memory.GlobalArea.MaximumHeapSize=20
BES.Memory.GlobalArea.Verbose=no
BES.Memory.GlobalArea.ControlHeap=no

# BES.ProcessManagerMethod=multiple is the normal configuration for
# both Hyrax and a standalone BES. Set this to single when debugging a
# new module.

BES.ProcessManagerMethod=multiple

# This is used only by the Apache module, which is not currently built.
# jhrg 10/14/15
#
# BES.DefaultResponseMethod=POST

# Normally the BES.modules parameter should be blank; the next
# parameter will force a number of 'per module' configuration files to
# be loaded and those will incrementally add on to this parameter's
# value.

BES.modules=

# Scan the directory 'modules' and load all of the 'conf' files found
# there.

BES.Include=modules/.*\.conf$

# Include the keys in site.conf last, forcing an override of the values
# in any of the previous files. This provides an easy way to set up the
# BES for your site and never have to edit the installed conf files we
# ship with the server. You can add new key/value pairs, and add on or
# override an existing key/value pair.

BES.Include=site.conf
33 changes: 33 additions & 0 deletions dmrpp_generator/handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import json
import signal
import sys
import time

from dmrpp_generator.main import main


class GracefulKiller:
kill_now = False

def __init__(self):
signal.signal(signal.SIGINT, self.exit_gracefully)
signal.signal(signal.SIGTERM, self.exit_gracefully)

def exit_gracefully(self, signum, frame):
print('Exiting gracefully')
self.kill_now = True


if __name__ == "__main__":
print(f'DMR++ argv: {sys.argv}')
if len(sys.argv) <= 1:
killer = GracefulKiller()
print('DMR++ Task is running...')
while not killer.kill_now:
time.sleep(1)
print('terminating')
else:
print('DMR++ calling function')
print(f'argv: {type(sys.argv[1])}')
print(f'argv: {sys.argv[1]}')
main(json.loads(sys.argv[1]), {})
Loading

0 comments on commit d344522

Please sign in to comment.