Commit 1cc84ff1 authored by Gerald Salin's avatar Gerald Salin
Browse files

Merge branch 'set_log_level_gerald' into 'master'

Set log level + ssl config for jflow server

See merge request !2
parents 5c27b16c 75ec9678
......@@ -32,6 +32,10 @@ server_socket_port = 8080
date_format = %d/%m/%Y
# debug
debug = False
#optional : key for jflow server ssl configuration
ssl_certificate = certificate.crt
ssl_certificate_chain = certificate_chain.crt
ssl_private_key = private_key.key
[email]
# if you want an email to be sent at the end of the workflow execution
......@@ -52,6 +56,8 @@ from_password =
# In this section, ###USER### (if it's used) is replaced by $USER environment variable.
# where should be written the log file
log_file = <path>/jflow.log
#level of logs to display in log_file
log_level= logging.DEBUG|logging.WARNING|logging.ERROR|...
# Where should the pipelines write results, should be accessible
# by all cluster nodes
work_directory = <path>/work
......@@ -68,7 +74,8 @@ browse_root_dir = <path>
# Set cluster parameters of some components
[components]
#Trim_porechop.batch_options = --mem=4G -p wflowq -t 30
#Trim_porechop.modules = compiler/gcc-7.2.0,bioinfo/Porechop-0.2.1
# Set workflows group
[workflows]
......@@ -30,7 +30,7 @@ log_directory = os.path.dirname(jflowconf.get_log_file_path())
if not os.path.isdir(log_directory):
os.makedirs(log_directory, 0o751)
logging.basicConfig(level=logging.DEBUG,
logging.basicConfig(level=eval(jflowconf.get_log_level(),
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M',
filename=jflowconf.get_log_file_path(),
......
......@@ -63,6 +63,7 @@ class Component(object):
# in case of SGE, parse the cpu and memory parameter
self.__cpu=None
self.__memory=None
self.__memory_per_cpu=None
type, options, limit_submission = self.config_reader.get_batch()
if type.lower() == "sge" :
try:
......@@ -78,6 +79,16 @@ class Component(object):
try:
self.__memory = re.match( r'.*\s?mem=(\d+\w)\s?.*', self.batch_options).group(1)
except: pass
elif type.lower() == "slurm" :
try:
self.__cpu = int(re.match( r'.*-c\s+(\d+).*', self.batch_options).group(1))
except: pass
try:
self.__memory = re.match( r'.*--mem=(\d+\S+)\s?.*', self.batch_options).group(1)
except: pass
try:
self.__memory_per_cpu = re.match( r'.*--mem-per-cpu=(\d+\S+)\s?.*', self.batch_options).group(1)
except: pass
def get_prefix(self):
return self.__prefix
......@@ -93,6 +104,9 @@ class Component(object):
def get_memory(self):
return self.__memory
def get_memory_per_cpu(self):
return self.__memory_per_cpu
def is_dynamic(self):
return len(self.get_dynamic_outputs()) != 0
......
......@@ -73,7 +73,16 @@ class JFlowConfigReader(object):
except :
raise NoOptionError("Failed when parsing the config file, no section logging found!")
def get_log_level(self):
"""
return the level of log
@return: the level of logging (logging.DEBUG, logging.WARNING....
"""
try:
return self.reader.get('storage', 'log_level')
except :
raise Error("Failed when parsing the config file !")
def get_makeflow_path(self):
try:
exec_path = self.reader.get("global", "makeflow")
......@@ -106,7 +115,12 @@ class JFlowConfigReader(object):
return [self.reader.get("global", "server_socket_host"), int(self.reader.get("global", "server_socket_port"))]
except:
return ["127.0.0.1", 8080]
def get_ssl_files(self):
try:
return [self.reader.get("global", "ssl_certificate"), self.reader.get("global", "ssl_certificate_chain"),self.reader.get("global", "ssl_private_key")]
except:
return []
def get_email_options(self):
try: smtps = self.reader.get("email", "smtp_server")
except: smtps = None
......
......@@ -162,6 +162,12 @@ class JFlowServer (object):
cherrypy.config.update({'server.socket_host': socket_opts[0],
'server.socket_port': socket_opts[1]})
if len(ssl_opts)==3:
cherrypy.config.update({'server.ssl_module': 'builtin',
'server.ssl_certificate': ssl_opts[0],
'server.ssl_certificate_chain': ssl_opts[1],
'server.ssl_private_key': ssl_opts[2]})
# start the server
cherrypy.quickstart(server_class(), config=config)
......
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