本文整理汇总了Python中DIRAC.RequestManagementSystem.Client.Request.Request.RequestID方法的典型用法代码示例。如果您正苦于以下问题:Python Request.RequestID方法的具体用法?Python Request.RequestID怎么用?Python Request.RequestID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.RequestManagementSystem.Client.Request.Request
的用法示例。
在下文中一共展示了Request.RequestID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test02Props
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.Request import Request [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.Request.Request import RequestID [as 别名]
def test02Props( self ):
""" props """
# # valid values
req = Request()
req.RequestID = 1
self.assertEqual( req.RequestID, 1 )
req.RequestName = "test"
self.assertEqual( req.RequestName, "test" )
req.JobID = 1
self.assertEqual( req.JobID, 1 )
req.CreationTime = "1970-01-01 00:00:00"
self.assertEqual( req.CreationTime, datetime.datetime( 1970, 1, 1, 0, 0, 0 ) )
req.CreationTime = datetime.datetime( 1970, 1, 1, 0, 0, 0 )
self.assertEqual( req.CreationTime, datetime.datetime( 1970, 1, 1, 0, 0, 0 ) )
req.SubmitTime = "1970-01-01 00:00:00"
self.assertEqual( req.SubmitTime, datetime.datetime( 1970, 1, 1, 0, 0, 0 ) )
req.SubmitTime = datetime.datetime( 1970, 1, 1, 0, 0, 0 )
self.assertEqual( req.SubmitTime, datetime.datetime( 1970, 1, 1, 0, 0, 0 ) )
req.LastUpdate = "1970-01-01 00:00:00"
self.assertEqual( req.LastUpdate, datetime.datetime( 1970, 1, 1, 0, 0, 0 ) )
req.LastUpdate = datetime.datetime( 1970, 1, 1, 0, 0, 0 )
self.assertEqual( req.LastUpdate, datetime.datetime( 1970, 1, 1, 0, 0, 0 ) )
req.Error = ""
示例2: test01CtorSerilization
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.Request import Request [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.Request.Request import RequestID [as 别名]
def test01CtorSerilization( self ):
""" c'tor and serialization """
# # empty c'tor
req = Request()
self.assertEqual( isinstance( req, Request ), True )
self.assertEqual( req.JobID, 0 )
self.assertEqual( req.Status, "Waiting" )
req = Request( self.fromDict )
self.assertEqual( isinstance( req, Request ), True )
self.assertEqual( req.RequestName, "test" )
self.assertEqual( req.JobID, 12345 )
self.assertEqual( req.Status, "Waiting" )
toJSON = req.toJSON()
self.assertEqual( toJSON["OK"], True, "JSON serialization failed" )
fromJSON = toJSON["Value"]
req = Request( fromJSON )
toSQL = req.toSQL()
self.assertEqual( toSQL["OK"], True )
toSQL = toSQL["Value"]
self.assertEqual( toSQL.startswith( "INSERT" ), True )
req.RequestID = 1
toSQL = req.toSQL()
self.assertEqual( toSQL["OK"], True )
toSQL = toSQL["Value"]
self.assertEqual( toSQL.startswith( "UPDATE" ), True )
示例3: test03sql
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.Request import Request [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.Request.Request import RequestID [as 别名]
def test03sql( self ):
""" sql insert or update """
operation = Operation()
operation.Type = "ReplicateAndRegister"
request = Request()
request.RequestName = "testRequest"
request.RequestID = 1
# # no parent request set
try:
operation.toSQL()
except Exception, error:
self.assertEqual( isinstance( error, AttributeError ), True, "wrong exc raised" )
self.assertEqual( str( error ), "RequestID not set", "wrong exc reason" )
示例4: test07List
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.Request import Request [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.Request.Request import RequestID [as 别名]
def test07List( self ):
""" setitem, delitem, getitem and dirty """
r = Request()
ops = [ Operation() for i in range( 5 ) ]
for op in ops:
r.addOperation( op )
for i, op in enumerate( ops ):
self.assertEqual( op, r[i], "__getitem__ failed" )
op = Operation()
r[0] = op
self.assertEqual( op, r[0], "__setitem__ failed" )
del r[0]
self.assertEqual( len( r ), 4, "__delitem__ failed" )
r.RequestID = 1
del r[0]
self.assertEqual( r.cleanUpSQL(), None, "cleanUpSQL failed after __delitem__ (no opId)" )
r[0].OperationID = 1
del r[0]
clean = r.cleanUpSQL()
self.assertEqual( clean,
['DELETE FROM `Operation` WHERE `RequestID`=1 AND `OperationID` IN (1);\n',
'DELETE FROM `File` WHERE `OperationID`=1;\n'],
"cleanUpSQL failed after __delitem__ (opId set)\n%s" % clean )
r[0].OperationID = 2
r[0] = Operation()
clean = r.cleanUpSQL()
self.assertEqual( clean,
['DELETE FROM `Operation` WHERE `RequestID`=1 AND `OperationID` IN (1,2);\n',
'DELETE FROM `File` WHERE `OperationID`=1;\n', 'DELETE FROM `File` WHERE `OperationID`=2;\n'],
"cleanUpSQL failed after __setitem_ (opId set):\n%s" % clean )
json = r.toJSON()
self.assertEqual( "__dirty" in json["Value"], True, "__dirty missing in json" )
r2 = Request( json["Value"] )
self.assertEqual( r.cleanUpSQL(), r2.cleanUpSQL(), "wrong cleanUpSQL after json" )