diff --git a/src/plugins/intel_cpu/tools/commit_slider/commit_slider.py b/src/plugins/intel_cpu/tools/commit_slider/commit_slider.py index 4997795ad33..0c853ba0bec 100644 --- a/src/plugins/intel_cpu/tools/commit_slider/commit_slider.py +++ b/src/plugins/intel_cpu/tools/commit_slider/commit_slider.py @@ -41,7 +41,7 @@ else: if not os.path.exists(workPath): os.mkdir(workPath) else: - safeClearDir(workPath) + safeClearDir(workPath, cfgData) curPath = os.getcwd() copy_tree(curPath, workPath) scriptName = os.path.basename(__file__) @@ -54,12 +54,12 @@ else: # copy logs and cache back to general repo tempLogPath = cfgData["logPath"].format(workPath=workPath) permLogPath = cfgData["logPath"].format(workPath=curPath) - safeClearDir(permLogPath) + safeClearDir(permLogPath, cfgData) copy_tree(tempLogPath, permLogPath) tempCachePath = cfgData["cachePath"].format(workPath=workPath) permCachePath = cfgData["cachePath"].format(workPath=curPath) - safeClearDir(permCachePath) + safeClearDir(permCachePath, cfgData) copy_tree(tempCachePath, permCachePath) shutil.copyfile( @@ -67,4 +67,4 @@ else: os.path.join(curPath, customCfgPath), follow_symlinks=True, ) - safeClearDir(workPath) + safeClearDir(workPath, cfgData) diff --git a/src/plugins/intel_cpu/tools/commit_slider/utils/helpers.py b/src/plugins/intel_cpu/tools/commit_slider/utils/helpers.py index 89b350f6567..049da4201df 100644 --- a/src/plugins/intel_cpu/tools/commit_slider/utils/helpers.py +++ b/src/plugins/intel_cpu/tools/commit_slider/utils/helpers.py @@ -81,6 +81,7 @@ def absolutizePaths(cfg): pl = sys.platform if pl == "linux" or pl == "linux2": cfg["workPath"] = cfg["linWorkPath"] + cfg["os"] = "linux" elif pl == "win32": wp = cfg["winWorkPath"] wp = "echo {path}".format(path=wp) @@ -88,6 +89,7 @@ def absolutizePaths(cfg): wp = wp.decode() wp = wp.rstrip() cfg["workPath"] = wp + cfg["os"] = "win" else: raise CfgError( "No support for current OS: {pl}".format(pl=pl) @@ -199,7 +201,7 @@ def runCommandList(commit, cfgData, enforceClean=False): raise CmdError(checkOut) -def fetchAppOutput(cfg): +def fetchAppOutput(cfg, commit): newEnv = os.environ.copy() if "envVars" in cfg: for env in cfg["envVars"]: @@ -208,6 +210,10 @@ def fetchAppOutput(cfg): newEnv[envKey] = envVal appCmd = cfg["appCmd"] appPath = cfg["appPath"] + commitLogger = getCommitLogger(cfg, commit) + commitLogger.info("Run command: {command}".format( + command=appCmd) + ) p = subprocess.Popen( appCmd.split(), cwd=appPath, @@ -273,12 +279,12 @@ def getActualPath(pathName, cfg): return curPath.format(workPath=workPath) -def safeClearDir(path): +def safeClearDir(path, cfg): if not os.path.exists(path): os.makedirs(path) - try: + if cfg["os"] == "win": shutil.rmtree(path) - except PermissionError: + else: # WA, because of unstability of rmtree() # in linux environment p = subprocess.Popen( diff --git a/src/plugins/intel_cpu/tools/commit_slider/utils/modes.py b/src/plugins/intel_cpu/tools/commit_slider/utils/modes.py index 76a1279ce26..3bc119cb6c7 100644 --- a/src/plugins/intel_cpu/tools/commit_slider/utils/modes.py +++ b/src/plugins/intel_cpu/tools/commit_slider/utils/modes.py @@ -49,7 +49,7 @@ class CheckOutputMode(Mode): commit=commit) ) handleCommit(commit, cfg) - checkOut = fetchAppOutput(cfg) + checkOut = fetchAppOutput(cfg, commit) commitLogger.info(checkOut) self.setCommitCash(commit, checkOut) stopPattern = cfg["runConfig"]["stopPattern"] @@ -83,7 +83,7 @@ class BenchmarkAppPerformanceMode(Mode): foundThroughput = cashedThroughput else: runCommandList(sampleCommit, cfg, enforceClean=True) - output = fetchAppOutput(cfg) + output = fetchAppOutput(cfg, sampleCommit) commitLogger.info(output) foundThroughput = re.search( self.outPattern, output, flags=re.MULTILINE @@ -129,12 +129,12 @@ class BenchmarkAppPerformanceMode(Mode): commit=commit) ) handleCommit(commit, cfg) - output = fetchAppOutput(cfg) + output = fetchAppOutput(cfg, commit) + commitLogger.info(output) foundThroughput = re.search( self.outPattern, output, flags=re.MULTILINE ).group(1) curThroughput = float(foundThroughput) - commitLogger.info(output) self.setCommitCash(commit, curThroughput) return curThroughput @@ -170,7 +170,7 @@ class CompareBlobsMode(Mode): commit=commit) ) runCommandList(commit, cfg, enforceClean=True) - output = fetchAppOutput(cfg) + output = fetchAppOutput(cfg, commit) commitLogger.info(output) filename = self.setCommitCash(commit, None) return filename