diff --git a/transfer_service/retrieve_executor.py b/transfer_service/retrieve_executor.py index eae069c3fe2ecd7d8c90e93cfef76f14e21cf528..b93d50a0b384232e8259d7fb1a9c84bd9dfa5f2c 100644 --- a/transfer_service/retrieve_executor.py +++ b/transfer_service/retrieve_executor.py @@ -46,7 +46,9 @@ class RetrieveExecutor(TaskExecutor): fileList.append(srcPath) self.dbConn.disconnect() if fileList: + self.tapeClient.connect() self.tapeClient.recall(fileList) + self.tapeClient.disconnect() def retrieveData(self): self.dbConn.connect() @@ -62,20 +64,20 @@ class RetrieveExecutor(TaskExecutor): out.write(f"osRelParentPath: {osRelParentPath}\n") destPath = self.storageRetrievePath.replace("{username}", username) + osRelParentPath out.write(f"destPath: {destPath}\n\n") - if storageType == "cold": + #if storageType == "cold": #srcPathPrefix = self.tapeStorageBasePath.replace("{username}", self.username) # TO BE DONE - pass + # pass + #else: + os.makedirs(destPath, exist_ok = True) + sp = subprocess.run(["rsync", "-av", srcPath, destPath], capture_output = True) + out.write(f"rsync stdout: {sp.stdout}") + if(sp.returncode or sp.stderr): + out.write(f"rsync stderr: {sp.stderr}") + self.dbConn.disconnect() + return False else: - os.makedirs(destPath, exist_ok = True) - sp = subprocess.run(["rsync", "-av", srcPath, destPath], capture_output = True) - out.write(f"rsync stdout: {sp.stdout}") - if(sp.returncode or sp.stderr): - out.write(f"rsync stderr: {sp.stderr}") - self.dbConn.disconnect() - return False - else: - self.updateAsyncTrans(vospacePath) + self.updateAsyncTrans(vospacePath) self.dbConn.disconnect() return True diff --git a/transfer_service/tape_client.py b/transfer_service/tape_client.py index 2f2789f92f58cdc86478d7ccfb5ad092aae25c3d..07d6eb9c3ed4ab940f0d644909a9b981a256a898 100644 --- a/transfer_service/tape_client.py +++ b/transfer_service/tape_client.py @@ -72,10 +72,15 @@ class TapeClient(object): self.scp.close() def recall(self, fileList): - #TODO - cmd = "eeadm recall" - tmp = str(uuid.uuid1().hex) + ".tmp" - stdin, stdout, stderr = self.client.exec_command(cmd) + #TODO + tmp = str(uuid.uuid1().hex) + "-vos_recall.tmp" + fp = open(tmp, "a") + for f in fileList: + fp.write(f"{f}\n") + fp.close() + self.copy("./" + tmp, "/tmp/" + tmp) + cmd = "eeadm recall /tmp/" + tmp + stdin, stdout, stderr = self.client.exec_command(cmd) def recallChecksumFiles(self, dirName): cmd = "find $(dirname " + dirName + ") -type f \( -iname \"*-md5sum.txt\" \) | /opt/ibm/ltfsee/bin/eeadm recall"