##// END OF EJS Templates
exc_tracker: allow setting custom store via .ini file...
marcink -
r3019:e2100892 stable
parent child Browse files
Show More
@@ -292,6 +292,10 b' supervisor.group_id = dev'
292 292 ## Display extended labs settings
293 293 labs_settings_active = true
294 294
295 ## custom exception store path, defaults to TMPDIR
296 exception_store_path =
297
298
295 299 ####################################
296 300 ### CELERY CONFIG ####
297 301 ####################################
@@ -267,6 +267,10 b' supervisor.group_id = prod'
267 267 ## Display extended labs settings
268 268 labs_settings_active = true
269 269
270 ## custom exception store path, defaults to TMPDIR
271 exception_store_path =
272
273
270 274 ####################################
271 275 ### CELERY CONFIG ####
272 276 ####################################
@@ -73,10 +73,16 b' class ExceptionsTrackerView(BaseAppView)'
73 73
74 74 if read_metadata:
75 75 full_path = os.path.join(exc_store_path, fname)
76 # we can read our metadata
77 with open(full_path, 'rb') as f:
78 exc_metadata = exc_tracking.exc_unserialize(f.read())
79 exc.update(exc_metadata)
76 if not os.path.isfile(full_path):
77 continue
78 try:
79 # we can read our metadata
80 with open(full_path, 'rb') as f:
81 exc_metadata = exc_tracking.exc_unserialize(f.read())
82 exc.update(exc_metadata)
83 except Exception:
84 log.exception('Failed to read exc data from:{}'.format(full_path))
85 pass
80 86
81 87 # convert our timestamp to a date obj, for nicer representation
82 88 exc['exc_utc_date'] = time_to_utcdatetime(exc['exc_timestamp'])
@@ -436,6 +436,7 b' def _sanitize_vcs_settings(settings):'
436 436
437 437
438 438 def _sanitize_cache_settings(settings):
439
439 440 default_cache_dir = os.path.join(tempfile.gettempdir(), 'rc_cache')
440 441
441 442 # save default, cache dir, and use it for all backends later.
@@ -448,6 +449,12 b' def _sanitize_cache_settings(settings):'
448 449 if not os.path.isdir(default_cache_dir):
449 450 os.makedirs(default_cache_dir, mode=0755)
450 451
452 # exception store cache
453 _string_setting(
454 settings,
455 'exception_store_path',
456 default_cache_dir, lower=False)
457
451 458 # cache_perms
452 459 _string_setting(
453 460 settings,
@@ -31,6 +31,7 b' log = logging.getLogger(__name__)'
31 31
32 32 # NOTE: Any changes should be synced with exc_tracking at vcsserver.lib.exc_tracking
33 33 global_prefix = 'rhodecode'
34 exc_store_dir_name = 'rc_exception_store_v1'
34 35
35 36
36 37 def exc_serialize(exc_id, tb, exc_type):
@@ -54,13 +55,10 b' def get_exc_store():'
54 55 """
55 56 Get and create exception store if it's not existing
56 57 """
57 exc_store_dir = 'rc_exception_store_v1'
58 # fallback
59 _exc_store_path = os.path.join(tempfile.gettempdir(), exc_store_dir)
58 import rhodecode as app
60 59
61 exc_store_dir = '' # TODO: need a persistent cross instance store here
62 if exc_store_dir:
63 _exc_store_path = os.path.join(exc_store_dir, exc_store_dir)
60 exc_store_dir = app.CONFIG.get('exception_store_path', '') or tempfile.gettempdir()
61 _exc_store_path = os.path.join(exc_store_dir, exc_store_dir_name)
64 62
65 63 _exc_store_path = os.path.abspath(_exc_store_path)
66 64 if not os.path.isdir(_exc_store_path):
General Comments 0
You need to be logged in to leave comments. Login now