Пример #1
0
 def compute(self):
     self.checkInputPort('csvFile')
     csv_file = self.getInputFromPort('csvFile')
     if not LoadAppLogic.IsExistsCSVFile(csv_file.file_entry):
         raise ModuleError(self, "IsExistsCSVFile failed")
     self.annotate({'used_files': str([csv_file.file_entry.HeaderPath])})
     csv_file.file_entry = \
         LoadAppLogic.ReadCSVFileColumnNames(csv_file.file_entry)
     if not LoadAppLogic.IsMatchCSVFileColumnNames(csv_file.file_entry):
         raise ModuleError(self, "IsMatchCSVFileColumnNames failed")
     self.setResult('csvFile', csv_file)
Пример #2
0
 def compute(self):
     self.check_input('csvFile')
     csv_file = self.get_input('csvFile')
     self.annotate({'used_files':
                       str([csv_file.file_entry.HeaderPath])})
     res = LoadAppLogic.ReadCSVFileColumnNames(csv_file.file_entry)
     self.set_output('csvFile', CSVFileEntry(res))
Пример #3
0
 def compute(self):
     self.check_input('csvFile')
     self.check_input('dbEntry')
     csv_file = self.get_input('csvFile')
     db_entry = self.get_input('dbEntry')
     self.annotate({'used_tables':
                        str([(db_entry.db_entry.ConnectionString, 
                              db_entry.db_entry.DBName,
                              csv_file.file_entry.TargetTable)])})
     if not LoadAppLogic.UpdateComputedColumns(db_entry.db_entry,
                                               csv_file.file_entry):
         raise ModuleError(self, "UpdateComputedColumns failed")
     if not LoadAppLogic.IsMatchTableRowCount(db_entry.db_entry,
                                              csv_file.file_entry):
         raise ModuleError(self, "IsMatchTableRowCount failed")
     if not LoadAppLogic.IsMatchTableColumnRanges(db_entry.db_entry,
                                                  csv_file.file_entry):
         raise ModuleError(self, "IsMatchTableColumnRanges failed")
     self.set_output('dbEntry', db_entry)
Пример #4
0
 def compute(self):
     self.check_input('csvRootPath')
     path = self.get_input('csvRootPath')
     self.annotate({'used_files':
                        str([os.path.join(path, "csv_ready.csv")])})
     csv_files = LoadAppLogic.ReadCSVReadyFile(path)
     # wrapped_res = Collection([CSVFileEntry(e) for e in res], CSVFileEntry)
     list_of_elts = [CSVFileEntry(f) for f in csv_files]
     for elt in list_of_elts:
         elt.upToDate = True
     self.set_output('csvFiles', list_of_elts)
Пример #5
0
    def compute(self):
        self.check_input('csvRootPath')
        path = self.get_input('csvRootPath')
        if not LoadAppLogic.IsCSVReadyFileExists(path):
            raise ModuleError(self, "IsCSVReadyFileExists failed")
        self.annotate({'used_files':
                           str([os.path.join(path, "csv_ready.csv")])})
        csv_files = LoadAppLogic.ReadCSVReadyFile(path)
        if not LoadAppLogic.IsMatchCSVFileTables(csv_files):
            raise ModuleError(self, "IsMatchCSVFileTables failed")
#         getter = get_module_registry().get_descriptor_by_name
#         descriptor = getter('edu.utah.sci.vistrails.basic', 
#                             'List')
#         list_of_elts = descriptor.module()
#         list_of_elts.value = [CSVFileEntry(f) for f in csv_files]
#         self.set_output('csvFiles', list_of_elts)
        list_of_elts = [CSVFileEntry(f) for f in csv_files]
        for elt in list_of_elts:
            elt.upToDate = True
        print 'list_of_elts:', list_of_elts
        self.set_output('csvFiles', list_of_elts)
Пример #6
0
 def compute(self):
     self.check_input('csvFile')
     self.check_input('dbEntry')
     csv_file = self.get_input('csvFile')
     db_entry = self.get_input('dbEntry')
     self.annotate({'used_tables':
                        str([(db_entry.db_entry.ConnectionString, 
                              db_entry.db_entry.DBName,
                              csv_file.file_entry.TargetTable)])})
     res = LoadAppLogic.IsMatchTableRowCount(db_entry.db_entry,
                                             csv_file.file_entry)
     self.set_output('countsMatch', res)
Пример #7
0
 def compute(self):
     self.check_input('csvFile')
     self.check_input('dbEntry')
     csv_file = self.get_input('csvFile')
     db_entry = self.get_input('dbEntry')
     if csv_file.file_entry.TargetTable.upper() == 'P2DETECTION':
         self.annotate({'used_tables':
                            str([(db_entry.db_entry.ConnectionString, 
                                  db_entry.db_entry.DBName,
                                  csv_file.file_entry.TargetTable)])})
     res = LoadAppLogic.IsMatchTableColumnRanges(db_entry.db_entry,
                                                 csv_file.file_entry)
     self.set_output('rangesMatch', res)
Пример #8
0
 def compute(self):
     self.check_input('dbEntry')
     db_entry = self.get_input('dbEntry')
     high_quality = False
     if self.has_input('highQuality'):
         high_quality = self.get_input('highQuality')
     self.annotate({'used_tables':
                        str([(db_entry.db_entry.ConnectionString, 
                              db_entry.db_entry.DBName,
                              "P2Detection")])})
     histogram = LoadAppLogic.DetectionsHistogram(db_entry.db_entry, 
                                                  high_quality)
     self.set_output('histogram', histogram)
Пример #9
0
 def compute(self):
     self.check_input('csvFile')
     self.check_input('dbEntry')
     csv_file = self.get_input('csvFile')
     db_entry = self.get_input('dbEntry')
     self.annotate({'used_files':
                       str([csv_file.file_entry.FilePath]),
                    'generated_tables':
                        str([(db_entry.db_entry.ConnectionString, 
                              db_entry.db_entry.DBName,
                              csv_file.file_entry.TargetTable)])})
     res = LoadAppLogic.LoadCSVFileIntoTable(db_entry.db_entry,
                                             csv_file.file_entry)
     self.set_output('success', res)
Пример #10
0
 def compute(self):
     self.checkInputPort('dbEntry')
     db_entry = self.getInputFromPort('dbEntry')
     self.annotate({
         'used_tables':
         str([(db_entry.db_entry.ConnectionString, db_entry.db_entry.DBName,
               "P2Detection"),
              (db_entry.db_entry.ConnectionString, db_entry.db_entry.DBName,
               "P2FrameMeta"),
              (db_entry.db_entry.ConnectionString, db_entry.db_entry.DBName,
               "P2ImageMeta")])
     })
     LoadAppLogic.CompactDatabase(db_entry.db_entry)
     self.setResult('dbEntry', db_entry)
Пример #11
0
 def compute(self):
     self.checkInputPort('csvFile')
     self.checkInputPort('dbEntry')
     csv_file = self.getInputFromPort('csvFile')
     db_entry = self.getInputFromPort('dbEntry')
     if csv_file.file_entry.TargetTable.upper() == 'P2DETECTION':
         self.annotate({
             'used_tables':
             str([
                 (db_entry.db_entry.ConnectionString,
                  db_entry.db_entry.DBName, csv_file.file_entry.TargetTable)
             ])
         })
     res = LoadAppLogic.UpdateComputedColumns(db_entry.db_entry,
                                              csv_file.file_entry)
     self.setResult('success', res)
Пример #12
0
 def compute(self):
     self.check_input('csvFile')
     self.check_input('dbEntry')
     csv_file = self.get_input('csvFile')
     print 'csv_file:', csv_file
     db_entry = self.get_input('dbEntry')
     self.annotate({'used_files':
                       str([csv_file.file_entry.FilePath])})
     self.annotate({'generated_tables':
                        str([(db_entry.db_entry.ConnectionString, 
                              db_entry.db_entry.DBName,
                              csv_file.file_entry.TargetTable)])})
     if not LoadAppLogic.LoadCSVFileIntoTable(db_entry.db_entry,
                                              csv_file.file_entry):
         raise ModuleError(self, "LoadCSVFileIntoTable failed")
     self.set_output('dbEntry', db_entry)
Пример #13
0
 def compute(self):
     self.check_input('jobID')
     job_id = self.get_input('jobID')
     res = LoadAppLogic.CreateEmptyLoadDB(job_id)
     self.set_output('dbEntry', DatabaseEntry(res))
Пример #14
0
 def compute(self):
     self.checkInputPort('csvFiles')
     csv_files = self.getInputFromPort('csvFiles')
     res = LoadAppLogic.IsMatchCSVFileTables(
         [f.file_entry for f in csv_files])
     self.setResult('tablesMatch', res)
Пример #15
0
 def compute(self):
     self.checkInputPort('jobID')
     job_id = self.getInputFromPort('jobID')
     res = LoadAppLogic.CreateEmptyLoadDB(job_id)
     self.setResult('dbEntry', DatabaseEntry(res))
Пример #16
0
 def compute(self):
     self.check_input('csvFiles')
     csv_files = self.get_input('csvFiles')
     res = LoadAppLogic.IsMatchCSVFileTables([f.file_entry 
                                              for f in csv_files])
     self.set_output('tablesMatch', res)
Пример #17
0
 def compute(self):
     self.checkInputPort('csvFile')
     csv_file = self.getInputFromPort('csvFile')
     res = LoadAppLogic.IsExistsCSVFile(csv_file.file_entry)
     self.setResult('fileExists', res)
Пример #18
0
 def __init__(self, db_entry=None):
     Module.__init__(self)
     if db_entry is not None:
         self.db_entry = db_entry
     else:
         self.db_entry = LoadAppLogic.DatabaseEntry()
Пример #19
0
 def compute(self):
     self.check_input('csvFile')
     csv_file = self.get_input('csvFile')
     res = LoadAppLogic.IsExistsCSVFile(csv_file.file_entry)
     self.set_output('fileExists', res)
Пример #20
0
 def compute(self):
     self.checkInputPort('csvFile')
     csv_file = self.getInputFromPort('csvFile')
     res = LoadAppLogic.IsMatchCSVFileColumnNames(csv_file.file_entry)
     self.setResult('columnsMatch', res)
Пример #21
0
 def __init__(self, file_entry=None):
     Module.__init__(self)
     if file_entry is not None:
         self.file_entry = file_entry
     else:
         self.file_entry = LoadAppLogic.CSVFileEntry()
Пример #22
0
 def compute(self):
     self.check_input('csvFile')
     csv_file = self.get_input('csvFile')
     res = LoadAppLogic.IsMatchCSVFileColumnNames(csv_file.file_entry)
     self.set_output('columnsMatch', res)
Пример #23
0
 def compute(self):
     self.check_input('csvRootPath')
     path = self.get_input('csvRootPath')
     res = LoadAppLogic.IsCSVReadyFileExists(path)
     self.set_output('fileExists', res)
Пример #24
0
 def compute(self):
     self.checkInputPort('csvRootPath')
     path = self.getInputFromPort('csvRootPath')
     res = LoadAppLogic.IsCSVReadyFileExists(path)
     self.setResult('fileExists', res)