Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaiPetukhov committed Sep 12, 2024
1 parent 2ee78a9 commit f60e6e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions agent/worker/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,14 +689,14 @@ def update_base_layers(self):
)

def task_clear_tasks_dir(self):
if os.path.exists(constants.AGENT_TASKS_DIR() + "_to_remove"):
tmp_dir = constants.AGENT_TASKS_DIR() + "_to_remove"
if os.path.exists(tmp_dir):
self.logger.info(
"Start background task: Clearing Tasks data [_to_remove directory detected]"
)
try:
task_dir = constants.AGENT_TASKS_DIR() + "_to_remove"
for subdir_n in os.listdir(task_dir):
dir_task = os.path.join(task_dir, subdir_n)
for subdir_n in os.listdir(tmp_dir):
dir_task = os.path.join(tmp_dir, subdir_n)
TaskDirCleaner(dir_task).clean_forced()
except:
self.logger.warn("Background task error: Failed to clear tasks data", exc_info=True)
Expand All @@ -708,7 +708,6 @@ def task_clear_tasks_dir(self):
self.logger.info("Start background task: Clearing Tasks data")
try:
task_dir = constants.AGENT_TASKS_DIR()
tmp_dir = constants.AGENT_TASKS_DIR() + "_to_remove"
shutil.move(task_dir, tmp_dir)
os.makedirs(task_dir)
for subdir_n in os.listdir(tmp_dir):
Expand Down
2 changes: 1 addition & 1 deletion agent/worker/task_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def task_main_func(self):
"should_clean_tasks_data", optional_defaults[constants._SHOULD_CLEAN_TASKS_DATA]
)
envs[constants._SHOULD_CLEAN_PIP_CACHE] = self.info["config"].get(
"should_сlean_pip_cache", optional_defaults[constants._SHOULD_CLEAN_PIP_CACHE]
"should_clean_pip_cache", optional_defaults[constants._SHOULD_CLEAN_PIP_CACHE]
)
envs[constants._SHOULD_CLEAN_APPS_DATA] = self.info["config"].get(
"should_clean_apps_data", optional_defaults[constants._SHOULD_CLEAN_APPS_DATA]
Expand Down

0 comments on commit f60e6e4

Please sign in to comment.