def test_filemanager_update_remote_yes_sta(self):
     sta = True
     types = ['atm', 'ice', 'ocn', 'streams.cice', 'streams.ocean']
     database = 'test.db'
     simstart = 51
     source_path = '/global/cscratch1/sd/golaz/ACME_simulations/20170915.beta2.A_WCYCL1850S.ne30_oECv3_ICG.edison'
     simend = 60
     experiment = '20170915.beta2.A_WCYCL1850S.ne30_oECv3_ICG.edison'
     filemanager = FileManager(mutex=self.mutex,
                               sta=sta,
                               types=types,
                               database=database,
                               remote_endpoint=self.remote_endpoint,
                               remote_path=source_path,
                               local_endpoint=self.local_endpoint,
                               local_path=self.local_path)
     filemanager.populate_file_list(simstart=simstart,
                                    simend=simend,
                                    experiment=experiment)
     client = get_client()
     filemanager.update_remote_status(client)
     self.mutex.acquire()
     for datafile in DataFile.select():
         if datafile.remote_status != 0:
             print datafile.name, datafile.remote_path
         self.assertEqual(datafile.remote_status, 0)
     if self.mutex.locked():
         self.mutex.release()
     self.assertTrue(filemanager.all_data_remote())
 def test_filemanager_update_remote_no_sta(self):
     sta = False
     types = ['atm', 'ice', 'ocn', 'rest', 'streams.cice', 'streams.ocean']
     database = 'test.db'
     simstart = 51
     simend = 60
     experiment = '20171011.beta2_FCT2-icedeep_branch.A_WCYCL1850S.ne30_oECv3_ICG.edison'
     filemanager = FileManager(mutex=self.mutex,
                               sta=sta,
                               types=types,
                               database=database,
                               remote_endpoint=self.remote_endpoint,
                               remote_path=self.remote_path,
                               local_endpoint=self.local_endpoint,
                               local_path=self.local_path)
     filemanager.populate_file_list(simstart=simstart,
                                    simend=simend,
                                    experiment=experiment)
     client = get_client()
     filemanager.update_remote_status(client)
     self.mutex.acquire()
     for datafile in DataFile.select():
         self.assertEqual(datafile.remote_status, 0)
     if self.mutex.locked():
         self.mutex.release()
     self.assertTrue(filemanager.all_data_remote())