Skip to content
Snippets Groups Projects
Commit 4844cff1 authored by Federico Stagni's avatar Federico Stagni
Browse files

fix for stupid formats of output directories

parent 2241551a
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,8 @@
:synopsis: clean up of finalised transformations
"""
import ast
# # from DIRAC
from DIRAC import S_OK, S_ERROR
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
......@@ -118,6 +120,10 @@ class TransformationCleaningAgent( DiracTCAgent ):
return res
directories = res['Value']
if isinstance(directories, basestring): #Check for (stupid) formats
directories = ast.literal_eval(directories)
if not isinstance(directories, list):
return S_ERROR("Wrong format of output directories")
if 'StorageUsage' in self.directoryLocations:
res = self.storageUsageClient.getStorageDirectories( '', '', transID, [] )
......@@ -130,12 +136,12 @@ class TransformationCleaningAgent( DiracTCAgent ):
if not directories:
self.log.info( "No output directories found" )
# FIXME: we should be removing from the list of directories those directories created for file types that are part of those:
# We should be removing from the list of directories those directories created for file types that are part of those:
# - uploaded (as output files)
# - not merged by subsequent steps
# but this is pretty difficult to identify at run time, so we better remove the "RemovingFiles" production status
# and replace it with a flush (this applies only to MC).
# For the moment we just have a created list
# So we just have a created list.
fileTypesToKeepDirs = []
for fileTypeToKeep in self.fileTypesToKeep:
fileTypesToKeepDirs.extend([x for x in directories if fileTypeToKeep in x])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment