def syncToRemote( self, a_fileList, a_remoteHost ): ''' Synchronize a list of files to the remote host. Addresses of files should be relative to the project home. ''' currentHomeAbs = self.pI.getHomeAbsPath() remoteHomeAbs = self.pI.getHomeAbsPath( a_remoteHost ) utilities.syncFilesToRemote( currentHomeAbs, a_fileList, a_remoteHost, remoteHomeAbs ) return
def syncMetadataToRemote( self, a_host ): ''' Synchronize metadata to the remote host. Metadata must be load before calling this function ''' #Temporarily change the current host into the remote host currentHost = self.pI.getCurrentHost() self.pI.setCurrentHost( a_host ) #Save metaData files self.pI.destruct() self.pL.destruct() self.pG.destruct() #Change the currenthost name back self.pI.setCurrentHost( currentHost ) utilities.syncFilesToRemote( self.pI.getHomeAbsPath(), ['SMPInterface.py','.scientificProjectManager'], a_host, self.pI.getHomeAbsPath(a_host) ) #Restore the correct project info file self.pI.destruct() return
def createRemoteWorkSpace( self, a_host, a_homeAddr ): ''' Create a remote work space on a given host and copy all metadata there. ''' if self.pI.hostExists( a_host ): print 'The remote host '+a_host+' already exists!' return self.pI.addHost( a_host, a_homeAddr ) currentHost = self.pI.getCurrentHost() currentHomeAbs = self.pI.getHomeAbsPath() #This is a trick to create a empty data directory in the remote host subprocess.call( [ 'rsync', '-av', os.path.join( currentHomeAbs, '.scientificProjectManager/scratch' ), a_host+':'+os.path.join(a_homeAddr,'data') ] ) #Temporarily change the current host into the remote host self.pI.setCurrentHost( a_host ) self.pI.saveToFile( self.pI.xmlFileName ) #Synchronize the metadata and the interface to the remote host utilities.syncFilesToRemote( currentHomeAbs, ['SMPInterface.py','.scientificProjectManager'], a_host, a_homeAddr) #Change the currenthost name back self.pI.setCurrentHost( currentHost ) return