Changeset 7106 for cows_wps


Ignore:
Timestamp:
28/06/10 09:11:09 (9 years ago)
Author:
astephen
Message:

Got job cancellation working. Still needs to pick up responses propoerly

Location:
cows_wps/trunk/cows_wps
Files:
4 edited

Legend:

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

    r7104 r7106  
    8383            "sub_before": None, 
    8484            "sub_after": None, 
    85             "order_by": "sub_time"} 
     85            "order_by": "sub_time_rev"} 
    8686 
    8787    arg_processers = {"start": int, 
     
    105105 
    106106        renderer = UIPageRenderer() 
    107         return renderer.renderJobsPage(filtered_jobs, total_matches, args, bad_args) 
     107        return renderer.renderJobsPage(user_id, filtered_jobs, total_matches, args, bad_args) 
    108108     
    109109     
     
    161161        # Define jobs as tuple of (job_id, user, status, job_type, created)  
    162162        # And convert all unicodes 
    163         jobs = [[str(i) for i in (r.job_id, r.user_id, r.job.status, r.job.type, r.job.created)] for r in requests] 
     163        jobs = [[str(i) for i in (r.id, r.user_id, r.job.status, r.job.type, r.job.created)] for r in requests] 
    164164          
    165165        for filtr in ("job_id_match", "job_type", "job_status", "sub_before", "sub_after", "user_id"): 
  • cows_wps/trunk/cows_wps/public/js/ui/jobviewer_utils.js

    r7086 r7106  
    8080    }); 
    8181 
     82    // Get job ID 
     83    var job_id = -1; 
     84    $(xml).find("JobID").each(function() 
     85    { 
     86        job_id = $(this).text(); 
     87    }); 
     88 
    8289    $("#poll_info").empty(); 
    8390    $("#poll_info").html("Your job is currently running. The job is " + pc + "% complete."); 
     
    8592    // Assume we found ProcessStarted or ProcessAccepted so keep polling 
    8693    $("#poll_info").append("...Polling again in 3 seconds..."); 
     94    $("#poll_info").append('<br><a href="/user/cancel/Ag.Stephens/' + job_id + '">Cancel this job</a>'); 
    8795    setTimeout("pollWPS();", 3000);  
    8896} 
  • cows_wps/trunk/cows_wps/renderer/ui_renderer.py

    r7105 r7106  
    11import os 
    22 
    3 from pylons import config, tmpl_context as c 
     3from pylons import config, request, tmpl_context as c 
     4from routes import url_for 
    45 
    56from genshi.template import TemplateLoader  
     
    4748 
    4849 
    49     def renderJobsPage(self, jobs, total_matches, args, bad_args): 
     50    def renderJobsPage(self, user_id, jobs, total_matches, args, bad_args): 
    5051        """ 
    5152        Renders jobs page. 
    5253        """ 
    5354        jobs_html = '<b>Total jobs matched: <span style="background: white; border: solid 1px; padding: 3px;">%d</span></b><br/><br/>' % total_matches 
    54         jobs_html += self._renderJobsTable(jobs) 
     55        jobs_html += self._renderJobsTable(user_id, jobs) 
    5556  
    5657        filter_html = "Please select the filtering options and press the 'Filter jobs' button to submit the new filter settings." 
     
    7475 
    7576 
    76     def _renderJobsTable(self, jobs): 
     77    def _renderJobsTable(self, user_id, jobs): 
    7778        "Renders and returns (as string) table of HTML jobs." 
    7879        html = """ 
    7980<table border="2"> 
    8081        <tr> 
    81                 <td>Job id</td> 
     82                <td>Request ID</td> 
    8283                <td>Job type</td> 
    8384                <td>User</td> 
     
    8990        count = 0 
    9091 
    91         for  (job_id, user, status, job_type, created) in jobs: 
     92        for  (req_id, user, status, job_type, created) in jobs: 
    9293            created = created.split(".")[0] 
    9394 
     
    9798 
    9899            # Set action 
    99             action = '<a href="/jobviewer?status_url=balhlsdfjsdkfjs">View job info/outputs</a>' 
     100            status_url = "http://" + request.environ["HTTP_HOST"] + url_for(controller = 'status', requestId = req_id)  
     101            job_viewer_url = url_for(controller = 'jobviewer') + "?status_url=" + status_url 
     102            action = '<a href="%s">View job info/outputs</a>' % job_viewer_url 
     103 
    100104            if status in ("STARTED", "ACCEPTED"): 
    101                 action += '<br/><a href="/job/cancel/user_id/job_id">Cancel this job - need to put a JS confirmation in here</a>'  
     105                cancel_url = url_for(controller = "user", action = "cancel", userId = user_id, jobId = req_id)  
     106                action += '<br/><a href="%s">Cancel this job</a>' % cancel_url 
    102107 
    103108            # HTML for row 
    104             row = '<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n' % (row_style, job_id, job_type, user, created, status, action) 
     109            row = '<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n' % (row_style, req_id, job_type, user, created, status, action) 
    105110            html += row 
    106111 
  • cows_wps/trunk/cows_wps/routing.py

    r6877 r7106  
    2222    map.connect(':controller/:action/:userId/:jobId') 
    2323     
    24     map.connect(':controller/:action/:id') 
     24#    map.connect(':controller/:action/:id') 
     25    map.connect(':controller/:action') 
    2526    return map 
Note: See TracChangeset for help on using the changeset viewer.