Added logs
adding logs to investigate cache. learner-6943
This commit is contained in:
@@ -631,12 +631,18 @@ def _get_catalog_data_for_course(course_key):
|
||||
|
||||
catalog_data = {}
|
||||
course_run_fields = []
|
||||
log.info(u"language specific template is:{lang} and include hours of effort is:{hof} for the course:{course_key}"
|
||||
.format(lang=course_certificate_settings.language_specific_templates_enabled,
|
||||
hof=course_certificate_settings.include_hours_of_effort,
|
||||
course_key=course_key))
|
||||
if course_certificate_settings.language_specific_templates_enabled:
|
||||
course_run_fields.append('content_language')
|
||||
if course_certificate_settings.include_hours_of_effort:
|
||||
course_run_fields.extend(['weeks_to_complete', 'max_effort'])
|
||||
|
||||
if course_run_fields:
|
||||
log.info(u'requesting following fields:{course_run_fields} for the course:{course_key}'.
|
||||
format(course_run_fields=course_run_fields, course_key=course_key))
|
||||
course_run_data = get_course_run_details(course_key, course_run_fields)
|
||||
if course_run_data.get('weeks_to_complete') and course_run_data.get('max_effort'):
|
||||
try:
|
||||
|
||||
@@ -55,8 +55,9 @@ def get_edx_api_data(api_config, resource, api, resource_id=None, querystring=No
|
||||
|
||||
cached = cache.get(cache_key)
|
||||
if cached:
|
||||
log.info("Cached course run was returned for the course: {resource_id} and response is {cached} ".
|
||||
format(resource_id=resource_id, cached=zunpickle(cached)))
|
||||
log.info("Cached course run was returned for the course: {resource_id} using the key:{cache_key}"
|
||||
" and response is {cached} ".format(resource_id=resource_id, cache_key=cache_key,
|
||||
cached=zunpickle(cached)))
|
||||
return zunpickle(cached)
|
||||
|
||||
try:
|
||||
@@ -69,6 +70,8 @@ def get_edx_api_data(api_config, resource, api, resource_id=None, querystring=No
|
||||
|
||||
if resource_id is not None:
|
||||
if fields:
|
||||
log.info("Getting following fields:{fields} for the course:{resource_id}".format(
|
||||
fields=fields, resource_id=resource_id))
|
||||
results = get_fields(fields, response)
|
||||
else:
|
||||
results = response
|
||||
@@ -85,6 +88,8 @@ def get_edx_api_data(api_config, resource, api, resource_id=None, querystring=No
|
||||
cache_ttl = api_config.cache_ttl
|
||||
if long_term_cache:
|
||||
cache_ttl = api_config.long_term_cache_ttl
|
||||
log.info('setting cache for the course:{resource_id} with key:{cache_key} and results:{results}'.format(
|
||||
resource_id=resource_id, cache_key=cache_key, results=results))
|
||||
cache.set(cache_key, zdata, cache_ttl)
|
||||
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user