예제 #1
0
    def test3NonTransfers(self):
        """Verify that temporary configurables leave nothing in the catalogue"""

        from AthExHelloWorld.AthExHelloWorldConf import HelloAlg

        name = 'test3NonTransfers'
        HelloWorld = HelloAlg(name)
        HelloWorld.MyInt = 666

        # adding, using, and subsequently removing to sequence should be a no-op
        seq = AlgSequence(name + 'Sequence')
        seq += HelloWorld
        getattr(seq, name).MyDouble = 2.71828
        exec 'del seq.%s' % name
        seq.setup()

        self.assert_(name not in JobOptionsSvc.getClients())

        del HelloWorld

        # oddity: give locals a kick to get the frame cleaned up
        locals()

        # after complete removal of the configurable, it should be history-less
        HelloWorld = HelloAlg(name)

        self.assertRaises(AttributeError, getattr, HelloWorld, 'MyInt')
        self.assertRaises(AttributeError, getattr, HelloWorld, 'MyDouble')
예제 #2
0
   def test3NonTransfers( self ):
      """Verify that temporary configurables leave nothing in the catalogue"""

      from AthExHelloWorld.AthExHelloWorldConf import HelloAlg

      name = 'test3NonTransfers'
      HelloWorld = HelloAlg( name )
      HelloWorld.MyInt = 666

    # adding, using, and subsequently removing to sequence should be a no-op
      seq = AlgSequence( name + 'Sequence' )
      seq += HelloWorld
      getattr(seq,name).MyDouble = 2.71828
      exec 'del seq.%s' % name
      seq.setup()

      self.assert_( name not in JobOptionsSvc.getClients() )

      del HelloWorld

    # oddity: give locals a kick to get the frame cleaned up
      locals()

    # after complete removal of the configurable, it should be history-less
      HelloWorld = HelloAlg( name )

      self.assertRaises( AttributeError, getattr, HelloWorld, 'MyInt' )
      self.assertRaises( AttributeError, getattr, HelloWorld, 'MyDouble' )
예제 #3
0
   def test1SetBuiltinTypes( self ):
      """Test setting of builtin types"""

      from AthExHelloWorld.AthExHelloWorldConf import HelloAlg

      HelloWorld = HelloAlg( 'HelloWorld' )

      HelloWorld.MyInt = 42
      HelloWorld.MyBool = True
      HelloWorld.MyDouble = 3.14159
      HelloWorld.MyStringVec = [ "Welcome", "to", "Athena", "Framework", "Tutorial" ]
      HelloWorld.MyStringVec += [ "!" ]
      HelloWorld.MyDict = { 'Bonjour'      : 'Guten Tag',
                            'Good Morning' : 'Bonjour' , 'one' : 'uno' }
      HelloWorld.MyDict[ "Goeiedag" ] = "Ni Hao"
      HelloWorld.MyTable = [ ( 1 , 1 ) , ( 2 , 4 ) , ( 3 , 9 ) ]
      HelloWorld.MyTable += [ ( 4, 16 ) ]
      HelloWorld.MyMatrix = [ [ 1, 2, 3 ],
                              [ 4, 5, 6 ] ]
      HelloWorld.MyMatrix += [ [ 7, 8, 9 ] ]

      HelloWorld.setup()

      self.assertEqual( HelloWorld.MyInt, 42 )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyInt', '42' ) )

      self.assertEqual( HelloWorld.MyBool, True )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyBool', 'True' ) )

      self.assertEqual( round( HelloWorld.MyDouble - 3.14159, 8 ), 0. )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyDouble', '3.14159' ) )

    # the following may be too sensitive to non-consequential changes in formatting
      self.assertEqual( HelloWorld.MyStringVec,
         [ "Welcome", "to", "Athena", "Framework", "Tutorial", "!" ] )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyStringVec',
         "['Welcome', 'to', 'Athena', 'Framework', 'Tutorial', '!']" ) )

      self.assertEqual( HelloWorld.MyDict,
         {'Bonjour': 'Guten Tag', 'one': 'uno', 'Goeiedag': 'Ni Hao', 'Good Morning': 'Bonjour'} )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyDict',
         "{'Bonjour': 'Guten Tag', 'one': 'uno', 'Goeiedag': 'Ni Hao', 'Good Morning': 'Bonjour'}" ) )
      self.assertEqual( HelloWorld.MyTable, [(1, 1), (2, 4), (3, 9), (4, 16)] )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyTable',
         "[(1, 1), (2, 4), (3, 9), (4, 16)]" ) )

      self.assertEqual( HelloWorld.MyMatrix, [[1, 2, 3], [4, 5, 6], [7, 8, 9]] )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyMatrix',
         "[[1, 2, 3], [4, 5, 6], [7, 8, 9]]" ) )
   def test1SetBuiltinTypes( self ):
      """Test setting of builtin types"""

      from AthExHelloWorld.AthExHelloWorldConf import HelloAlg

      HelloWorld = HelloAlg( 'HelloWorld' )

      HelloWorld.MyInt = 42
      HelloWorld.MyBool = True
      HelloWorld.MyDouble = 3.14159
      HelloWorld.MyStringVec = [ "Welcome", "to", "Athena", "Framework", "Tutorial" ]
      HelloWorld.MyStringVec += [ "!" ]
      HelloWorld.MyDict = { 'Bonjour'      : 'Guten Tag',
                            'Good Morning' : 'Bonjour' , 'one' : 'uno' }
      HelloWorld.MyDict[ "Goeiedag" ] = "Ni Hao"
      HelloWorld.MyTable = [ ( 1 , 1 ) , ( 2 , 4 ) , ( 3 , 9 ) ]
      HelloWorld.MyTable += [ ( 4, 16 ) ]
      HelloWorld.MyMatrix = [ [ 1, 2, 3 ],
                              [ 4, 5, 6 ] ]
      HelloWorld.MyMatrix += [ [ 7, 8, 9 ] ]

      HelloWorld.setup()

      self.assertEqual( HelloWorld.MyInt, 42 )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyInt', '42' ) )

      self.assertEqual( HelloWorld.MyBool, True )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyBool', 'True' ) )

      self.assertEqual( round( HelloWorld.MyDouble - 3.14159, 8 ), 0. )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyDouble', '3.14159' ) )

    # the following may be too sensitive to non-consequential changes in formatting
      self.assertEqual( HelloWorld.MyStringVec,
         [ "Welcome", "to", "Athena", "Framework", "Tutorial", "!" ] )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyStringVec',
         "['Welcome', 'to', 'Athena', 'Framework', 'Tutorial', '!']" ) )

      self.assertEqual( HelloWorld.MyDict,
         {'Bonjour': 'Guten Tag', 'one': 'uno', 'Goeiedag': 'Ni Hao', 'Good Morning': 'Bonjour'} )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyDict',
         "{'Bonjour': 'Guten Tag', 'one': 'uno', 'Goeiedag': 'Ni Hao', 'Good Morning': 'Bonjour'}" ) )
      self.assertEqual( HelloWorld.MyTable, [(1, 1), (2, 4), (3, 9), (4, 16)] )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyTable',
         "[(1, 1), (2, 4), (3, 9), (4, 16)]" ) )

      self.assertEqual( HelloWorld.MyMatrix, [[1, 2, 3], [4, 5, 6], [7, 8, 9]] )
      self.assert_( JobOptionsSvc.verify( 'HelloWorld', 'MyMatrix',
         "[[1, 2, 3], [4, 5, 6], [7, 8, 9]]" ) )
예제 #5
0
    def test4HistoryBehavior(self):
        """Verify that name-uniqueness is preserved"""

        from AthExHelloWorld.AthExHelloWorldConf import HelloAlg

        name, value = 'test3NonTransfers', 888888
        HelloWorld = HelloAlg(name)
        HelloWorld.MyInt = value

        Hello2 = HelloAlg(name)

        self.assertEqual(HelloWorld.MyInt, Hello2.MyInt)

        del HelloWorld
        self.assertEqual(Hello2.MyInt, value)
예제 #6
0
   def test4HistoryBehavior( self ):
      """Verify that name-uniqueness is preserved"""

      from AthExHelloWorld.AthExHelloWorldConf import HelloAlg

      name, value = 'test3NonTransfers', 888888
      HelloWorld = HelloAlg( name )
      HelloWorld.MyInt = value

      Hello2 = HelloAlg( name )

      self.assertEqual( HelloWorld.MyInt, Hello2.MyInt )

      del HelloWorld
      self.assertEqual( Hello2.MyInt, value )
예제 #7
0
    # Make MetaDataSvc an AddressProvider
    svcMgr.ProxyProviderSvc.ProviderNames += ["MetaDataSvc"]

    # enable IOVDbSvc to read metadata
    #svcMgr.MetaDataSvc.MetaDataContainer = "MetaDataHdr"
    #svcMgr.MetaDataSvc.MetaDataTools += [ "IOVDbMetaDataTool" ]

    MetaDataStore = svcMgr.MetaDataStore

#--------------------------------------------------------------
# Private Application Configuration options, replace with
# your configuration.
#--------------------------------------------------------------
from AthExHelloWorld.AthExHelloWorldConf import HelloAlg

HelloWorld = HelloAlg("HelloWorld")

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence += HelloWorld

#--------------------------------------------------------------
# Algorithms Private Options
#--------------------------------------------------------------

# For the genuine HelloWorld algorithm
HelloWorld.MyInt = 42
HelloWorld.MyBool = TRUE
HelloWorld.MyDouble = 3.14159
HelloWorld.MyStringVec = ["Welcome", "to", "Athena", "Framework", "Tutorial"]