Commit bb6db51d authored by Manuela Kuhn's avatar Manuela Kuhn
Browse files

Added option to let file stay without copying (getFromFile)

parent 6c7e85bd
......@@ -138,5 +138,5 @@ localTarget = /space/projects/zeromq-data-transfer/data/target
storeData = True
# Flag describing if the files should be removed from the source
# (needed if dataFetcherType is getFromHttp)
# (needed if dataFetcherType is getFromFile or getFromHttp)
removeData = True
......@@ -436,6 +436,7 @@ class DataManager():
"type" : arguments.dataFetcherType,
"fixSubdirs" : arguments.fixSubdirs,
"storeData" : arguments.storeData,
"removeData" : arguments.removeData
}
elif arguments.dataFetcherType == "getFromZmq":
self.dataFetcherProp = {
......
......@@ -15,7 +15,8 @@ from send_helpers import __sendToTargets, DataHandlingError
def setup (log, prop):
if ( not prop.has_key("fixSubdirs") or
not prop.has_key("storeData") ):
not prop.has_key("storeData") or
not prop.has_key("removeData") ):
log.error ("Configuration of wrong format")
log.debug ("dataFetcherProp="+ str(prop))
......@@ -198,7 +199,7 @@ def finishDataHandling (log, targets, sourceFile, targetFile, metadata, openConn
targets_metadata = [i for i in targets if i[2] == "metadata"]
if prop["storeData"] and prop["removeFlag"]:
if prop["storeData"] and prop["removeData"] and prop["removeFlag"]:
# move file
try:
......@@ -207,15 +208,6 @@ def finishDataHandling (log, targets, sourceFile, targetFile, metadata, openConn
except:
return
#send message to metadata targets
if targets_metadata:
try:
__sendToTargets(log, targets_metadata, sourceFile, targetFile, openConnections, metadata, None, context, prop["timeout"])
log.debug("Passing metadata multipart-message for file " + str(sourceFile) + "...done.")
except:
log.error("Unable to send metadata multipart-message for file " + str(sourceFile), exc_info=True)
elif prop["storeData"]:
# copy file
......@@ -226,16 +218,7 @@ def finishDataHandling (log, targets, sourceFile, targetFile, metadata, openConn
except:
return
#send message to metadata targets
if targets_metadata:
try:
__sendToTargets(log, targets_metadata, sourceFile, targetFile, openConnections, metadata, None, context, prop["timeout"])
log.debug("Passing metadata multipart-message for file " + str(sourceFile) + "...done.")
except:
log.error("Unable to send metadata multipart-message for file " + str(sourceFile), exc_info=True)
elif prop["removeFlag"]:
elif prop["removeData"] and prop["removeFlag"]:
# remove file
try:
os.remove(sourceFile)
......@@ -245,14 +228,14 @@ def finishDataHandling (log, targets, sourceFile, targetFile, metadata, openConn
prop["removeFlag"] = False
#send message to metadata targets
if targets_metadata:
try:
__sendToTargets(log, targets_metadata, sourceFile, targetFile, openConnections, metadata, None, context, prop["timeout"] )
log.debug("Passing metadata multipart-message for file " + str(sourceFile) + "...done.")
#send message to metadata targets
if targets_metadata:
try:
__sendToTargets(log, targets_metadata, sourceFile, targetFile, openConnections, metadata, None, context, prop["timeout"] )
log.debug("Passing metadata multipart-message for file " + str(sourceFile) + "...done.")
except:
log.error("Unable to send metadata multipart-message for file " + str(sourceFile), exc_info=True)
except:
log.error("Unable to send metadata multipart-message for file " + str(sourceFile), exc_info=True)
def clean (prop):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment