Commit 619b5fc7 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

allow to config the cherrypy server

parent f673a436
......@@ -14,12 +14,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
[grid]
[global]
makeflow = /usr/bin/makeflow
# batch system type: local, condor, sge, moab, cluster, wq, hadoop, mpi-queue
batch_system_type = local
# add these options to all batch submit files
batch_options =
# on which socket host should run the web server
server_socket_host = 127.0.0.1
# on which socket port should run the web server
server_socket_port = 8080
[storage]
# where should be written the log file
......
......@@ -29,6 +29,7 @@ except ImportError:
sys.exc_clear()
from jflow.workflows_manager import WorkflowsManager
from jflow.config_reader import JFlowConfigReader
from jflow.workflow import Workflow
import jflow.utils as utils
from cctools.util import time_format
......@@ -159,7 +160,11 @@ if __name__ == '__main__':
if args["daemon"]:
from cherrypy.process.plugins import Daemonizer
Daemonizer(cherrypy.engine).subscribe()
# define the socket host and port
jflowconf = JFlowConfigReader()
socket_opts = jflowconf.get_socket_options()
cherrypy.config.update({'server.socket_host': socket_opts[0],
'server.socket_port': socket_opts[1]})
# start the server
cherrypy.quickstart(JFlowServer())
\ No newline at end of file
......@@ -57,18 +57,24 @@ class JFlowConfigReader(object):
def get_makeflow_path(self):
try:
return self.reader.get("grid", "makeflow")
return self.reader.get("global", "makeflow")
except NoOptionError, e:
return None
def get_batch(self):
try:
type = self.reader.get("grid", "batch_system_type")
options = self.reader.get("grid", "batch_options")
type = self.reader.get("global", "batch_system_type")
options = self.reader.get("global", "batch_options")
return [type, options]
except NoOptionError, e:
return None
def get_socket_options(self):
try:
return [self.reader.get("global", "server_socket_host"), self.reader.get("global", "server_socket_port")]
except:
return ["127.0.0.1", "8080"]
def get_component_batch_options(self, component_class):
try:
return self.reader.get("components", component_class+".batch_options")
......
Supports Markdown
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