Example #1
0
    def reinterpret_task_parameters(self,task):
        xmlObj=task.parse_parameters_xml();
        sampling_node=xmlmisc.xget(xmlObj,"sampling")[0];
        overlap=float(xmlmisc.xget_a(sampling_node,"overlap"))

        layout_node=xmlmisc.xget(xmlObj,"layout")[0];
        num_per_task=int(xmlmisc.xget_a(layout_node,"num_per_task"));
        frame_w=int(xmlmisc.xget_a_d(layout_node,"frame_w","550"));
        frame_h=int(xmlmisc.xget_a_d(layout_node,"frame_h","500"));
        display_mode=xmlmisc.xget_a_d(layout_node,"mode","full");
        return {'overlap':overlap,'display_mode':display_mode,'num_per_task':num_per_task,"frame_w":frame_w,"frame_h":frame_h};
Example #2
0
 def estimate_time_spent(self,submission):
     GET,POST=submission.get_response();
     try:
         st=POST['load_time'];
         et=POST['submit_time'];
         time_fmt="%a, %d %b %Y %H:%M:%S %Z"
         s= time.strptime(st,time_fmt)
         e= time.strptime(et,time_fmt)
         seconds_spent =  time.mktime(e)-time.mktime(s)
         return seconds_spent
     except Exception,e:
         shapes_xml=urllib.unquote_plus(POST['sites']);
         try:
             x_doc = xml.dom.minidom.parseString(shapes_xml)
             meta_node=xmlmisc.xget(x_doc,"meta")[0];
             load_time=float(xmlmisc.xget_a_d(meta_node,"load_time","0"));
             submit_time=float(xmlmisc.xget_a_d(meta_node,"submit_time","0"));
             return (submit_time-load_time)/1000;
         except:
             return 0
Example #3
0
 def estimate_time_spent(self, submission):
     GET, POST = submission.get_response()
     try:
         st = POST['load_time']
         et = POST['submit_time']
         time_fmt = "%a, %d %b %Y %H:%M:%S %Z"
         s = time.strptime(st, time_fmt)
         e = time.strptime(et, time_fmt)
         seconds_spent = time.mktime(e) - time.mktime(s)
         return seconds_spent
     except Exception, e:
         shapes_xml = urllib.unquote_plus(POST['sites'])
         try:
             x_doc = xml.dom.minidom.parseString(shapes_xml)
             meta_node = xmlmisc.xget(x_doc, "meta")[0]
             load_time = float(xmlmisc.xget_a_d(meta_node, "load_time",
                                                "0"))
             submit_time = float(
                 xmlmisc.xget_a_d(meta_node, "submit_time", "0"))
             return (submit_time - load_time) / 1000
         except:
             return 0