mirror of
https://github.com/valitydev/yandex-tank.git
synced 2024-11-06 10:25:17 +00:00
Change work with tmp dirs
This commit is contained in:
parent
a31849c6c5
commit
14c6c9317d
@ -13,7 +13,6 @@ import tempfile
|
||||
import time
|
||||
import traceback
|
||||
|
||||
# FIXME: 1 remove lock in case of config format error
|
||||
# TODO: 2 add system resources busy check
|
||||
class ConsoleTank:
|
||||
"""
|
||||
|
@ -570,7 +570,6 @@ class PhantomInfoWidget(AbstractInfoWidget, AggregateResultListener):
|
||||
|
||||
self.RPS = second_aggregate_data.overall.RPS
|
||||
self.selfload = second_aggregate_data.overall.selfload
|
||||
self.log.debug("%s %s", second_aggregate_data.time.timetuple(), self.owner.phantom_start_time)
|
||||
self.time_lag = int(time.time() - time.mktime(second_aggregate_data.time.timetuple()))
|
||||
|
||||
|
||||
|
18
tankcore.py
18
tankcore.py
@ -323,12 +323,17 @@ class TankCore:
|
||||
self.log.debug("Collecting artifacts")
|
||||
if not self.artifacts_dir:
|
||||
date_str = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S.")
|
||||
self.artifacts_dir = tempfile.mkdtemp("", date_str, self.artifacts_base_dir)
|
||||
elif not os.path.isdir(self.artifacts_dir):
|
||||
self.artifacts_dir = tempfile.mkdtemp("", date_str, self.artifacts_base_dir)
|
||||
if not os.path.isdir(self.artifacts_dir):
|
||||
os.makedirs(self.artifacts_dir)
|
||||
os.chmod(self.artifacts_dir, 0744)
|
||||
|
||||
self.log.info("Artifacts dir: %s", self.artifacts_dir)
|
||||
for filename, keep in self.artifact_files.items():
|
||||
self.__collect_file(filename, keep)
|
||||
try:
|
||||
self.__collect_file(filename, keep)
|
||||
except Exception, ex:
|
||||
self.log.warn("Failed to collect file %s: %s", filename, ex)
|
||||
|
||||
def plugins_post_process(self, retcode):
|
||||
'''
|
||||
@ -457,6 +462,7 @@ class TankCore:
|
||||
raise RuntimeError("There is lock files")
|
||||
|
||||
self.lock_file = tempfile.mkstemp('.lock', 'lunapark_', self.LOCK_DIR)[1]
|
||||
os.chmod(self.lock_file, 0644)
|
||||
self.config.file = self.lock_file
|
||||
|
||||
|
||||
@ -484,17 +490,13 @@ class TankCore:
|
||||
except Exception, exc:
|
||||
self.log.debug("Failed to delete lock %s: %s", full_name, exc)
|
||||
else:
|
||||
retcode = True
|
||||
retcode = True
|
||||
except Exception, exc:
|
||||
self.log.warn("Failed to load info from lock %s: %s", full_name, exc)
|
||||
retcode = True
|
||||
return retcode
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ConfigManager:
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user