Changeset 7003


Ignore:
Timestamp:
13/06/10 21:22:50 (9 years ago)
Author:
astephen
Message:

passing info from one proc to another

Location:
cows_wps/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cows_wps/trunk/cows_wps/controllers/jobviewer.py

    r7000 r7003  
    1616from cows_wps.controllers import * 
    1717from cows_wps import utils 
     18from cows_wps.utils.common import * 
    1819from cows_wps.renderer.ui_renderer import * 
    1920from cows_wps.model.managers import requestManager 
     
    130131            x = x.strip() 
    131132            if item == "JobCapabilities" and x.find("send_to_extract_weather_data") > -1: 
    132                 x = x.replace("send_to_extract_weather_data",  
    133                   '<a href="/submit/form?proc_id=ExtractUKStationData&StationsFile=%s">Use stations to extract UK weather data</a>' % file_set_list[0].find("{" + self.namespace +  "}FileURL").text) 
     133                file_url = file_set_list[0].find("{" + self.namespace +  "}FileURL").text 
     134#                x = x.replace("send_to_extract_weather_data",  
     135#                  '<a href="/submit/form?proc_id=ExtractUKStationData&StationsFile=%s">Use stations to extract UK weather data</a>' % file_url) 
     136                file_path = mapDownloadURLToFilePath(file_url) 
     137                x = x.replace("send_to_extract_weather_data", 
     138                  '<a href="/submit/form?proc_id=ExtractUKStationData&StationsFile=%s">Use stations to extract UK weather data</a>' % file_path)  
    134139  
    135140            resp += "<b>%s</b> = %s<br>" % (mapped_names[i], x.strip()) 
  • cows_wps/trunk/cows_wps/utils/common.py

    r7000 r7003  
    270270 
    271271def mapDownloadURLToFilePath(url): 
     272    from cows_wps.model.managers import requestManager 
    272273    items = url.split("/") 
    273274    (job_id, file_name) = items[-2:] 
    274     req = requestManager.getRequest(jobId, sgeUpdate=False) 
    275     processDir = req.job.process_dir 
    276 #    identifier = req.job.process 
    277  
     275    req = requestManager.getRequest(job_id, sgeUpdate=False) 
     276    process_dir = req.job.process_dir 
     277    fpath = os.path.join(process_dir, "outputs", file_name) 
     278    return fpath 
    278279 
    279280 
    280281if __name__ == "__main__": 
    281282 
    282     print generateDownloadURL("/disks/westerly1/test_dirs/proc_outputs/help/outputs/ukcp09_wxgen_help_007.nc") 
     283    print generateDownloadURL("/disks/westerly1/test_dirs/proc_outputs/help/outputs/help_007.nc") 
    283284    for i in "abcde": print getUniqueId(i)  
    284285 
  • cows_wps/trunk/process_configs/ExtractUKStationData.ini

    r7002 r7003  
    3636StationIDs.length = 1-20000 
    3737StationIDs.optional = True 
    38 StationsFileURL = string 
    39 StationsFileURL.optional = True 
     38StationsFile = string 
     39StationsFile.optional = True 
    4040ObsTableName = string 
    4141ObsTableName.possible_values = TD,WD,RD,RS,TH,WM,WH,RO 
  • cows_wps/trunk/process_modules/extract_uk_station_data.py

    r6976 r7003  
    4646 
    4747        ObsTableName = ci['ObsTableName']  
    48         StationsFileURL = ci['StationsFileURL'] 
     48        StationsFile = ci['StationsFile'] 
    4949 
    5050        context.setStatus(STATUS.STARTED, 'Job is now running', 0) 
     
    5757 
    5858        # Download stations file and read it if possible 
    59         if StationsFileURL: 
    60             stationIDs = exuk_utils.downloadFileAndExtractStations(StationsFileURL) 
     59        if StationsFile: 
     60            stationIDs = exuk_utils.extractStationsFromFile(StationsFile) 
    6161 
    6262        # Get station IDs if not provided 
  • cows_wps/trunk/process_modules/lib_extract_uk_station_data/utils.py

    r7002 r7003  
    6060 
    6161 
    62 def readFileAndExtractStations(url): 
     62def extractStationsFromFile(fpath): 
    6363    """ 
    64     Downloads file and extracts stations to a list. 
     64    Reads file and extracts stations to a list. 
    6565    """ 
    66     #f = urllib.urlopen(url) 
    67     #data = f.read() 
    68     #f.close() 
     66    f = open(fpath) 
     67    data = f.read()  
     68    f.close() 
    6969 
    70     local_path = generateLocalFilePath(url) 
    7170    station_ids = data.split()  
    7271    return station_ids 
Note: See TracChangeset for help on using the changeset viewer.