Esempio n. 1
0
 def get_all(cls, uid=''):
     c = persistence.cursor()
     if (uid == ''):
         c.execute("""SELECT 
                uid,
                dir_name,
                created_on,
                classifier_uid,
                status,
                progress_percentage,
                progress_text
                FROM JOB""")
     else:
         c.execute(
             """SELECT 
                uid,
                dir_name,
                created_on,
                classifier_uid,
                status,
                progress_percentage,
                progress_text
                FROM JOB
                WHERE UID=?""", [uid])
     jobs = []
     for job_t in c.fetchall():
         job = JobContext(uid=job_t[0],
                          dir_name=job_t[1],
                          created_on=job_t[2],
                          classifier_uid=job_t[3],
                          status=job_t[4],
                          progress_percentage=job_t[5],
                          progress_text=job_t[6])
         jobs.append(job)
     return jobs
Esempio n. 2
0
 def get_all(cls, uid=''):
     c = persistence.cursor()
     if (uid == ''):
         c.execute("""SELECT 
         uid,
         type,
         title,
         created_on,
         local_created_on,
         path 
         FROM RESOURCE""")
     else:
         c.execute(
             """SELECT 
         uid,
         type,
         title,
         created_on,
         local_created_on,
         path 
         FROM RESOURCE 
         WHERE UID=?""", [uid])
     resources = []
     for resource_t in c.fetchall():
         resource = Resource()
         resource.uid = resource_t[0]
         resource.resource_type = resource_t[1]
         resource.title = resource_t[2]
         resource.created_on = resource_t[3]
         resource.local_created_on = resource_t[4]
         resource.path = resource_t[5]
         resources.append(resource)
     return resources
Esempio n. 3
0
 def exists(cls, uid):
     c = persistence.cursor()
     c.execute("""SELECT * FROM JOB WHERE UID=?""", [uid])
     return (c.fetchone() != None)
Esempio n. 4
0
 def exists(cls, uid):
     c = persistence.cursor()
     c.execute("""SELECT * FROM CLASSIFIER WHERE uid=?""", [uid])
     return (c.fetchone() != None)
Esempio n. 5
0
 def get_all(cls, uid=''):
     c = persistence.cursor()
     if (uid == ''):
         c.execute("""SELECT 
         uid,
         type,
         title,
         enabled,
         language,
         test_accuracy,
         training_set_size,
         created_on,
         finished_on,
         local_created_on,
         state
         FROM CLASSIFIER""")
     else:
         c.execute(
             """SELECT 
         uid,
         type,
         title,
         enabled,
         language,
         test_accuracy,
         training_set_size,
         created_on,
         finished_on,
         local_created_on,
         state 
         FROM CLASSIFIER
         WHERE uid=?""", [uid])
     classifiers = []
     for c_t in c.fetchall():
         cl = Classifier()
         cl.uid = c_t[0]
         cl.model_type = c_t[1]
         cl.title = c_t[2]
         cl.enabled = True if c_t[3] == 1 else False
         cl.language = c_t[4]
         cl.test_accuracy = c_t[5]
         cl.training_set_size = c_t[6]
         cl.created_on = c_t[7]
         cl.finished_on = c_t[8]
         cl.local_created_on = c_t[9]
         cl.state = c_t[10]
         cl.resources = {}
         c.execute(
             """SELECT key, resource_uid 
                   FROM CLASSIFIER_RESOURCE 
                   WHERE classifier_uid=?""", [cl.uid])
         for r in c.fetchall():
             cl.resources[r[0]] = r[1]
         cl.meta = {}
         c.execute(
             """SELECT key, value 
                   FROM CLASSIFIER_META
                   WHERE classifier_uid=?""", [cl.uid])
         for m in c.fetchall():
             cl.meta[m[0]] = m[1]
         cl.saved = True
         classifiers.append(cl)
     return classifiers