当前位置: 首页>>代码示例>>Python>>正文


Python RequestContainer._getLastOrder方法代码示例

本文整理汇总了Python中DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer._getLastOrder方法的典型用法代码示例。如果您正苦于以下问题:Python RequestContainer._getLastOrder方法的具体用法?Python RequestContainer._getLastOrder怎么用?Python RequestContainer._getLastOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer的用法示例。


在下文中一共展示了RequestContainer._getLastOrder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test__getLastOrder

# 需要导入模块: from DIRAC.RequestManagementSystem.Client.RequestContainer import RequestContainer [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer import _getLastOrder [as 别名]
  def test__getLastOrder(self):
    # no files
    req = RequestContainer()
    res = req._getLastOrder()
    self.assertEqual( res, 0 )

    self.assertEqual( req.subRequests, {} )

    req.addSubRequest( {'Attributes':{'Operation':'replicateAndRegister',
                                      'TargetSE':'SE', 'ExecutionOrder': 0}},
                      'transfer' )
    res = req._getLastOrder()
    self.assertEqual( res, 0 )

    req.addSubRequest( {'Attributes':{'Operation':'replicateAndRegister',
                                      'TargetSE':'SE', 'ExecutionOrder': 1}},
                      'transfer' )
    res = req._getLastOrder()
    self.assertEqual( res, 1 )

    del( req )

    # with files
    req = RequestContainer()
    res = req._getLastOrder( 'foo' )
    self.assertEqual( res, 0 )

    req.addSubRequest( {'Attributes':{'Operation':'replicateAndRegister',
                                      'TargetSE':'SE', 'ExecutionOrder': 1}},
                      'transfer' )
    res = req._getLastOrder( 'foo' )
    self.assertEqual( res, 0 )

    req.setSubRequestFiles( 0, 'transfer', [{'LFN':'foo', 'Status':'Waiting'}] )
    res = req._getLastOrder( 'foo' )
    self.assertEqual( res, 1 )


    req.addSubRequest( {'Attributes':{'Operation':'replicateAndRegister',
                                      'TargetSE':'SE', 'ExecutionOrder': 2}},
                      'removal' )
    res = req._getLastOrder( 'foo' )
    self.assertEqual( res, 1 )

    req.setSubRequestFiles( 0, 'removal', [{'LFN':'foo', 'Status':'Waiting'}] )
    res = req._getLastOrder( 'foo' )
    self.assertEqual( res, 2 )
开发者ID:IgorPelevanyuk,项目名称:DIRAC,代码行数:49,代码来源:Test_Client.py

示例2: test__getLastOrder

# 需要导入模块: from DIRAC.RequestManagementSystem.Client.RequestContainer import RequestContainer [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer import _getLastOrder [as 别名]
    def test__getLastOrder(self):
        # no files
        req = RequestContainer()
        res = req._getLastOrder()
        self.assertEqual(res, 0)

        self.assertEqual(req.subRequests, {})

        req.addSubRequest(
            {"Attributes": {"Operation": "replicateAndRegister", "TargetSE": "SE", "ExecutionOrder": 0}}, "transfer"
        )
        res = req._getLastOrder()
        self.assertEqual(res, 0)

        req.addSubRequest(
            {"Attributes": {"Operation": "replicateAndRegister", "TargetSE": "SE", "ExecutionOrder": 1}}, "transfer"
        )
        res = req._getLastOrder()
        self.assertEqual(res, 1)

        del (req)

        # with files
        req = RequestContainer()
        res = req._getLastOrder("foo")
        self.assertEqual(res, 0)

        req.addSubRequest(
            {"Attributes": {"Operation": "replicateAndRegister", "TargetSE": "SE", "ExecutionOrder": 1}}, "transfer"
        )
        res = req._getLastOrder("foo")
        self.assertEqual(res, 0)

        req.setSubRequestFiles(0, "transfer", [{"LFN": "foo", "Status": "Waiting"}])
        res = req._getLastOrder("foo")
        self.assertEqual(res, 1)

        req.addSubRequest(
            {"Attributes": {"Operation": "replicateAndRegister", "TargetSE": "SE", "ExecutionOrder": 2}}, "removal"
        )
        res = req._getLastOrder("foo")
        self.assertEqual(res, 1)

        req.setSubRequestFiles(0, "removal", [{"LFN": "foo", "Status": "Waiting"}])
        res = req._getLastOrder("foo")
        self.assertEqual(res, 2)
开发者ID:kanwx,项目名称:DIRAC,代码行数:48,代码来源:Test_Client.py

示例3: test_addSubRequest

# 需要导入模块: from DIRAC.RequestManagementSystem.Client.RequestContainer import RequestContainer [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer import _getLastOrder [as 别名]

#.........这里部分代码省略.........
                                       {
                                        'Files': [],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 2,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': ''},
                                        'Datasets': []
                                        },
                                       ]
                          }
    self.assertEqual( rc_o.subRequests, subRequestExpected )

    fileDict = {'LFN':'foo', 'Status':'Waiting'}
    rc_o.setSubRequestFiles( op1_Index, 'someType', [fileDict] )

    subRequestExpected = {
                          'someType':
                                      [
                                       {
                                        'Files': [{'LFN':'foo', 'Status':'Waiting'}],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 0,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': 'op1'},
                                        'Datasets': []
                                        },
                                       {
                                        'Files': [],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 0,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': 'op2'},
                                        'Datasets': []
                                        },
                                       {
                                        'Files': [],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 1,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': ''},
                                        'Datasets': []
                                        }
                                      ],
                          'someOtherType':
                                      [
                                       {
                                        'Files': [],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 2,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': ''},
                                        'Datasets': []
                                        },
                                       ]
                          }
    self.assertEqual( rc_o.subRequests, subRequestExpected )

    fileLastOp = rc_o._getLastOrder( 'foo' )
    rc_o.addSubRequest( {'Attributes': {'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743', 'ExecutionOrder': fileLastOp + 1}},
                        'someOtherType' )

    subRequestExpected = {
                          'someType':
                                      [
                                       {
                                        'Files': [{'LFN':'foo', 'Status':'Waiting'}],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 0,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': 'op1'},
                                        'Datasets': []
                                        },
                                       {
                                        'Files': [],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 0,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': 'op2'},
                                        'Datasets': []
                                        },
                                       {
                                        'Files': [],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 1,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': ''},
                                        'Datasets': []
                                        }
                                      ],
                          'someOtherType':
                                      [
                                       {
                                        'Files': [],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 2,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': ''},
                                        'Datasets': []
                                        },
                                       {
                                        'Files': [],
                                        'Attributes': {'Status': 'Waiting', 'LastUpdate': '', 'TargetSE': '', 'ExecutionOrder': 1,
                                                       'SubRequestID': 'x', 'CreationTime': '2012-06-06 14:53:43.763743',
                                                       'Catalogue': '', 'Error': '', 'Operation': ''},
                                        'Datasets': []
                                        },
                                       ]
                          }
    self.assertEqual( rc_o.subRequests, subRequestExpected )
开发者ID:bmb,项目名称:DIRAC,代码行数:104,代码来源:Test_Client.py

示例4: test_addSubRequest

# 需要导入模块: from DIRAC.RequestManagementSystem.Client.RequestContainer import RequestContainer [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer import _getLastOrder [as 别名]

#.........这里部分代码省略.........
                        "Status": "Waiting",
                        "LastUpdate": "",
                        "TargetSE": "",
                        "ExecutionOrder": 1,
                        "SubRequestID": "x",
                        "CreationTime": "2012-06-06 14:53:43.763743",
                        "Catalogue": "",
                        "Error": "",
                        "Operation": "",
                    },
                    "Datasets": [],
                },
            ],
            "someOtherType": [
                {
                    "Files": [],
                    "Attributes": {
                        "Status": "Waiting",
                        "LastUpdate": "",
                        "TargetSE": "",
                        "ExecutionOrder": 2,
                        "SubRequestID": "x",
                        "CreationTime": "2012-06-06 14:53:43.763743",
                        "Catalogue": "",
                        "Error": "",
                        "Operation": "",
                    },
                    "Datasets": [],
                }
            ],
        }
        self.assertEqual(rc_o.subRequests, subRequestExpected)

        fileLastOp = rc_o._getLastOrder("foo")
        rc_o.addSubRequest(
            {
                "Attributes": {
                    "SubRequestID": "x",
                    "CreationTime": "2012-06-06 14:53:43.763743",
                    "ExecutionOrder": fileLastOp + 1,
                }
            },
            "someOtherType",
        )

        subRequestExpected = {
            "someType": [
                {
                    "Files": [{"LFN": "foo", "Status": "Waiting"}],
                    "Attributes": {
                        "Status": "Waiting",
                        "LastUpdate": "",
                        "TargetSE": "",
                        "ExecutionOrder": 0,
                        "SubRequestID": "x",
                        "CreationTime": "2012-06-06 14:53:43.763743",
                        "Catalogue": "",
                        "Error": "",
                        "Operation": "op1",
                    },
                    "Datasets": [],
                },
                {
                    "Files": [],
                    "Attributes": {
                        "Status": "Waiting",
开发者ID:kanwx,项目名称:DIRAC,代码行数:70,代码来源:Test_Client.py


注:本文中的DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer._getLastOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。