Exemplo n.º 1
0
 def testLocalToOneRemoteHost(self):
     tempFolder = "localToOneRemote"
     filePaths = {}
     checkPathList = []
     sourceFilesPathList = getFiles(self.localSourceFolder)
     for sourceFilePath in sourceFilesPathList:
         sourceFileName = basename(sourceFilePath)
         targetFilePath = join(self.remoteTargetFolder1, tempFolder,
                               sourceFileName)
         filePaths[sourceFilePath] = targetFilePath
         checkPathList.append(self.hostsRefs[0] + ":" + targetFilePath)
     self.fileTransfer.transferFilesTo(filePaths,
                                       self.remoteHostName1,
                                       self.remoteUserName1,
                                       self.remotePassword1,
                                       gatewayHosts=self.gatewayHosts,
                                       numberTrials=self.numberTrials,
                                       forceOperation=self.forceOperation,
                                       operationId=self.operationId)
     passTest = len(
         self.fileTransfer.checkFiles(checkPathList,
                                      self.hostPasswords,
                                      gatewayHosts=self.gatewayHosts,
                                      numberTrials=self.numberTrials,
                                      forceOperation=self.forceOperation,
                                      operationId=self.operationId)) == 0
     ft.removeRemoteFolder(self.remoteHostName1, self.remoteUserName1,
                           self.remotePassword1,
                           join(self.remoteTargetFolder1, tempFolder))
     self.assertTrue(passTest)
Exemplo n.º 2
0
 def testLocalToLocal(self):
     tempFolder = "localToLocal"
     filePaths = {}
     sourceFilesPathList = getFiles(self.localSourceFolder)
     for sourceFilePath in sourceFilesPathList:
         sourceFileName = basename(sourceFilePath)
         targetFilePath = join(self.localTargetFolder, tempFolder,
                               sourceFileName)
         targetFilePathList = []
         targetFilePathList.append(targetFilePath)
         filePaths[sourceFilePath] = targetFilePathList
     self.fileTransfer.transferFiles(filePaths,
                                     self.hostPasswords,
                                     gatewayHosts=self.gatewayHosts,
                                     numberTrials=self.numberTrials,
                                     forceOperation=self.forceOperation,
                                     operationId=self.operationId)
     checkPathList = ft.getFilePathList(filePaths)
     passTest = len(
         self.fileTransfer.checkFiles(checkPathList,
                                      self.hostPasswords,
                                      gatewayHosts=self.gatewayHosts,
                                      numberTrials=self.numberTrials,
                                      forceOperation=self.forceOperation,
                                      operationId=self.operationId)) == 0
     #         self.fileTransfer.deleteFiles(checkPathList, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)
     cleanPath(join(self.localTargetFolder, tempFolder))
     self.assertTrue(passTest)
Exemplo n.º 3
0
 def testLocalToOneRemoteHost(self):
     tempFolder = "localToOneRemote"
     filePaths = {}
     checkPathList = []
     sourceFilesPathList = getFiles(self.localSourceFolder)
     for sourceFilePath in sourceFilesPathList:
         sourceFileName = basename(sourceFilePath)
         targetFilePath = join(self.remoteTargetFolder1, tempFolder, sourceFileName)
         filePaths[sourceFilePath] = targetFilePath
         checkPathList.append(self.hostsRefs[0] + ":" + targetFilePath)
     self.fileTransfer.transferFilesTo(filePaths, self.remoteHostName1, self.remoteUserName1, self.remotePassword1, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)
     passTest = len(self.fileTransfer.checkFiles(checkPathList, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)) == 0
     ft.removeRemoteFolder(self.remoteHostName1, self.remoteUserName1, self.remotePassword1, join(self.remoteTargetFolder1, tempFolder))
     self.assertTrue(passTest)
Exemplo n.º 4
0
    def testLocalToLocal(self):
        tempFolder = "localToLocal"
        filePaths = {}
        sourceFilesPathList = getFiles(self.localSourceFolder)
        for sourceFilePath in sourceFilesPathList:
            sourceFileName = basename(sourceFilePath)
            targetFilePath = join(self.localTargetFolder, tempFolder, sourceFileName)
            targetFilePathList = []
            targetFilePathList.append(targetFilePath)
            filePaths[sourceFilePath] = targetFilePathList
        self.fileTransfer.transferFiles(filePaths, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)
        checkPathList = ft.getFilePathList(filePaths)
        passTest = len(self.fileTransfer.checkFiles(checkPathList, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)) == 0
#         self.fileTransfer.deleteFiles(checkPathList, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)
        cleanPath(join(self.localTargetFolder, tempFolder))
        self.assertTrue(passTest)
Exemplo n.º 5
0
    def testLocalToSeveralRemoteHosts(self):
        tempFolder = "localToSeveralRemote"
        filePaths = {}
        sourceFilesPathList = getFiles(self.localSourceFolder)
        for sourceFilePath in sourceFilesPathList:
            sourceFileName = basename(sourceFilePath)
            targetFilePath1 = join(self.remoteTargetFolder1, tempFolder, sourceFileName)
            targetFilePath2 = join(self.remoteTargetFolder2, tempFolder, sourceFileName)
            targetFilePathList = []
            targetFilePathList.append(self.hostsRefs[0] + ":" + targetFilePath1)
            targetFilePathList.append(self.hostsRefs[1] + ":" + targetFilePath2)
            filePaths[sourceFilePath] = targetFilePathList
        self.fileTransfer.transferFiles(filePaths, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)
        checkPathList = ft.getFilePathList(filePaths)
        passTest = len(self.fileTransfer.checkFiles(checkPathList, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)) == 0
#         self.fileTransfer.deleteFiles(checkPathList, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)
        ft.removeRemoteFolder(self.remoteHostName1, self.remoteUserName1, self.remotePassword1, join(self.remoteTargetFolder1, tempFolder))
        ft.removeRemoteFolder(self.remoteHostName2, self.remoteUserName2, self.remotePassword2, join(self.remoteTargetFolder2, tempFolder))
        self.assertTrue(passTest)
Exemplo n.º 6
0
    def testAll(self):
        tempFolder = "allTransfer"
        filePaths = {}

        sourceFilesPathList = getFiles(self.localSourceFolder)
        remoteSourceFilePathList1 = ft.getRemoteFolderFiles(self.remoteHostName1, self.remoteUserName1, self.remotePassword1, self.remoteSourceFolder1)
        remoteSourceFilePathList2 = ft.getRemoteFolderFiles(self.remoteHostName2, self.remoteUserName2, self.remotePassword2, self.remoteSourceFolder2)

        localUserName = getLocalUserName()
        localHostname = getLocalHostName()

        for sourceFilePath in sourceFilesPathList:
            sourceFileName = basename(sourceFilePath)
            targetFilePath1 = join(self.remoteTargetFolder1, tempFolder, sourceFileName)
            targetFilePath2 = join(self.remoteTargetFolder2, tempFolder, sourceFileName)
            targetFilePath3 = join (self.localTargetFolder, tempFolder, sourceFileName)
            targetFilePathList = []
            targetFilePathList.append(self.hostsRefs[0] + ":" + targetFilePath1)
            targetFilePathList.append(self.hostsRefs[1] + ":" + targetFilePath2)
            targetFilePathList.append(localUserName + "@" + localHostname + ":" + targetFilePath3)
            filePaths[sourceFilePath] = targetFilePathList

        for remoteSourceFilePath in remoteSourceFilePathList1:
            targetFilePathList = []
            targetFilePathList.append(join(self.localTargetFolder, tempFolder, "test1", basename(remoteSourceFilePath)))
            filePaths[self.hostsRefs[0] + ":" + remoteSourceFilePath] = targetFilePathList
        for remoteSourceFilePath in remoteSourceFilePathList2:
            targetFilePathList = []
            targetFilePathList.append(join(self.localTargetFolder, tempFolder, "test2", basename(remoteSourceFilePath)))
            filePaths[self.hostsRefs[1] + ":" + remoteSourceFilePath] = targetFilePathList

        self.fileTransfer.transferFiles(filePaths, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)
        checkPathList = ft.getFilePathList(filePaths)
        passTest = len(self.fileTransfer.checkFiles(checkPathList, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)) == 0
#         self.fileTransfer.deleteFiles(checkPathList, self.hostPasswords, gatewayHosts=self.gatewayHosts, numberTrials=self.numberTrials, forceOperation=self.forceOperation, operationId=self.operationId)
        cleanPath(join(self.localTargetFolder, tempFolder))
        ft.removeRemoteFolder(self.remoteHostName1, self.remoteUserName1, self.remotePassword1, join(self.remoteTargetFolder1, tempFolder))
        ft.removeRemoteFolder(self.remoteHostName2, self.remoteUserName2, self.remotePassword2, join(self.remoteTargetFolder2, tempFolder))
        self.assertTrue(passTest)
    def _importFromFolderStep(self):
        """ This function will copy Xmipp .pos files for
        simulating a particle picking run...this is only
        for testing purposes.
        """
        for f in getFiles(self.importFolder.get()):
            copyFile(f, self._getExtraPath())

        extradir = self._getExtraPath()  
        
        inputset = self.inputMicrographsTiltedPair.get()
        uSet = inputset.getUntilted()
        tSet = inputset.getTilted()

        # Create Untilted and Tilted SetOfCoordinates
        uCoordSet = self._createSetOfCoordinates(uSet, suffix='Untilted')
        readSetOfCoordinates(extradir, uSet, uCoordSet)
        uCoordSet.write()
        tCoordSet = self._createSetOfCoordinates(tSet, suffix='Tilted')
        readSetOfCoordinates(extradir, tSet, tCoordSet)
        tCoordSet.write()
        
        # Read Angles from faked input micrographs
        micsFn = self._getExtraPath('input_micrographs.xmd')
        setAngles = self._createSetOfAngles()
        readAnglesFromMicrographs(micsFn, setAngles)
        setAngles.write()
        # Create CoordinatesTiltPair object
        outputset = CoordinatesTiltPair(filename=self._getPath('coordinates_pairs.sqlite'))
        outputset.setTilted(tCoordSet)
        outputset.setUntilted(uCoordSet)
        outputset.setAngles(setAngles)
        outputset.setMicsPair(inputset)
        outputset.setObjComment(self.getSummary(outputset))
        for coordU, coordT in izip(uCoordSet, tCoordSet):
            outputset.append(TiltPair(coordU, coordT))
        
        self._defineOutputs(outputCoordinatesTiltPair=outputset)
        self._defineSourceRelation(inputset, outputset)