def getSandbox( self ): """ Get job sandbox """ if 'jobID' not in request.params: c.error = "Maybe you forgot the jobID ?" return render( "/error.mako" ) jobID = int(request.params['jobID']) sbType = 'Output' if 'sandbox' in request.params: sbType = str(request.params['sandbox']) client = SandboxStoreClient(useCertificates=True, delegatedDN=str( credentials.getUserDN() ), delegatedGroup=str( credentials.getSelectedGroup() ), setup = credentials.getSelectedSetup() ) result = client.downloadSandboxForJob(jobID,sbType,inMemory=True) if not result['OK']: c.error = "Error: %s" % result['Message'] return render( "/error.mako" ) data = result['Value'] fname = "%s_%sSandbox.tar" % (str(jobID),sbType) response.headers['Content-type'] = 'application/x-tar' response.headers['Content-Disposition'] = 'attachment; filename="%s"' % fname response.headers['Content-Length'] = len( data ) return data
def getSandbox(self): """ Get job sandbox """ if 'jobID' not in request.params: c.error = "Maybe you forgot the jobID ?" return render("/error.mako") jobID = int(request.params['jobID']) sbType = 'Output' if 'sandbox' in request.params: sbType = str(request.params['sandbox']) client = SandboxStoreClient(useCertificates=True, delegatedDN=str(credentials.getUserDN()), delegatedGroup=str( credentials.getSelectedGroup()), setup=credentials.getSelectedSetup()) result = client.downloadSandboxForJob(jobID, sbType, inMemory=True) if not result['OK']: c.error = "Error: %s" % result['Message'] return render("/error.mako") data = result['Value'] fname = "%s_%sSandbox.tar" % (str(jobID), sbType) response.headers['Content-type'] = 'application/x-tar' response.headers[ 'Content-Disposition'] = 'attachment; filename="%s"' % fname response.headers['Content-Length'] = len(data) return data
def test_SSCChain(): """full test of functionalities""" ssc = SandboxStoreClient() smDB = SandboxMetadataDB() exeScriptLocation = find_all("exe-script.py", "..", "/DIRAC/tests/Integration")[0] fileList = [exeScriptLocation] res = ssc.uploadFilesAsSandbox(fileList) assert res["OK"] is True, res["Message"] # SEPFN = res['Value'].split( '|' )[1] res = ssc.uploadFilesAsSandboxForJob(fileList, 1, "Input") assert res["OK"] is True, res["Message"] res = ssc.downloadSandboxForJob(1, "Input") # to run this we need the RSS on print(res) # for debug... assert res["OK"] is True, res["Message"] # only ones needing the DB res = smDB.getUnusedSandboxes() print(res) assert res["OK"] is True, res["Message"]
def test_SSCChain(self): """ full test of functionalities """ ssc = SandboxStoreClient() smDB = SandboxMetadataDB() exeScriptLocation = find_all('exe-script.py', '..', '/DIRAC/tests/Integration')[0] fileList = [exeScriptLocation] res = ssc.uploadFilesAsSandbox(fileList) assert res['OK'] is True # SEPFN = res['Value'].split( '|' )[1] res = ssc.uploadFilesAsSandboxForJob(fileList, 1, 'Input') assert res['OK'] is True res = ssc.downloadSandboxForJob(1, 'Input') # to run this we need the RSS on print res # for debug... assert res['OK'] is True # only ones needing the DB res = smDB.getUnusedSandboxes() print res assert res['OK'] is True
def test_SSCChain(self): """ full test of functionalities """ ssc = SandboxStoreClient() smDB = SandboxMetadataDB() exeScriptLocation = find_all('exe-script.py', '..', '/DIRAC/tests/Integration')[0] fileList = [exeScriptLocation] res = ssc.uploadFilesAsSandbox(fileList) assert res['OK'] is True # SEPFN = res['Value'].split( '|' )[1] res = ssc.uploadFilesAsSandboxForJob(fileList, 1, 'Input') assert res['OK'] is True res = ssc.downloadSandboxForJob(1, 'Input') # to run this we need the RSS on print(res) # for debug... assert res['OK'] is True # only ones needing the DB res = smDB.getUnusedSandboxes() print(res) assert res['OK'] is True