コード例 #1
0
ファイル: tasks.py プロジェクト: dpretty/h1ds-summary
def get_sync_info():
    sync_info = {'do_sync':False,
                 'latest_h1ds_shot':None,
                 'latest_sql_shot':None,
                 'time_since_last_mod':None,
                 }
    # get time since last summary table modification...
    sync_info['time_since_last_mod'] = time_since_last_summary_table_modification()
    #print sync_info['time_since_last_mod']
    shot_manager = backend_shot_manager()
    if sync_info['time_since_last_mod'] > sync_timedelta:
        # Check if the latest summary table shot is up to date.
        sync_info['latest_h1ds_shot'] = shot_manager.get_latest_shot()
        sync_info['latest_sql_shot'] = max(get_latest_shot_from_summary_table(), MINIMUM_SUMMARY_TABLE_SHOT)
        if sync_info['latest_sql_shot'] < sync_info['latest_h1ds_shot']:
            sync_info['do_sync'] = True
    return sync_info
コード例 #2
0
def get_sync_info():
    sync_info = {
        'do_sync': False,
        'latest_h1ds_shot': None,
        'latest_sql_shot': None,
        'time_since_last_mod': None,
    }
    # get time since last summary table modification...
    sync_info[
        'time_since_last_mod'] = time_since_last_summary_table_modification()
    #print sync_info['time_since_last_mod']
    shot_manager = backend_shot_manager()
    if sync_info['time_since_last_mod'] > sync_timedelta:
        # Check if the latest summary table shot is up to date.
        sync_info['latest_h1ds_shot'] = shot_manager.get_latest_shot()
        sync_info['latest_sql_shot'] = max(
            get_latest_shot_from_summary_table(), MINIMUM_SUMMARY_TABLE_SHOT)
        if sync_info['latest_sql_shot'] < sync_info['latest_h1ds_shot']:
            sync_info['do_sync'] = True
    return sync_info
コード例 #3
0
 def get(self, request, *args, **kwargs):
     latest_shot = get_latest_shot_from_summary_table()
     return HttpResponse('{"latest_shot":"%s"}' % latest_shot,
                         'application/javascript')
コード例 #4
0
ファイル: views.py プロジェクト: dpretty/h1ds-summary
 def get(self, request, *args, **kwargs):
     latest_shot = get_latest_shot_from_summary_table()
     return HttpResponse('{"latest_shot":"%s"}' %latest_shot, 'application/javascript')