Changeset 6903


Ignore:
Timestamp:
28/05/10 14:23:27 (9 years ago)
Author:
astephen
Message:

various updates. Key thing to add next is polling of jobs and update of
response when it has polled correctly. Can re-use jquery stuff in
submit_utils.js which is relatively lightweight.

Location:
cows_wps/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cows_wps/trunk/config.ini

    r5615 r6903  
    1010smtp_server = localhost 
    1111error_email_from = paste@localhost 
     12securityConfigDir = %(here)s/../../ndg-security/etc 
     13beakerSessionKeyName = beaker.session.ndg.security 
     14authKitCookieSecret = MmUd8maSweeYsXkuwzzEK2vjq5pAqappeCZ74ZQ4OwU 
     15 
     16[pipeline:main] 
     17pipeline = BeakerSessionFilter  
     18           AuthenticationFilter  
     19           AuthorizationFilter  
     20           wpsApp 
    1221 
    1322############################################################################## 
     
    2332# Main WSGI application section 
    2433 
    25 [app:main] 
     34[app:wpsApp] 
    2635use = egg:cows_wps 
    2736full_stack = true 
    2837cache_dir = %(here)s/data 
     38 
    2939 
    3040# If behind a proxy uncomment this and edit the filter:proxy-prefix section 
     
    4252#!NOTE: wps.logs_dir is removed.  Use logging config section below 
    4353 
     54wps.template_dir = %(here)s/cows_wps/templates 
     55 
    4456# Directory where process output directories are stored.  Needs to be shared 
    4557# across all nodes under the same path 
    46 wps.proc_output_dir = %(here)s/proc_outputs 
     58#wps.proc_output_dir = %(here)s/proc_outputs 
     59wps.proc_output_dir = /disks/kona1/wps/proc_outputs 
    4760 
    4861# Place where config initialisation files are stored.  Theoretically doesn't 
    4962# need to be visible to execute hosts but some processes might rely on it. 
    50 wps.proc_config_dir = %(here)s/configs 
     63wps.proc_config_dir = %(here)s/process_configs 
    5164 
    5265# Metadata output options 
    5366wps.max_len_metadata_line = 42 
    5467 
    55 # Initiation file for the process output rules 
     68# Initiation file for the process output rules and user roles 
    5669wps.outputs_rules = %(here)s/outputs_rules.ini 
     70wps.roles_ini = %(here)s/user_roles.ini 
    5771 
    5872# Database backend options 
    5973#wps.database_url = sqlite:///:memory: 
    60 wps.database_url = sqlite:///%(here)s/wps.db 
     74#wps.database_url = sqlite:////tmp/cows_wps_ag.db 
     75wps.database_url = postgresql://ceda_wps:wasp_ced@bora/ceda_wps_test 
    6176 
    6277 
     
    7085wps.max_s_proc = 2 
    7186wps.sge_queue_timeout = 30 
    72 wps.runproc_path = %(here)s/bin/wps_runproc 
     87wps.runproc_path = %(here)s/../buildout/bin/wps_runproc 
    7388 
    7489# Nappy configuration 
     
    8398# Extra stuff needed for mod_wsgi and new in the codebase 
    8499#!TODO: tidy this up 
    85 wps.user = ddp 
     100wps.user = cwps 
    86101wps.mpl_configdir = /disks/cache/wps/.matplotlib 
    87102wps.worker_pool = 5 
     
    95110wps.notify_email_from = no-reply@ukcp09-ui.defra.gov.uk 
    96111wps.mailhost = localhost 
    97 wps.ukcp_helpdesk_url = http://ukclimateprojections.defra.gov.uk/content/view/518/681/helpdesk.php 
     112#wps.ukcp_helpdesk_url = http://ukclimateprojections.defra.gov.uk/content/view/518/681/helpdesk.php 
    98113wps.ui_url_to_jobs_page = http://ukclimateprojections-ui.defra.gov.uk/ui/outputs/jobs.php 
    99114 
     
    126141 
    127142 
     143[filter:BeakerSessionFilter] 
     144paste.filter_app_factory = beaker.middleware:SessionMiddleware 
     145 
     146# Cookie name 
     147beaker.session.key = ndg.security.session 
     148 
     149# WSGI environ key name 
     150environ_key = %(beakerSessionKeyName)s 
     151beaker.session.secret = rBIvKXLa+REYB8pM/8pdPoorVpKQuaOW 
     152beaker.cache.data_dir = %(here)s/authn/beaker/cache 
     153beaker.session.data_dir = %(here)s/authn/beaker/sessions 
     154 
     155 
     156[filter:AuthenticationFilter] 
     157paste.filter_app_factory = ndg.security.server.wsgi.authn:AuthenticationMiddleware 
     158prefix = authN. 
     159 
     160# Set redirect for OpenID Relying Party in the Security Services app instance 
     161authN.redirectURI = https://ceda-wps1.badc.rl.ac.uk/verify 
     162 
     163# AuthKit Set-up 
     164authkit.setup.method=cookie 
     165 
     166# This cookie name and secret MUST agree with the name used by the security web 
     167# services app 
     168authkit.cookie.name=ndg.security.auth 
     169authkit.cookie.secret=%(authKitCookieSecret)s 
     170authkit.cookie.signoutpath = /logout 
     171 
     172# Disable inclusion of client IP address from cookie signature due to  
     173# suspected problem with AuthKit setting it when a HTTP Proxy is in place 
     174authkit.cookie.includeip = False 
     175 
     176# environ key name for beaker session 
     177authkit.session.middleware = %(beakerSessionKeyName)s 
     178 
     179[filter:AuthorizationFilter] 
     180paste.filter_app_factory=ndg.security.server.wsgi.authz:SAMLAuthorizationMiddleware.filter_app_factory 
     181prefix = authz. 
     182authz.pepResultHandler = ndg.security.server.wsgi.authz.result_handler.genshi.GenshiPEPResultHandlerMiddleware 
     183authz.pepResultHandler.staticContentDir = %(here)s/ndg-security/pep_result_handler 
     184authz.pepResultHandler.baseURL = http://ceda-wps1.badc.rl.ac.uk 
     185authz.pepResultHandler.heading = Access Denied 
     186authz.pepResultHandler.messageTemplate = Access is forbidden for this resource:<div id="accessDeniedMessage">$pdpResponseMsg</div>Please check with your site administrator that you have the required access privileges. 
     187authz.pepResultHandler.footerText = This site is for test purposes only. 
     188authz.pepResultHandler.rightLink = http://ceda.ac.uk/ 
     189authz.pepResultHandler.rightImage = %(authz.pepResultHandler.baseURL)s/layout/CEDA_RightButton60.png 
     190authz.pepResultHandler.rightAlt = Centre for Environmental Data Archival 
     191authz.pepResultHandler.helpIcon = %(authz.pepResultHandler.baseURL)s/layout/icons/help.png 
     192 
     193policy.filePath = %(here)s/ndg-security/policy.xml 
     194 
     195# Settings for Policy Information Point used by the Policy Decision Point to 
     196# retrieve subject attributes from the Attribute Authority associated with the 
     197# resource to be accessed 
     198 
     199# If omitted, DN of SSL Cert is used 
     200pip.attributeQuery.issuerName =  
     201pip.attributeQuery.clockSkew = 0.5 
     202 
     203# Specify what type of attributes you want to query the Attribute Authority for 
     204pip.attributeQuery.queryAttributes.0 = urn:ceda:security:authz:1.0:attr, , http://www.w3.org/2001/XMLSchema#string 
     205 
     206# Verify the Attribute Authority's SSL certificate against this trust root 
     207pip.attributeQuery.sslCACertDir=%(securityConfigDir)s/pki/ca 
     208 
     209# Pass a certificate in the SSL call so that the Attribute Authority can authenticate this request 
     210pip.attributeQuery.sslCertFilePath=%(here)s/ndg-security/pki/ceda-wps1.badc.rl.ac.uk.pip.crt 
     211pip.attributeQuery.sslPriKeyFilePath=%(here)s/ndg-security/pki/ceda-wps1.badc.rl.ac.uk.pip.key 
     212 
    128213 
    129214############################################################################# 
    130215# Logging configuration 
    131216[loggers] 
    132 keys = root, cows_wps 
     217keys = root, cows_wps, ndg, saml 
    133218 
    134219[handlers] 
     
    146231handlers = 
    147232qualname = cows_wps 
     233 
     234[logger_ndg] 
     235level = DEBUG 
     236handlers = 
     237qualname = ndg 
     238 
     239[logger_saml] 
     240level = DEBUG 
     241handlers = 
     242qualname = saml 
    148243 
    149244[handler_console] 
     
    154249 
    155250[formatter_generic] 
    156 format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s 
    157 datefmt = %H:%M:%S 
     251format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s:%(lineno)s] %(message)s 
     252datefmt = %Y-%m-%d-%H:%M:%S 
  • cows_wps/trunk/cows_wps/controllers/jobviewer.py

    r6898 r6903  
    7878 
    7979        resp = "<h2>DETAILS</h2>" 
     80        resp += "<p>Need to realise that in costonly response we have JobCompletionTimeDate empty because it hasn't run yet!</p>" 
    8081 
    8182        for (i, item) in enumerate(items): 
    8283            x = job_details.find("{http://www.opengeospatial.net/wps}" + item).text 
     84            if type(x) != str: x = "Undefined" 
    8385            resp += "<b>%s</b> = %s<br>" % (mapped_names[i], x.strip()) 
    8486 
  • cows_wps/trunk/cows_wps/controllers/submitter.py

    r6898 r6903  
    4040        # If quick process then just forward 
    4141        if async == False: 
    42             base_url = "http://" + request.url[7:].split("/")[0] 
    43             full_url = base_url + wps_request_url 
    44             getter = urllib.urlopen(full_url) 
    45             xml = getter.read() 
    46             getter.close() 
    47             status_url = re.search('statusLocation="(.+?)"', xml).groups()[0] 
    48  
    49             jobviewer_url = url_for(controller='jobviewer', status_url = status_url)  
    50             return redirect_to(jobviewer_url) 
     42            return self._submitToWPSAndRedirectToJobViewer(wps_request_url) 
    5143 
    5244        # Now we are only dealing with async requests 
     45        cost_only_request_url = wps_request_url + "&Costonly=true" 
     46 
    5347        wps_resp_div = "wps_response_div" 
    54         resp = '<div>Submitting asynchronous request to get the cost of the request for: %s</div><div id="%s"></div>' % (proc_id, wps_resp_div) 
     48        resp = '<div>You have requested to run a "%s" job that will be run on the offline batch processing system. These jobs are controlled by a queuing system and it may take some time for your outputs to be produced.<br><br></div>' % proc_id 
     49 
     50        resp += '<div id="%s">Estimates of the size of the expected outputs and the duration of the job are being calculated...</div>' % wps_resp_div 
    5551        resp += """<script type="text/javascript"> 
    5652 
     
    5955        } 
    6056 
    61 </script>""" % (wps_request_url, wps_resp_div) 
     57</script>""" % (cost_only_request_url, wps_resp_div) 
     58 
     59        submitter_url = url_for(controller='submitter', action='conf') 
     60        resp += """<br><form id="confirmation" name="confirmation" action="%s" method="GET"> 
     61<input type="hidden" name="wps_request_url" value="%s" /> 
     62<input type="submit" name="submit" id="submit" value="Submit" disabled="disabled" /> 
     63</form>""" % (submitter_url, urllib.unquote(wps_request_url)) 
    6264 
    6365        renderer = UIPageRenderer() 
    64         resp = renderer.render("Submitting here", 
    65                                [("Submits or shows confirmation", resp)]) 
     66        resp = renderer.render("Confirmation page", 
     67                               [("Information about your asynchronous job", resp)]) 
    6668 
    6769        return resp 
     70 
     71 
     72    def _submitToWPSAndRedirectToJobViewer(self, wps_request_url): 
     73        "Submits request and gets statusLocation then redirects to job viewer controller." 
     74        base_url = "http://" + request.url[7:].split("/")[0] 
     75        full_url = base_url + wps_request_url 
     76 
     77        getter = urllib.urlopen(full_url) 
     78        xml = getter.read() 
     79        getter.close() 
     80 
     81        m = re.search('statusLocation="(.+?)"', xml) 
     82        status_url = m.groups()[0] 
     83 
     84        jobviewer_url = url_for(controller='jobviewer', status_url = status_url) 
     85        return redirect_to(jobviewer_url) 
     86 
     87 
     88    def conf(self): 
     89        "Called once confirmation is complete and just calls WPS and forwards." 
     90        wps_request_url = str(request.params.getone("wps_request_url")) 
     91        return self._submitToWPSAndRedirectToJobViewer(wps_request_url) 
     92         
    6893 
    6994    def _isAsync(self, proc_id): 
     
    7297        process_type = process_conf["wps_interface"]["process_type"] 
    7398 
    74         if process_type == "async_l": 
     99        if process_type.find("async") == 0: 
    75100            return True 
    76101        else: 
  • cows_wps/trunk/cows_wps/lib/ui/proc_config.py

    r6125 r6903  
    140140        resp = """Please complete the form below to submit a request to the CEDA Web Processing Service. 
    141141                Note that some processes are restricted to registered users only. 
    142                 Click the 'Submit' button to submit your request.""" 
     142                Click the 'Submit' button to submit your request.<br><br>""" 
    143143 
    144144        resp += """\n\n <form action="/submit" onSubmit="return validateInputs();"> 
     
    215215            resp += "</td><td>%s</td></tr>\n" % instruction 
    216216       
    217         resp += '<tr><td></td><td><input type="submit" value="Submit" /></td><td></td></table>\n</form>\n' 
     217        resp += '<tr><td></td><td><input type="submit" value="Submit" /> Click this button when you are happy with your selections.</td><td></td></table>\n</form>\n' 
    218218        return  fm.htmlify(resp) 
  • cows_wps/trunk/cows_wps/public/js/ui/submit_utils.js

    r6896 r6903  
    4848function makeWPSRequest(wps_url, info_div_id) { 
    4949        // Inform that request is being made 
    50         $("#" + info_div_id).append("Your request is being submitted to the WPS..."); 
     50        $("#" + info_div_id).append('<span style="color: blue;">contacting the server now...</span>'); 
    5151 
    5252        // Set up AJAX call 
     
    5959} 
    6060 
     61function convertToMB(bytes) { 
     62    var bytes = parseInt(bytes, 10); 
     63    var mb = bytes / 2^20; 
     64    return mb; 
     65} 
     66 
     67function secsToMinutes(s) { 
     68    var secs = parseFloat(s, 10); 
     69    var mins = secs / 60.; 
     70    var mins_string = mins.toFixed(1); 
     71    return mins_string; 
     72} 
     73 
     74function trim(s) { 
     75        return s.replace(/^\s+|\s+$/g,""); 
     76} 
     77 
     78function disableSubmitButton() { 
     79    $('#confirmation').submit(function() { 
     80        $('input[type=submit]', this).attr('disabled', 'disabled'); 
     81    }); 
     82} 
     83 
     84function enableSubmitButton() { 
     85    $('#submit').removeAttr('disabled'); 
     86} 
     87 
    6188function parseWPSResponse(xml) 
    6289{ 
    63     var items = ["FileSize", "FileInfo"]; 
    64     for (var i = 0; i < items.length; i++) { 
    65         item = items[i]; 
     90    var html = "The system estimates has estimated the following information for your job:<br>" 
     91//    var items = ["FileSize", "FileInfo"]; 
     92    var volume; 
     93    var duration; 
     94    var status_url; 
    6695 
    67         $(xml).find(item).each(function() 
    68         { 
    69              $("#wps_response_div").append(item + ": " + $(this).text() + "<br />"); 
    70         }); 
     96    $(xml).find("JobVolume").each(function() { 
     97         volume = trim($(this).text()); 
     98    }); 
     99    var megabytes = convertToMB(volume); 
    71100 
    72     } 
     101    $(xml).find("JobDuration").each(function() { 
     102         duration = trim($(this).text()); 
     103    }); 
     104    var minutes = secsToMinutes(duration); 
     105 
     106    $(xml).find("ExecuteResponse").each(function() 
     107    { 
     108        status_url = $(this).attr("statusLocation"); 
     109    }); 
     110 
     111    html += "<br><b>Estimated duration:</b> " + minutes + " minutes";  
     112    html += "<br><b>Estimated volume:</b> " + megabytes + " MB"; 
     113    html += "<br><br>Please click the submit button to confirm you wish to run the job.<br>";  
     114 
     115    $("#wps_response_div").empty(); 
     116    $("#wps_response_div").html(html); 
     117 
     118    enableSubmitButton(); 
    73119} 
    74120 
  • cows_wps/trunk/cows_wps/public/style/wps_ui.css

    r6898 r6903  
    2020h2 { 
    2121        color: #1111FF; 
     22} 
     23 
     24table { 
     25        border: 2px solid #0000CC; 
    2226} 
    2327 
     
    9195        top: 25px; 
    9296        padding: 35px 10px 10px 10px; 
    93         background-color: #0099FF; 
     97        background-color: #CCFFFF; 
    9498        border-style: inset; 
    9599        border-color: #3333CC; 
     
    101105        text-indent: 30px; 
    102106        padding: 35px 10px 10px 10px; 
    103         background-color: #AAFFDD; 
     107        background-color: #CCFFFF; 
    104108        border-style: inset; 
    105109        border-color: #3333CC; 
     
    118122 
    119123.odd_row { 
    120         background-color: #eeeeff; 
     124        background-color: #eeeeee; 
    121125} 
    122126 
    123127.even_row { 
    124         background-color: #eeccff; 
     128        background-color: #ffffff; 
    125129} 
    126130 
  • cows_wps/trunk/process_configs/ExtractUKStationData.ini

    r6873 r6903  
    11[wps_interface] 
    22process_callable = process_modules.extract_uk_station_data#ExtractUKStationData 
    3 process_type = sync 
     3process_type = async_s 
    44dry_run_enabled = False 
    55internal = False 
Note: See TracChangeset for help on using the changeset viewer.