コード例 #1
0
ファイル: naolibrary.py プロジェクト: epitechrennes/Hubs
 def isFinished( self, strPathAndFilenameXar, strHostName = 'localhost' ):
     mem = altools.myGetProxy( "ALMemory", strHostName = strHostName );
     try:
         valueResults = mem.getData( self.getVarName_Results( strPathAndFilenameXar ) );
         valueCancel = mem.getData( self.getVarName_SoftCancel( strPathAndFilenameXar ) ); # des fois le comportement appellé ne recoit pas que le softcancel a été raisé, donc on n'ajoute ici un test.
     except BaseException, err:
         altools.debug( "WNG: XarLoader.isFinished: return value not found for '%s:%s' (%s) => true" % ( strHostName, strPathAndFilenameXar, err ) );
         return True;
コード例 #2
0
ファイル: naolibrary.py プロジェクト: epitechrennes/Hubs
            if( timeFromBegin > rTimeOutInSec ):
                self.log( "WNG: launch: '%s:%s': timeout (elapsed: %5.3ss) (thread:%d)" % ( strHostName, strPathAndFilenameXar, timeFromBegin, nSimulatedThreadID ) );
                break;
            time.sleep( 0.1 );

        duration = time.time() - timeBegin;
        self.log( "INF: launch: %s: executing time: %fs (thread:%d)" % ( strPathAndFilenameXar, duration, nSimulatedThreadID ) );

        # the behavior is finished
        mem.raiseMicroEvent( self.getVarName_SoftCancel( strPathAndFilenameXar ), False ); # on le réinit pour le prochain lancement
        
        returnValue = None;
        try:
            returnValue = mem.getData( self.getVarName_Results( strPathAndFilenameXar ) );
        except BaseException, err:
            altools.debug( "WNG: XarLoader.launch: return value not found for '%s:%s' (%s) (thread:%d)" % ( strHostName, strPathAndFilenameXar, err, nSimulatedThreadID ) );
        nNumLoadedXar = self.find( strPathAndFilenameXar, strHostName );
        self.aLoadedXar[nNumLoadedXar][3] = False;            
        self.log( "INF: launch: Launching %s:%s - end (return value: %s) (thread:%d)" % ( strHostName, strPathAndFilenameXar, str(returnValue), nSimulatedThreadID ) );
        return [None, returnValue];
    # launch - end
    
    def stop( self, strPathAndFilenameXar, strHostName = 'localhost' ):
        "stop a running behavior"
        "return true if the behavior was really running"
        self.log( "INF: stop: Stopping %s:%s" % ( strHostName, strPathAndFilenameXar ) );
        nNumLoadedXar = self.find( strPathAndFilenameXar, strHostName );
        if( nNumLoadedXar == -1 ):
            self.log( "WNG: stop: xar '%s:%s' is not running (perhaps currently loading - in this case, it will be stopped at the end of the loading)" % ( strHostName, strPathAndFilenameXar) );  
            # don't return there !
        try: