diff --git a/arkindex/ponos/tasks.py b/arkindex/ponos/tasks.py index e7b57f5a55ab1cda01cb376a49ce0f77e7f532b2..c8ea34aa2bd0d322e71560b11675c91294609eb9 100644 --- a/arkindex/ponos/tasks.py +++ b/arkindex/ponos/tasks.py @@ -148,7 +148,20 @@ def run_docker_task(client, task, temp_dir): assert str(folder.resolve()) in str(path.resolve()), "Invalid artifact path: {artifact.path}." artifact.download_to(str(path)) - # 3. Do run the container asynchronously + # 3. Download extra_files + if task.extra_files: + logger.info(f"Downloading extra_files for task {task!s}") + try: + download_extra_files(task, temp_dir) + except Exception as e: + logger.warning( + f"Failed downloading extra_files for task {task!s}: {e!s}" + ) + task.state = State.Error + task.save() + return + + # 4. Do run the container asynchronously logger.debug("Running container") kwargs = { "environment": { @@ -179,19 +192,6 @@ def run_docker_task(client, task, temp_dir): task.state = State.Running task.save() - # 4. Download extra_files - if task.extra_files: - logger.info(f"Downloading extra_files for task {task!s}") - try: - download_extra_files(task, temp_dir) - except Exception as e: - logger.warning( - f"Failed downloading extra_files for task {task!s}: {e!s}" - ) - task.state = State.Error - task.save() - return - # 5. Read logs logger.debug("Reading logs from the docker container") previous_logs = b""