本文整理汇总了Python中tvb.basic.logger.builder.get_logger函数的典型用法代码示例。如果您正苦于以下问题:Python get_logger函数的具体用法?Python get_logger怎么用?Python get_logger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_logger函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: deco
def deco(*a, **b):
try:
return func(*a, **b)
except common.NotAllowed as ex:
log = get_logger(_LOGGER_NAME)
log.error(str(ex))
if redirect:
common.set_error_message(str(ex))
raise cherrypy.HTTPRedirect(ex.redirect_url)
else:
raise cherrypy.HTTPError(ex.status, str(ex))
except cherrypy.HTTPRedirect as ex:
if redirect:
raise
else:
log = get_logger(_LOGGER_NAME)
log.warn('Redirect converted to error: ' + str(ex))
# should we do this? Are browsers following redirects in ajax?
raise cherrypy.HTTPError(500, str(ex))
except Exception:
log = get_logger(_LOGGER_NAME)
log.exception('An unexpected exception appeared')
if redirect:
# set a default error message if one has not been set already
if not common.has_error_message():
common.set_error_message("An unexpected exception appeared. Please check the log files.")
raise cherrypy.HTTPRedirect("/tvb?error=True")
else:
raise
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:35,代码来源:decorators.py
示例2: upgrade
def upgrade(migrate_engine):
"""
Upgrade operations go here.
Don't create your own engine; bind migrate_engine to your metadata.
"""
meta.bind = migrate_engine
table = meta.tables['DATA_TYPES_GROUPS']
create_column(COL_RANGES_1, table)
create_column(COL_RANGES_2, table)
try:
## Iterate DataTypeGroups from previous code-versions and try to update value for the new column.
previous_groups = dao.get_generic_entity(model.DataTypeGroup, "0", "no_of_ranges")
for group in previous_groups:
operation_group = dao.get_operationgroup_by_id(group.fk_operation_group)
#group.only_numeric_ranges = operation_group.has_only_numeric_ranges
if operation_group.range3 is not None:
group.no_of_ranges = 3
elif operation_group.range2 is not None:
group.no_of_ranges = 2
elif operation_group.range1 is not None:
group.no_of_ranges = 1
else:
group.no_of_ranges = 0
dao.store_entity(group)
except Exception as excep:
## we can live with a column only having default value. We will not stop the startup.
logger = get_logger(__name__)
logger.exception(excep)
session = SA_SESSIONMAKER()
session.execute(text("""UPDATE "OPERATIONS"
SET status =
CASE
WHEN status = 'FINISHED' THEN '4-FINISHED'
WHEN status = 'STARTED' THEN '3-STARTED'
WHEN status = 'CANCELED' THEN '2-CANCELED'
ELSE '1-ERROR'
END
WHERE status IN ('FINISHED', 'CANCELED', 'STARTED', 'ERROR');"""))
session.commit()
session.close()
try:
session = SA_SESSIONMAKER()
for sim_state in session.query(SimulationState).filter(SimulationState.fk_datatype_group is not None).all():
session.delete(sim_state)
session.commit()
session.close()
except Exception as excep:
## It might happen that SimulationState table is not yet created, e.g. if user has version 1.0.2
logger = get_logger(__name__)
logger.exception(excep)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:59,代码来源:004_update_db.py
示例3: prepare_adapter
def prepare_adapter(adapter_class):
"""
Having a subclass of ABCAdapter, prepare an instance for launching an operation with it.
"""
try:
if not issubclass(adapter_class, ABCAdapter):
raise IntrospectionException("Invalid data type: It should extend adapters.ABCAdapter!")
algo_group = dao.find_group(adapter_class.__module__, adapter_class.__name__)
adapter_instance = adapter_class()
adapter_instance.algorithm_group = algo_group
return adapter_instance
except Exception, excep:
get_logger("ABCAdapter").exception(excep)
raise IntrospectionException(str(excep))
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:15,代码来源:abcadapter.py
示例4: __init__
def __init__(self):
self.logger = get_logger(self.__class__.__module__)
self.user_service = UserService()
self.flow_service = FlowService()
analyze_category = self.flow_service.get_launchable_non_viewers()
self.analyze_category_link = '/flow/step/' + str(analyze_category.id)
self.analyze_adapters = None
self.connectivity_tab_link = '/flow/step_connectivity'
view_category = self.flow_service.get_visualisers_category()
conn_id = self.flow_service.get_algorithm_by_module_and_class(CONNECTIVITY_MODULE, CONNECTIVITY_CLASS)[1].id
connectivity_link = self.get_url_adapter(view_category.id, conn_id)
self.connectivity_submenu = [dict(title="Large Scale Connectivity", subsection="connectivity",
description="View Connectivity Regions. Perform Connectivity lesions",
link=connectivity_link),
dict(title="Local Connectivity", subsection="local",
link='/spatial/localconnectivity/step_1/1',
description="Create or view existent Local Connectivity entities.")]
self.burst_submenu = [dict(link='/burst', subsection='burst',
title='Simulation Cockpit', description='Manage simulations'),
dict(link='/burst/dynamic', subsection='dynamic',
title='Phase plane', description='Configure model dynamics')]
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:25,代码来源:base_controller.py
示例5: __init__
def __init__(self):
self.logger = get_logger(self.__class__.__module__)
self.user_service = UserService()
self.flow_service = FlowService()
self.analyze_category_link = '/flow/step_analyzers'
self.analyze_adapters = None
self.connectivity_tab_link = '/flow/step_connectivity'
view_category = self.flow_service.get_visualisers_category()
conn_id = self.flow_service.get_algorithm_by_module_and_class(CONNECTIVITY_MODULE, CONNECTIVITY_CLASS).id
connectivity_link = self.get_url_adapter(view_category.id, conn_id)
self.connectivity_submenu = [dict(title="Large Scale Connectivity", link=connectivity_link,
subsection=WebStructure.SUB_SECTION_CONNECTIVITY,
description="View Connectivity Regions. Perform Connectivity lesions"),
dict(title="Local Connectivity", link='/spatial/localconnectivity/step_1/1',
subsection=WebStructure.SUB_SECTION_LOCAL_CONNECTIVITY,
description="Create or view existent Local Connectivity entities.")]
allen_algo = self.flow_service.get_algorithm_by_module_and_class(ALLEN_CREATOR_MODULE, ALLEN_CREATOR_CLASS)
if allen_algo:
# Only add the Allen Creator if AllenSDK is installed
allen_link = self.get_url_adapter(allen_algo.fk_category, allen_algo.id)
self.connectivity_submenu.append(dict(title="Allen Connectome Downloader", link=allen_link,
subsection=WebStructure.SUB_SECTION_ALLEN,
description="Download a mouse connectivity from Allen dataset"))
self.burst_submenu = [dict(link='/burst', subsection=WebStructure.SUB_SECTION_BURST,
title='Simulation Cockpit', description='Manage simulations'),
dict(link='/burst/dynamic', subsection='dynamic',
title='Phase plane', description='Configure model dynamics')]
开发者ID:gummadhav,项目名称:tvb-framework,代码行数:33,代码来源:base_controller.py
示例6: __init__
def __init__(self, conf):
"""
:param conf: burst configuration entity
"""
self.logger = get_logger(__name__)
self.flow_service = FlowService()
self.conf = conf
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:7,代码来源:burst_config_serialization.py
示例7: upgrade
def upgrade(migrate_engine):
"""
Upgrade operations go here.
Don't create your own engine; bind migrate_engine to your metadata.
"""
try:
meta.bind = migrate_engine
table1 = meta.tables['MAPPED_SURFACE_DATA']
create_column(COL_1, table1)
create_column(COL_2, table1)
create_column(COL_3, table1)
try:
session = SA_SESSIONMAKER()
session.execute(text("UPDATE \"DATA_TYPES\" SET invalid=1 WHERE exists "
"(SELECT * FROM \"MAPPED_SURFACE_DATA\" WHERE _number_of_split_slices > 1 "
"and \"DATA_TYPES\".id = \"MAPPED_SURFACE_DATA\".id)"))
session.commit()
session.close()
except ProgrammingError:
# PostgreSQL
session = SA_SESSIONMAKER()
session.execute(text("UPDATE \"DATA_TYPES\" SET invalid=TRUE WHERE exists "
"(SELECT * FROM \"MAPPED_SURFACE_DATA\" WHERE _number_of_split_slices > 1 "
"and \"DATA_TYPES\".id = \"MAPPED_SURFACE_DATA\".id)"))
session.commit()
session.close()
except Exception:
logger = get_logger(__name__)
logger.exception("Cold not create new column required by the update")
raise
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:33,代码来源:009_update_db.py
示例8: __init__
def __init__(self, obj_file):
"""
Create a surface from an obj file
"""
self.logger = get_logger(__name__)
try:
obj = ObjParser()
obj.read(obj_file)
self.triangles = []
self.vertices = obj.vertices
self.normals = [(0.0, 0.0, 0.0)] * len(self.vertices)
self.have_normals = len(obj.normals)
for face in obj.faces:
triangles = self._triangulate(face)
for v_idx, t_idx, n_idx in triangles:
self.triangles.append(v_idx)
if n_idx != -1:
# last normal index wins
# alternative: self.normals[v_idx] += obj.normals[n_idx]
# The correct behaviour is to duplicate the vertex
# self.vertices.append(self.vertices[v_idx])
# self.tex_coords.append(self.tex_coords[v_idx])
self.normals[v_idx] = obj.normals[n_idx]
# checks
if not self.vertices or not self.triangles:
raise ParseException("No geometry data in file.")
self._to_numpy()
except ValueError as ex:
self.logger.exception(" Error in obj")
raise ParseException(str(ex))
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:33,代码来源:surface.py
示例9: __init__
def __init__(self, tvb_root_folder, dist_folder, library_path):
"""
Creates a new instance.
:param tvb_root_folder: root tvb folder.
:param dist_folder: folder where distribution is built.
:param library_path: folder where TVB code is put into final distribution.
"""
self.logger = get_logger(self.__class__.__name__)
self._dist_folder = dist_folder
self._tvb_root_folder = tvb_root_folder
self._manuals_folder = os.path.join(tvb_root_folder, self.DOCS_SRC, self.MANUALS)
self._styles_folder = os.path.join(self._manuals_folder, self.STYLES)
# Folders where to store results
self._dist_docs_folder = os.path.join(self._dist_folder, self.DOCS)
self._dist_api_folder = os.path.join(self._dist_folder, self.API)
self._dist_online_help_folder = os.path.join(library_path, self.ONLINE_HELP)
self._dist_styles_folder = os.path.join(self._dist_online_help_folder, self.STYLES)
# Check if folders exist. If not create them
if not os.path.exists(self._dist_docs_folder):
os.makedirs(self._dist_docs_folder)
if os.path.exists(self._dist_online_help_folder):
shutil.rmtree(self._dist_online_help_folder)
if not os.path.exists(self._dist_api_folder):
os.makedirs(self._dist_api_folder)
os.makedirs(self._dist_online_help_folder)
开发者ID:maedoc,项目名称:tvb-documentation,代码行数:27,代码来源:doc_generator.py
示例10: launch
def launch(self, data_file, apply_corrections=False, mappings_file=None, connectivity=None):
"""
Execute import operations:
"""
self.data_file = data_file
try:
self.parser = NIFTIParser(data_file)
volume = self._create_volume()
if connectivity:
rm = self._create_region_map(volume, connectivity, apply_corrections, mappings_file)
return [volume, rm]
if self.parser.has_time_dimension:
time_series = self._create_time_series(volume)
return [volume, time_series]
# no connectivity and no time
mri = self._create_mri(volume)
return [volume, mri]
except ParseException as excep:
logger = get_logger(__name__)
logger.exception(excep)
raise LaunchException(excep)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:27,代码来源:nifti_importer.py
示例11: __init__
def __init__(self, data_file):
self.logger = get_logger(__name__)
if data_file is None:
raise ParseException("Please select NIFTI file which contains data to import")
if not os.path.exists(data_file):
raise ParseException("Provided file %s does not exists" % data_file)
try:
self.nifti_image = nib.load(data_file)
except nib.spatialimages.ImageFileError as e:
self.logger.exception(e)
msg = "File: %s does not have a valid NIFTI-1 format." % data_file
raise ParseException(msg)
nifti_image_hdr = self.nifti_image.get_header()
# Check if there is a time dimensions (4th dimension).
nifti_data_shape = nifti_image_hdr.get_data_shape()
self.has_time_dimension = len(nifti_data_shape) > 3
self.time_dim_size = nifti_data_shape[3] if self.has_time_dimension else 1
# Extract sample unit measure
self.units = nifti_image_hdr.get_xyzt_units()
# Usually zooms defines values for x, y, z, time and other dimensions
self.zooms = nifti_image_hdr.get_zooms()
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:29,代码来源:parser.py
示例12: do_operation_launch
def do_operation_launch(operation_id):
"""
Event attached to the local queue for executing an operation, when we will have resources available.
"""
LOGGER = get_logger('tvb.core.operation_async_launcher')
try:
LOGGER.debug("Loading operation with id=%s" % operation_id)
curent_operation = dao.get_operation_by_id(operation_id)
stored_adapter = curent_operation.algorithm
LOGGER.debug("Importing Algorithm: " + str(stored_adapter.classname) +
" for Operation:" + str(curent_operation.id))
PARAMS = parse_json_parameters(curent_operation.parameters)
adapter_instance = ABCAdapter.build_adapter(stored_adapter)
## Un-comment bellow for profiling an operation:
## import cherrypy.lib.profiler as profiler
## p = profiler.Profiler("/Users/lia.domide/TVB/profiler/")
## p.run(OperationService().initiate_prelaunch, curent_operation, adapter_instance, {}, **PARAMS)
OperationService().initiate_prelaunch(curent_operation, adapter_instance, {}, **PARAMS)
LOGGER.debug("Successfully finished operation " + str(operation_id))
except Exception as excep:
LOGGER.error("Could not execute operation " + str(sys.argv[1]))
LOGGER.exception(excep)
parent_burst = dao.get_burst_for_operation_id(operation_id)
if parent_burst is not None:
WorkflowService().mark_burst_finished(parent_burst, error_message=str(excep))
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:29,代码来源:operation_async_launcher.py
示例13: get_matlab_executable
def get_matlab_executable():
"""
Check If MATLAB is installed on current system.
Return True or False.
Return True, when MATLAB executable is found in Path.
"""
matlab_exe_path = None
if sys.platform.startswith('win'):
split_char = ";"
octave_exec = OCTAVE + ".exe"
matlab_exec = MATLAB + ".exe"
else:
split_char = ":"
octave_exec = OCTAVE
matlab_exec = MATLAB
logger = get_logger(__name__)
logger.debug("Searching Matlab in path: " + str(os.environ["PATH"]))
for path in os.environ["PATH"].split(split_char):
if os.path.isfile(os.path.join(path, matlab_exec)):
matlab_exe_path = os.path.join(path, matlab_exec)
logger.debug("MATLAB was found:" + path)
return matlab_exe_path
for path in os.environ["PATH"].split(split_char):
if os.path.isfile(os.path.join(path, octave_exec)):
logger.debug("OCTAVE was found:" + path)
matlab_exe_path = os.path.join(path, octave_exec)
return matlab_exe_path
return matlab_exe_path
开发者ID:boegel,项目名称:tvb-framework,代码行数:28,代码来源:utils.py
示例14: upgrade
def upgrade(migrate_engine):
"""
Upgrade operations go here.
Don't create your own engine; bind migrate_engine to your metadata.
"""
meta.bind = migrate_engine
table = meta.tables['DATA_TYPES_GROUPS']
create_column(COL_RANGES_1, table)
create_column(COL_RANGES_2, table)
try:
## Iterate DataTypeGroups from previous code-versions and try to update value for the new column.
previous_groups = dao.get_generic_entity(model.DataTypeGroup, "0", "no_of_ranges")
for group in previous_groups:
operation_group = dao.get_operationgroup_by_id(group.fk_operation_group)
#group.only_numeric_ranges = operation_group.has_only_numeric_ranges
if operation_group.range3 is not None:
group.no_of_ranges = 3
elif operation_group.range2 is not None:
group.no_of_ranges = 2
elif operation_group.range1 is not None:
group.no_of_ranges = 1
else:
group.no_of_ranges = 0
dao.store_entity(group)
except Exception, excep:
## we can live with a column only having default value. We will not stop the startup.
logger = get_logger(__name__)
logger.exception(excep)
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:35,代码来源:004_update_db.py
示例15: get_logger
def get_logger(name):
try:
from tvb.basic.logger.builder import get_logger
return get_logger(__name__)
except ImportError:
import logging
return logging.getLogger(name)
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:7,代码来源:common.py
示例16: __init__
def __init__(self, model, integrator):
self.log = get_logger(self.__class__.__module__)
self.model = model
self.integrator = integrator
#Make sure the model is fully configured...
self.model.configure()
self.model.update_derived_parameters()
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:7,代码来源:phase_plane_interactive.py
示例17: build_adapter
def build_adapter(algo_group):
"""
Having a module and a class name, create an instance of ABCAdapter.
"""
logger = get_logger("ABCAdapter")
try:
ad_module = importlib.import_module(algo_group.module)
# This does no work for all adapters, so let it for manually choosing by developer
if TvbProfile.env.IS_WORK_IN_PROGRESS:
reload(ad_module)
logger.info("Reloaded %r", ad_module)
adapter = getattr(ad_module, algo_group.classname)
if algo_group.init_parameter is not None and len(algo_group.init_parameter) > 0:
adapter_instance = adapter(str(algo_group.init_parameter))
else:
adapter_instance = adapter()
if not isinstance(adapter_instance, ABCAdapter):
raise IntrospectionException("Invalid data type: It should extend adapters.ABCAdapter!")
adapter_instance.algorithm_group = algo_group
return adapter_instance
except Exception, excep:
logger.exception(excep)
raise IntrospectionException(str(excep))
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:25,代码来源:abcadapter.py
示例18: launch
def launch(self, data_file, surface=None):
"""
Execute import operations:
"""
if surface is None:
raise LaunchException("No surface selected. Please initiate upload again and select a brain surface.")
parser = GIFTIParser(self.storage_path, self.operation_id)
try:
time_series = parser.parse(data_file)
ts_data_shape = time_series.read_data_shape()
if surface.number_of_vertices != ts_data_shape[1]:
msg = "Imported time series doesn't have values for all surface vertices. Surface has %d vertices " \
"while time series has %d values." % (surface.number_of_vertices, ts_data_shape[1])
raise LaunchException(msg)
else:
time_series.surface = surface
return [time_series]
except ParseException, excep:
logger = get_logger(__name__)
logger.exception(excep)
raise LaunchException(excep)
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:25,代码来源:gifti_timeseries_importer.py
示例19: wrapper
def wrapper(*args, **kwargs):
log = get_logger(_LOGGER_NAME)
profile_file = func.__name__ + datetime.now().strftime("%d-%H-%M-%S.%f") + ".profile"
log.info("profiling function %s. Profile stored in %s" % (func.__name__, profile_file))
prof = cProfile.Profile()
ret = prof.runcall(func, *args, **kwargs)
prof.dump_stats(profile_file)
return ret
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:8,代码来源:decorators.py
示例20: __init__
def __init__(self):
BaseController.__init__(self)
self.flow_service = FlowService()
self.logger = get_logger(__name__)
editable_entities = [dict(link='/spatial/stimulus/region/step_1_submit/1/1', title='Region Stimulus',
subsection='regionstim', description='Create a new Stimulus on Region level'),
dict(link='/spatial/stimulus/surface/step_1_submit/1/1', title='Surface Stimulus',
subsection='surfacestim', description='Create a new Stimulus on Surface level')]
self.submenu_list = editable_entities
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:9,代码来源:base_spatio_temporal_controller.py
注:本文中的tvb.basic.logger.builder.get_logger函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论