Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions src/DIRAC/WorkloadManagementSystem/Client/DownloadInputData.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,20 +312,16 @@ def _downloadFromSE(self, lfn, seName, reps, guid):
self.__cleanFailedFile(lfn, downloadDir)
return result

if os.path.exists(localFile):
self.log.verbose("File successfully downloaded locally", f"({lfn} to {localFile})")
fileDict = {
"turl": "Downloaded",
"protocol": "Downloaded",
"se": seName,
"pfn": reps[seName],
"guid": guid,
"path": localFile,
}
return S_OK(fileDict)
else:
self.log.warn("File does not exist in local directory after download")
return S_ERROR("OK download result but file missing in current directory")
self.log.verbose("File successfully downloaded locally", f"({lfn} to {localFile})")
fileDict = {
"turl": "Downloaded",
"protocol": "Downloaded",
"se": seName,
"pfn": reps[seName],
"guid": guid,
"path": localFile,
}
return S_OK(fileDict)

#############################################################################
def __setJobParam(self, name, value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ def osPathExists(mocker):
return osPathMock


def test_DLIDownloadFromSE_fail(dli, mockSE, osPathExists):
osPathExists.return_value = False
res = dli._downloadFromSE("/a/lfn/1.txt", "mySE", {"mySE": []}, "aGuid")
assert not res["OK"]


def test_DLIDownloadFromSE_local(dli, mockSE, osPathExists):
res = dli._downloadFromSE("/a/lfn/1.txt", "mySE", {"mySE": []}, "aGuid")
assert res["OK"], res
Expand Down Expand Up @@ -109,12 +103,6 @@ def test_DLIDownloadFromBestSE_isLocal(dli, mockSE, osPathExists):
assert res["Value"]["protocol"] == "LocalData"


def test_DLIDownloadFromBestSE_Fail(dli, mockSE, osPathExists):
osPathExists.return_value = False
res = dli._downloadFromBestSE("/a/lfn/1.txt", {"mySE": []}, "aGuid")
assert not res["OK"]


def test_DLI_execute(mocker, dli, mockSE):
mocker.patch("DIRAC.WorkloadManagementSystem.Client.DownloadInputData.gConfig.getValue", return_value=2)
dli._downloadFromSE = MagicMock(return_value=S_OK({"path": "/local/path/1.txt"}))
Expand Down
Loading