Commit 5129896e authored by Andrea Sciaba's avatar Andrea Sciaba
Browse files

Updated to latest version

parent f8238606
......@@ -11,8 +11,8 @@ The object is instantiated with a directory that contains the task.
"""
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: TaskState.py,v 1.1 2007/02/19 15:11:52 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__revision__ = "$Id: TaskState.py,v 1.2 2007/03/12 10:13:28 asciaba Exp $"
__author__ = "evansde@fnal.gov"
......
......@@ -9,8 +9,8 @@ Runtime Safe.
"""
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: __init__.py,v 1.1 2007/02/19 15:11:52 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__revision__ = "$Id: __init__.py,v 1.2 2007/03/12 10:13:28 asciaba Exp $"
__author__ = "evansde@fnal.gov"
__all__ = []
......
......@@ -10,8 +10,8 @@ add an IMProv structure to a ScriptObject
ToDo - Add XPath search abilities to this object in future
"""
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: IMProvDoc.py,v 1.1 2007/02/19 15:12:28 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__revision__ = "$Id: IMProvDoc.py,v 1.2 2007/03/12 10:13:08 asciaba Exp $"
import os
......
......@@ -5,8 +5,8 @@ _IMProvException_
Exception classes for IMProv package
"""
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: IMProvException.py,v 1.1 2007/02/19 15:12:28 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__revision__ = "$Id: IMProvException.py,v 1.2 2007/03/12 10:13:08 asciaba Exp $"
import exceptions
import inspect
......
......@@ -7,8 +7,8 @@ Sax based parser for reading an IMProv XML file and
converting it into a tree of IMProvNodes
"""
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: IMProvLoader.py,v 1.1 2007/02/19 15:12:28 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__revision__ = "$Id: IMProvLoader.py,v 1.2 2007/03/12 10:13:08 asciaba Exp $"
from xml.sax.handler import ContentHandler
......
......@@ -5,8 +5,8 @@ _IMProvNode_
Dictionary based node container for constructing
IMProv Documents from
"""
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: IMProvNode.py,v 1.1 2007/02/19 15:12:28 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__revision__ = "$Id: IMProvNode.py,v 1.2 2007/03/12 10:13:08 asciaba Exp $"
from xml.dom.minidom import Element, Text
......
......@@ -6,8 +6,8 @@ Lightweight XPath like querying tool for extracting information
from an IMProvNode structure
"""
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: IMProvQuery.py,v 1.1 2007/02/19 15:12:28 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__revision__ = "$Id: IMProvQuery.py,v 1.2 2007/03/12 10:13:08 asciaba Exp $"
import re
......
......@@ -11,8 +11,8 @@ The first argument accepted by a Predicate Function must be
an IMProvNode instance.
"""
__revision__ = "$Id: PredicateFunctions.py,v 1.1 2007/02/19 15:12:28 asciaba Exp $"
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: PredicateFunctions.py,v 1.2 2007/03/12 10:13:08 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__author__ = "evansde@fnal.gov"
......
......@@ -5,8 +5,8 @@ _PredicateOperators_
Operator implementation for Predicates
"""
__revision__ = "$Id: PredicateOperators.py,v 1.1 2007/02/19 15:12:28 asciaba Exp $"
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: PredicateOperators.py,v 1.2 2007/03/12 10:13:08 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__author__ = "evansde@fnal.gov"
......
......@@ -8,8 +8,8 @@ a predicate object tree structure that can be evaluated on a
node
"""
__revision__ = "$Id: Predicates.py,v 1.1 2007/02/19 15:12:28 asciaba Exp $"
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: Predicates.py,v 1.2 2007/03/12 10:13:08 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__author__ = "evansde@fnal.gov"
import shlex
......
#!/usr/bin/env python
__version__ = "$Version$"
# $Id: __init__.py,v 1.1 2007/02/19 15:12:28 asciaba Exp $
# $Id: __init__.py,v 1.2 2007/03/12 10:13:08 asciaba Exp $
"""
......
#!/usr/bin/env python
"""
_RFCP1Impl_
Implementation of StageOutImpl interface for RFIO in Castor-1
"""
import os
from StageOut.Registry import registerStageOutImpl
from StageOut.StageOutImpl import StageOutImpl
from StageOut.Execute import runCommand
class RFCP1Impl(StageOutImpl):
"""
_RFCP1Impl_
Implement interface for rfcp command
"""
run = staticmethod(runCommand)
def createSourceName(self, protocol, pfn):
"""
_createSourceName_
uses pfn
"""
return "%s" % pfn
def createOutputDirectory(self, targetPFN):
"""
_createOutputDirectory_
create dir with group permission
"""
targetdir= os.path.dirname(targetPFN)
checkdircmd="rfstat %s > /dev/null " % targetdir
print "Check dir existence : %s" %checkdircmd
try:
checkdirexitCode = self.run(checkdircmd)
except Exception, ex:
msg = "Warning: Exception while invoking command:\n"
msg += "%s\n" % checkdircmd
msg += "Exception: %s\n" % str(ex)
msg += "Go on anyway..."
print msg
pass
if checkdirexitCode:
mkdircmd = "rfmkdir -m 775 -p %s" % targetdir
print "=> creating the dir : %s" %mkdircmd
try:
self.run(mkdircmd)
except Exception, ex:
msg = "Warning: Exception while invoking command:\n"
msg += "%s\n" % mkdircmd
msg += "Exception: %s\n" % str(ex)
msg += "Go on anyway..."
print msg
pass
else:
print "=> dir already exists... do nothing."
def createStageOutCommand(self, sourcePFN, targetPFN, options = None):
"""
_createStageOutCommand_
Build an rfcp command
"""
original_size = os.stat(sourcePFN)[6]
print "Local File Size is: %s" % original_size
result = "rfcp "
if options != None:
result += " %s " % options
result += " %s " % sourcePFN
result += " %s " % targetPFN
result += "; DEST_SIZE=`rfstat %s | grep Size | cut -f2 -d:` ; if [ $DEST_SIZE ] && [ '%s' == $DEST_SIZE ]; then exit 0; else echo \"Error: Size Mismatch between local and SE\"; exit 60311 ; fi " % (targetPFN,original_size)
return result
def removeFile(self, pfnToRemove):
"""
_removeFile_
CleanUp pfn provided: specific for Castor-1
"""
command = "stageclr -M %s ; nsrm %s" % pfnToRemove
self.executeCommand(command)
registerStageOutImpl("rfcp-1", RFCP1Impl)
#!/usr/bin/env python
"""
_RFCP2Impl_
Implementation of StageOutImpl interface for RFIO in Castor-2
"""
import os
from StageOut.Registry import registerStageOutImpl
from StageOut.StageOutImpl import StageOutImpl
from StageOut.Execute import runCommand
class RFCP2Impl(StageOutImpl):
"""
_RFCP2Impl_
Implement interface for rfcp command
"""
run = staticmethod(runCommand)
def createSourceName(self, protocol, pfn):
"""
_createSourceName_
uses pfn
"""
return "%s" % pfn
def createOutputDirectory(self, targetPFN):
"""
_createOutputDirectory_
create dir with group permission
"""
targetdir= os.path.dirname(targetPFN)
checkdircmd="rfstat %s > /dev/null " % targetdir
print "Check dir existence : %s" %checkdircmd
try:
checkdirexitCode = self.run(checkdircmd)
except Exception, ex:
msg = "Warning: Exception while invoking command:\n"
msg += "%s\n" % checkdircmd
msg += "Exception: %s\n" % str(ex)
msg += "Go on anyway..."
print msg
pass
if checkdirexitCode:
mkdircmd = "rfmkdir -m 775 -p %s" % targetdir
print "=> creating the dir : %s" %mkdircmd
try:
self.run(mkdircmd)
except Exception, ex:
msg = "Warning: Exception while invoking command:\n"
msg += "%s\n" % mkdircmd
msg += "Exception: %s\n" % str(ex)
msg += "Go on anyway..."
print msg
pass
else:
print "=> dir already exists... do nothing."
def createStageOutCommand(self, sourcePFN, targetPFN, options = None):
"""
_createStageOutCommand_
Build an rfcp command
"""
original_size = os.stat(sourcePFN)[6]
print "Local File Size is: %s" % original_size
result = "rfcp "
if options != None:
result += " %s " % options
result += " %s " % sourcePFN
result += " %s " % targetPFN
result += "; DEST_SIZE=`rfstat %s | grep Size | cut -f2 -d:` ; if [ $DEST_SIZE ] && [ '%s' == $DEST_SIZE ]; then exit 0; else echo \"Error: Size Mismatch between local and SE\"; exit 60311 ; fi " % (targetPFN,original_size)
return result
def removeFile(self, pfnToRemove):
"""
_removeFile_
CleanUp pfn provided: specific for Castor-1
"""
command = "stager_rm -M %s ; nsrm %s" % pfnToRemove
self.executeCommand(command)
registerStageOutImpl("rfcp-2", RFCP2Impl)
......@@ -19,4 +19,5 @@ __all__ = []
import SRMImpl
#import DCCPImpl
import RFCPImpl
#import RFIOImpl
import RFCP1Impl
import RFCP2Impl
......@@ -6,8 +6,8 @@ General Exception class for JC modules
"""
__version__ = "$Revision: 1.1 $"
__revision__ = "$Id: StageOutError.py,v 1.1 2007/02/19 15:08:10 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__revision__ = "$Id: StageOutError.py,v 1.2 2007/03/12 10:13:44 asciaba Exp $"
import exceptions
import inspect
......
......@@ -8,7 +8,7 @@ command name provided in the Site Config File
"""
__all__ = []
__revsion__ = "$Id: __init__.py,v 1.1 2007/02/19 15:08:10 asciaba Exp $"
__version__ = "$Revision: 1.1 $"
__revsion__ = "$Id: __init__.py,v 1.2 2007/03/12 10:13:44 asciaba Exp $"
__version__ = "$Revision: 1.2 $"
__author__ = "evansde@fnal.gov"
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