From 46674c48197b6f2667b6a88dff3fbbfa758062ba Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Fri, 5 Jul 2019 11:41:44 +0200 Subject: [PATCH 1/2] Adding "ENABLED" directive to the configuration to quickly disable a service for maintenance --- clam/clamdispatcher.py | 2 +- clam/clamservice.py | 4 ++++ clam/common/data.py | 2 +- codemeta.json | 2 +- setup.py | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/clam/clamdispatcher.py b/clam/clamdispatcher.py index f325c5a4..63dccedc 100755 --- a/clam/clamdispatcher.py +++ b/clam/clamdispatcher.py @@ -25,7 +25,7 @@ import signal import shutil -VERSION = '2.4.5' +VERSION = '2.4.6' sys.path.append(sys.path[0] + '/..') diff --git a/clam/clamservice.py b/clam/clamservice.py index cc8da2d2..9e471316 100755 --- a/clam/clamservice.py +++ b/clam/clamservice.py @@ -2321,6 +2321,8 @@ def DELETE(actionid, credentials=None): def sufficientresources(): + if not settings.ENABLED: + return False, "Service is disabled for maintenance" if settings.REQUIREMEMORY > 0: if not os.path.exists('/proc/meminfo'): printlog("WARNING: No /proc/meminfo available on your system! Not Linux? Skipping memory requirement check!") @@ -2655,6 +2657,8 @@ def set_defaults(): settings.OAUTH_ENCRYPTIONSECRET = "%032x" % random.getrandbits(32) if 'ENABLEWEBAPP' not in settingkeys: settings.ENABLEWEBAPP = True + if 'ENABLED' not in settingkeys: + settings.ENABLED = True if 'REMOTEHOST' not in settingkeys: settings.REMOTEHOST = None elif 'REMOTEUSER' not in settingkeys: diff --git a/clam/common/data.py b/clam/common/data.py index 0fc37af8..5280aa7e 100644 --- a/clam/common/data.py +++ b/clam/common/data.py @@ -37,7 +37,7 @@ import clam.common.util import clam.common.viewers -VERSION = '2.4.5' +VERSION = '2.4.6' #dirs for services shipped with CLAM itself CONFIGDIR = os.path.abspath(os.path.dirname(__file__) + '/../config/') diff --git a/codemeta.json b/codemeta.json index 31fd9aa5..3bb3a5dc 100644 --- a/codemeta.json +++ b/codemeta.json @@ -10,7 +10,7 @@ "@type": "SoftwareSourceCode", "identifier": "clam", "name": "CLAM", - "version": "2.4.5", + "version": "2.4.6", "description": "Quickly turn command-line applications into RESTful webservices with a web-application front-end. You provide a specification of your command line application, its input, output and parameters, and CLAM wraps around your application to form a fully fledged RESTful webservice. ", "license": "https://spdx.org/licenses/GPL-3.0", "url": "https://proycon.github.io/clam", diff --git a/setup.py b/setup.py index 7f952afa..39569061 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read(fname): setup( name = "CLAM", - version = "2.4.5", #also change in clam.common.data.VERSION and dispatcher.py and codemeta.json + version = "2.4.6", #also change in clam.common.data.VERSION and dispatcher.py and codemeta.json author = "Maarten van Gompel", author_email = "proycon@anaproy.nl", description = ("Turns command-line NLP tools into fully-fledged RESTful webservices with an auto-generated web-interface for human end-users."), From df9c6f00104d6ad63dab41f1ad26ad425d2b830f Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Wed, 21 Aug 2019 20:16:26 +0200 Subject: [PATCH 2/2] attempted fix for problem in forward viewer (LanguageMachines/PICCL#51) --- clam/clamdispatcher.py | 2 +- clam/common/data.py | 2 +- clam/common/viewers.py | 2 +- codemeta.json | 2 +- setup.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clam/clamdispatcher.py b/clam/clamdispatcher.py index 63dccedc..76a8a113 100755 --- a/clam/clamdispatcher.py +++ b/clam/clamdispatcher.py @@ -25,7 +25,7 @@ import signal import shutil -VERSION = '2.4.6' +VERSION = '2.4.7' sys.path.append(sys.path[0] + '/..') diff --git a/clam/common/data.py b/clam/common/data.py index 5280aa7e..7054a8d0 100644 --- a/clam/common/data.py +++ b/clam/common/data.py @@ -37,7 +37,7 @@ import clam.common.util import clam.common.viewers -VERSION = '2.4.6' +VERSION = '2.4.7' #dirs for services shipped with CLAM itself CONFIGDIR = os.path.abspath(os.path.dirname(__file__) + '/../config/') diff --git a/clam/common/viewers.py b/clam/common/viewers.py index 424ec86b..505cd2d1 100644 --- a/clam/common/viewers.py +++ b/clam/common/viewers.py @@ -64,7 +64,7 @@ def __init__(self, id, name, forwarder, **kwargs): super(ForwardViewer,self).__init__(**kwargs) def view(self, file, **kwargs): - self.forwarder(None, file) + self.forwarder(None, None, outputfile=file) #this sets the forwardlink on the instance r = requests.get(self.forwarder.forwardlink, allow_redirects=True) if r.status_code == 302 and 'Location' in r.headers: url = r.headers['Location'] diff --git a/codemeta.json b/codemeta.json index 3bb3a5dc..b91187dc 100644 --- a/codemeta.json +++ b/codemeta.json @@ -10,7 +10,7 @@ "@type": "SoftwareSourceCode", "identifier": "clam", "name": "CLAM", - "version": "2.4.6", + "version": "2.4.7", "description": "Quickly turn command-line applications into RESTful webservices with a web-application front-end. You provide a specification of your command line application, its input, output and parameters, and CLAM wraps around your application to form a fully fledged RESTful webservice. ", "license": "https://spdx.org/licenses/GPL-3.0", "url": "https://proycon.github.io/clam", diff --git a/setup.py b/setup.py index 39569061..aadc2225 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read(fname): setup( name = "CLAM", - version = "2.4.6", #also change in clam.common.data.VERSION and dispatcher.py and codemeta.json + version = "2.4.7", #also change in clam.common.data.VERSION and dispatcher.py and codemeta.json author = "Maarten van Gompel", author_email = "proycon@anaproy.nl", description = ("Turns command-line NLP tools into fully-fledged RESTful webservices with an auto-generated web-interface for human end-users."),