Changeset 6976


Ignore:
Timestamp:
10/06/10 22:05:28 (9 years ago)
Author:
astephen
Message:

fixes to chain processes

Location:
cows_wps/trunk
Files:
7 edited

Legend:

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

    r6975 r6976  
    125125        for (i, item) in enumerate(items): 
    126126            x = job_details.find("{" + self.namespace +  "}" + item).text 
    127             if type(x) != str: x = "Undefined" 
     127            if type(x) != str:  
     128                x = "Undefined" 
     129 
     130            x = x.strip() 
     131            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&StationsFileURL=%s">Use stations to extract UK weather data</a>' % file_set_list[0].find("{" + self.namespace +  "}FileURL").text) 
     134  
    128135            resp += "<b>%s</b> = %s<br>" % (mapped_names[i], x.strip()) 
    129136 
  • cows_wps/trunk/cows_wps/controllers/submit.py

    r6955 r6976  
    9999            return "Please provide an argument proc_id=&lt;Something&gt;" 
    100100 
     101        args = {} 
     102        for (k, v) in request.params.items(): 
     103            if str(k) == "proc_id": continue 
     104            args[str(k)] = str(v)  
     105 
    101106        pc = ProcConfig() 
    102         proc_submission_form_html = pc.renderProcSubmissionForm(proc) 
     107        proc_submission_form_html = pc.renderProcSubmissionForm(proc, args) 
    103108        bbox_required = pc.bbox_arg_found 
    104109        resp = proc_submission_form_html 
  • cows_wps/trunk/cows_wps/lib/ui/proc_config.py

    r6923 r6976  
    127127        return resp 
    128128 
    129     def renderProcSubmissionForm(self, proc): 
     129    def renderProcSubmissionForm(self, proc, args): 
    130130        """         
    131131        Renders a submission form for a proc. 
     132        Populates items with args dictionary if they exist. 
    132133        """ 
    133134        pcc = ProcConfigConvertor() 
     
    197198                    instruction += " Please insert a date/time field in the format <kbd><B>YYYY-MM-DDThh:mm:ss</B></kbd> such as <kbd>2009-01-01T00:00:00</kbd>." 
    198199                else: 
     200                    if args.has_key(name): 
     201                        default = args[name] 
     202 
    199203                    instruction += " Please insert a value of type: %s." % tp 
    200204 
    201                 resp += fm.renderTextInput(name, dtype=tp, optional=opt, default=default, multiple=multiple) 
     205                resp += fm.renderTextInput(name, dtype = tp, optional = opt, default = default, multiple = multiple) 
    202206            
    203207            elif tp == "filepath": 
  • cows_wps/trunk/process_configs/ExtractUKStationData.ini

    r6947 r6976  
    3636StationIDs.length = 1-20000 
    3737StationIDs.optional = True 
     38StationsFileURL = string 
     39StationsFileURL.optional = True 
    3840ObsTableName = string 
    3941ObsTableName.possible_values = TD,WD,RD,RS,TH,WM,WH,RO 
  • cows_wps/trunk/process_configs/GetWeatherStations.ini

    r6947 r6976  
    11[wps_interface] 
    22process_callable = process_modules.get_weather_stations#GetWeatherStations 
    3 process_type = async_s 
     3process_type = sync 
    44dry_run_enabled = False 
    55internal = False 
  • cows_wps/trunk/process_modules/extract_uk_station_data.py

    r6948 r6976  
    4646 
    4747        ObsTableName = ci['ObsTableName']  
     48        StationsFileURL = ci['StationsFileURL'] 
    4849 
    4950        context.setStatus(STATUS.STARTED, 'Job is now running', 0) 
     
    5455        stations_file = "uk_stations.txt" 
    5556        sf_path = context.processDir + '/outputs/' + stations_file 
     57 
     58        # Download stations file and read it if possible 
     59        if StationsFileURL: 
     60            stationIDs = exuk_utils.downloadFileAndExtractStations(StationsFileURL) 
    5661 
    5762        # Get station IDs if not provided 
  • cows_wps/trunk/process_modules/lib_extract_uk_station_data/utils.py

    r6873 r6976  
    88 
    99import os, stat, time, sys 
     10import urllib 
    1011 
    1112from cows_wps.utils.duration_splitter import * 
     
    5758         
    5859    return output_file_paths 
     60 
     61 
     62def downloadFileAndExtractStations(url): 
     63    """ 
     64    Downloads file and extracts stations to a list. 
     65    """ 
     66    f = urllib.urlopen(url) 
     67    data = f.read() 
     68    f.close() 
     69 
     70    station_ids = data.split()  
     71    return station_ids 
Note: See TracChangeset for help on using the changeset viewer.