Example #1
0
def initdb():
    res = postgresops.check_and_create_table(
         "devices.physical",
         (("id", "integer primary key"),
          ("idstr","varchar"),
          ("device_type","varchar"),
          ("source_name","varchar"),
          ("feed_names","varchar[]"),
          ("source_ids","varchar[]")
          ))
    
    res = postgresops.check_and_create_table(
         "devices.metadata",
         (("id", "integer primary key"),
          ("parent", "integer"),
          ("key","varchar"),
          ("value","varchar"),
          ("devices","integer[]")
          ))
def initdb():
    res = postgresops.check_and_create_table(
         "learning.hmmgaussianemissions",
         (("plugload_id", "integer"),
          ("data_from","timestamp"),
          ("data_to","timestamp"),
          ("state_ids","integer[]"),
          ("counts","integer[]"),
          ("means","real[]"),
          ("variances","real[]"),
          ))
Example #3
0
def initdb():
    res = postgresops.check_and_create_table(
         "flows.curflows",
         (("flowdef", "varchar"),
          ("time_from","timestamp"),
          ("time_to","timestamp"),
          ("source_name","varchar"),
          ("source_id","varchar"),
          ("task_ids","integer[]"),
          ("file_ids","integer[]"),
          ("status","integer")
          ))
Example #4
0
def initdb():
    res = postgresops.check_and_create_table(
         "flows.files",
         (("id", "integer primary key"),
          ("file_name", "varchar"),
          ("directory", "boolean"),
          ("time_from","timestamp"),
          ("time_to","timestamp"),
          ("source_name","varchar"),
          ("source_id","varchar"),
          ("steps","varchar"),
          ("status","integer"),
          ("task_id","integer")
          ))
def initdb():
    res = postgresops.check_and_create_table(
         "schedule.tasks",
         (("id", "integer primary key"),
          ("command","varchar"),
          ("profile_tag","varchar"),
          ("prerequisites","integer[]"),
          ("start_after","timestamp"),
          ("deadline_s","integer"),
          ("start_time","timestamp"),
          ("end_time","timestamp"),
          ("cpu_usage_s","integer"),
          ("status","smallint"),
          ("progress_steps_done","smallint"),
          ("progress_steps_total","smallint"),
          ("step_description","varchar"),
          ("step_progress_str","varchar"),
          ("pid","integer"),
          ("log_file","varchar")
          ))
    if res: # if a new table was created, create the index
        postgresops.dbcur.execute("CREATE UNIQUE INDEX schedule_tasks_index_%d ON schedule.tasks (start_time)"%(id_rgen.randint(0,2**31-1),))
        postgresops.dbcon.commit()