Ignore:
Timestamp:
25/06/10 08:54:43 (11 years ago)
Author:
astephen
Message:

getting status monitoring working properly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cows_wps/trunk/process_modules/lib_extract_uk_station_data/utils.py

    r7010 r7082  
    1010import urllib 
    1111 
     12from cows_wps.process_handler.context.process_status import STATUS 
    1213from cows_wps.utils.duration_splitter import * 
    1314 
     
    1920 
    2021def extractStationDataByTimeChunk(obs_tables, startTime, endTime, src_ids, time_chunk,  
    21                     output_file_base, delimiter, ext, tempDir): 
     22                    output_file_base, delimiter, ext, tempDir, context): 
    2223    """ 
    2324    Loops through time chunks extracting data to files in required time chunks. 
     25    We pass the context object through here so that we can report progress. 
    2426    Returns a list of output file paths produced. 
    2527    """  
     
    3537    output_file_paths = [] 
    3638 
     39    progress = 5 # % of way through 
    3740    for (start_date, end_date) in time_splits:  
    3841 
     
    5659        midasSubsetter.MIDASSubsetter(obs_tables, output_file_path, startTime = start, 
    5760                       endTime = end, src_ids = src_ids, delimiter = delimiter, tempDir = tempDir) 
     61 
     62        # Report on progress 
     63        progress += (int(list(time_splits).index((start_date, end_date)) / len(time_splits)) * 100 - 5) 
     64        context.setStatus(STATUS.STARTED, 'Job is now running', progress) 
    5865         
    5966    return output_file_paths 
Note: See TracChangeset for help on using the changeset viewer.