Commit 33868095 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Enabled rsync copy for cold storage request on 'generic_rw' tape frontend workspace.

parent 2d76247d
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -45,8 +45,6 @@ DESCRIPTION

    def store(self, cmd, username):
        request_type = cmd.upper()
        if request_type == "CSTORE":
            sys.exit("\nNo se pol (per ora).\n")
        storeRequest = { "requestType": request_type, "userName": username }
        print(f"\nSending {request_type} request...\n")
        storeResponse = self.call(storeRequest)
+7 −16
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ from system_utils import SystemUtils
from tape_client import TapeClient
from task_executor import TaskExecutor


class StoreExecutor(TaskExecutor):

    def __init__(self):
@@ -40,18 +41,8 @@ class StoreExecutor(TaskExecutor):
        self.dbConn.setPhase(self.jobId, "EXECUTING")
        srcPathPrefix = self.storageStorePath.replace("{username}", self.username)
        srcData = os.listdir(srcPathPrefix)
        if self.requestType == "CSTORE":
            destPathPrefix = self.dbConn.getStorageBasePath(self.storageId) + '/' + self.username
            self.dbConn.disconnect()
            #destPathPrefix = self.tapeStorageBasePath.replace("{username}", self.username)
            self.tapeClient.connect()
            for el in srcData:
                self.tapeClient.copy(srcPathPrefix + '/' + el, destPathPrefix + '/' + el)
            self.tapeClient.disconnect()
        else:
        destPathPrefix = self.dbConn.getStorageBasePath(self.storageId) + '/' + self.username
        self.dbConn.disconnect()
            #destPathPrefix = self.serverStorageBasePath.replace("{username}", self.username)
        sp = subprocess.run(["rsync", "-av", srcPathPrefix + '/', destPathPrefix + '/'], capture_output = True)
        if(sp.returncode or sp.stderr):
            return False