コード例 #1
0
    def execute( self ):
        " Should return True if the execution completed successfully "
        self.fromScratch()

        self.ns.connect( 10 )
        self.ns.directLogin( 'TEST',
                             'netschedule_admin client_node=n1 '
                             'client_session=s1 control_port=732 '
                             'client_host=myhost' )
        self.ns.directSendCmd( 'AFLS' )
        reply = self.ns.directReadSingleReply()
        self.ns.disconnect()

        ns_admin = self.getNetScheduleService( 'TEST', 'scenario313' )
        info = getClientInfo( ns_admin, 'n1' )
        if info[ 'worker_node_control_port' ] != 732 or \
           info[ 'client_host' ] != 'myhost':
            raise Exception( "Unexpected client control "
                             "port and/or client host" )

        # Second connect to remove control port and host
        self.ns.connect( 10 )
        self.ns.directLogin( 'TEST',
                             'netschedule_admin client_node=n1 '
                             'client_session=s1' )
        self.ns.directSendCmd( 'AFLS' )
        reply = self.ns.directReadSingleReply()     # analysis:ignore
        self.ns.disconnect()
        info = getClientInfo( ns_admin, 'n1' )
        if info[ 'worker_node_control_port' ] != 'n/a' or \
           info[ 'client_host' ] != 'n/a':
            raise Exception( "Unexpected cleared client control "
                             "port and/or client host" )
        return True
コード例 #2
0
    def execute(self):
        " Should return True if the execution completed successfully "
        self.fromScratch(5)
        origJobID = self.ns.submitJob("TEST", "bla")

        jobID, authToken, attrs, jobInput = self.ns.getJob("TEST", -1, "", "", "node1", "session1")
        self.ns.failJob("TEST", jobID, authToken, 4, "blah-out", "blah-err", "node1", "session1")

        # Check that the job is in the blacklist for this client
        ns_client = self.getNetScheduleService("TEST", "scenario109")
        client = getClientInfo(ns_client, "node1")

        if "blacklisted_jobs" not in client:
            raise Exception("No blacklisted jobs found")
        if len(client["blacklisted_jobs"]) != 1:
            raise Exception("Unexpected number of blacklisted jobs")
        if client["blacklisted_jobs"][0].split()[0] != jobID:
            raise Exception("Unexpected job is in the blacklist")

        # wait till the job is gone from the blacklist
        time.sleep(6)

        # There is no more GET, but the job must not be in the blacklist

        # Check the blacklist again
        client = getClientInfo(ns_client, "node1")
        if "number_of_blacklisted_jobs" not in client:
            raise Exception("Expected no jobs in the blacklist, got something")
        if client["number_of_blacklisted_jobs"] != 0:
            raise Exception("Unexpected # of the blacklisted jobs. Expected 0.")

        return True
コード例 #3
0
    def execute( self ):
        " Should return True if the execution completed successfully "
        self.fromScratch()

        # First client holds a0 affinity
        ns_client = self.getNetScheduleService( 'TEST', 'scenario311' )
        ns_client.set_client_identification( 'node1', 'session1' )
        changeAffinity( ns_client, [ 'a0' ], [] )

        ns_admin = self.getNetScheduleService( 'TEST', 'scenario310' )

        affInfo = getAffinityInfo( ns_admin )
        if affInfo[ 'affinity_token' ] != 'a0':
            raise Exception( "Unexpected affinity registry content "
                             "after adding 1 preferred affinity (token)" )
        if 'clients__preferred' in affInfo:
            if affInfo[ 'clients__preferred' ] != [ 'node1' ]:
                raise Exception( "Unexpected affinity registry content "
                                "after adding 1 preferred affinity (node)" )
        if 'wn_clients__preferred' in affInfo:
            if affInfo[ 'wn_clients__preferred' ] != [ 'node1' ]:
                raise Exception( "Unexpected affinity registry content "
                                "after adding 1 preferred affinity (node)" )
        info = getClientInfo( ns_admin, 'node1' )
        if info[ 'preferred_affinities_reset' ] != False:
            raise Exception( "Expected to have preferred affinities non reset, "
                             "received: " +
                             str( info[ 'preferred_affinities_reset' ] ) )

        # Worker node timeout is 5 sec
        time.sleep( 7 )

        info = getClientInfo( ns_admin, 'node1' )
        if info[ 'preferred_affinities_reset' ] != True:
            raise Exception( "Expected to have preferred affinities reset, "
                             "received: " +
                             str( info[ 'preferred_affinities_reset' ] ) )

        affInfo = getAffinityInfo( ns_admin )
        if affInfo[ 'affinity_token' ] != 'a0':
            raise Exception( "Unexpected affinity registry content "
                             "after worker node is expired (token)" )
        if 'clients__preferred' in affInfo:
            if affInfo[ 'clients__preferred' ] != None:
                raise Exception( "Unexpected affinity registry content "
                                 "after worker node is expired (node)" )
        if 'wn_clients__preferred' in affInfo:
            if affInfo[ 'wn_clients__preferred' ] != None:
                raise Exception( "Unexpected affinity registry content "
                                 "after worker node is expired (node)" )

        try:
            output = execAny( ns_client,
                              'GET2 wnode_aff=1 any_aff=0 exclusive_new_aff=1' )
        except Exception, excpt:
            if "ePrefAffExpired" in str( excpt ) or "expired" in str( excpt ):
                return True
            raise
コード例 #4
0
    def execute(self):
        " Should return True if the execution completed successfully "
        self.fromScratch(7)

        ns_client = self.getNetScheduleService("TEST", "scenario603")
        ns_client.set_client_identification("mynode", "mysession")
        changeAffinity(ns_client, ["a1", "a2"], [])

        client = getClientInfo(ns_client, "mynode", verbose=False)
        if client["preferred_affinities_reset"] != False:
            raise Exception("Expected non-resetted preferred affinities")

        # wait till the worker node is expired
        time.sleep(12)

        client = getClientInfo(ns_client, "mynode", verbose=False)
        if client["preferred_affinities_reset"] != True:
            raise Exception("Expected resetted preferred affinities")
        if client["number_of_preferred_affinities"] != 0:
            raise Exception("Unexpected length of preferred_affinities")

        execAny(ns_client, "SETAFF")
        client = getClientInfo(ns_client, "mynode", verbose=False)

        if client["preferred_affinities_reset"] != False:
            raise Exception("Expected non-resetted preferred affinities" " after SETAFF")
        if client["number_of_preferred_affinities"] != 0:
            raise Exception("Unexpected length of preferred_affinities")

        execAny(ns_client, "SETAFF a4,a7")
        client = getClientInfo(ns_client, "mynode", verbose=False)
        if client["preferred_affinities_reset"] != False:
            raise Exception("Expected non-resetted preferred affinities" " after SETAFF")
        if client["number_of_preferred_affinities"] != 2:
            raise Exception("Unexpected length of preferred_affinities")

        return True
コード例 #5
0
    def execute( self ):
        " Should return True if the execution completed successfully "
        self.fromScratch()

        # First client holds a0 affinity
        ns_client = self.getNetScheduleService( 'TEST', 'scenario312' )
        ns_client.set_client_identification( 'node1', 'session1' )
        changeAffinity( ns_client, [ 'a0' ], [] )

        ns_admin = self.getNetScheduleService( 'TEST', 'scenario312' )

        execAny( ns_client,
                 'GET2 wnode_aff=1 any_aff=0 exclusive_new_aff=0 '
                 'port=9007 timeout=4' )

        info = getNotificationInfo( ns_admin )
        if info[ 'client_node' ] != 'node1':
            raise Exception( "Unexpected client in the notifications list: " +
                             info[ 'client_node' ] )

        # Worker node timeout is 5 sec
        time.sleep( 7 )

        info = getClientInfo( ns_admin, 'node1' )
        if info[ 'preferred_affinities_reset' ] != True:
            raise Exception( "Expected to have preferred affinities reset, "
                             "received: " +
                             str( info[ 'preferred_affinities_reset' ] ) )

        affInfo = getAffinityInfo( ns_admin )
        if affInfo[ 'affinity_token' ] != 'a0':
            raise Exception( "Unexpected affinity registry content "
                             "after worker node is expired (token)" )
        if 'clients__preferred' in affInfo:
            if affInfo[ 'clients__preferred' ] != None:
                raise Exception( "Unexpected affinity registry content "
                                 "after worker node is expired (node)" )
        if 'wn_clients__preferred' in affInfo:
            if affInfo[ 'wn_clients__preferred' ] != None:
                raise Exception( "Unexpected affinity registry content "
                                 "after worker node is expired (node)" )


        if getNotificationInfo( ns_admin, True, 0 ) != None:
            raise Exception( "Expected no notification, got some" )

        return True
コード例 #6
0
    def execute( self ):
        " Should return True if the execution completed successfully "
        self.fromScratch()

        # First client holds a0 affinity
        ns_client = self.getNetScheduleService( 'TEST', 'scenario310' )
        ns_client.set_client_identification( 'node1', 'session1' )
        changeAffinity( ns_client, [ 'a0' ], [] )

        # Worker node timeout is 5 sec
        time.sleep( 7 )

        ns_admin = self.getNetScheduleService( 'TEST', 'scenario310' )
        info = getClientInfo( ns_admin, 'node1' )
        if info[ 'preferred_affinities_reset' ] != True:
            raise Exception( "Expected to have preferred affinities reset, "
                             "received: " +
                             str( info[ 'preferred_affinities_reset' ] ) )
        return True