diff --git a/src/aind_behavior_video_transformation/etl.py b/src/aind_behavior_video_transformation/etl.py index aef6b7d..f3372b9 100644 --- a/src/aind_behavior_video_transformation/etl.py +++ b/src/aind_behavior_video_transformation/etl.py @@ -94,21 +94,21 @@ def _run_compression( for params in convert_video_args ] for job in as_completed(jobs): - out_path, error = job.result() - if error: - error_traces.append(error) + result = job.result() + if isinstance(result, tuple): + error_traces.append(result[1]) else: - logging.info(f"FFmpeg job completed: {out_path}") + logging.info(f"FFmpeg job completed: {result}") else: # Execute serially for params in convert_video_args: - out_path, error = convert_video( + result = convert_video( *params, self.job_settings.ffmpeg_thread_cnt ) - if error: - error_traces.append(error) + if isinstance(result, tuple): + error_traces.append(result[1]) else: - logging.info(f"FFmpeg job completed: {out_path}") + logging.info(f"FFmpeg job completed: {result}") if error_traces: for e in error_traces: diff --git a/src/aind_behavior_video_transformation/transform_videos.py b/src/aind_behavior_video_transformation/transform_videos.py index df00037..611d917 100644 --- a/src/aind_behavior_video_transformation/transform_videos.py +++ b/src/aind_behavior_video_transformation/transform_videos.py @@ -19,7 +19,7 @@ from os import symlink from pathlib import Path from subprocess import CalledProcessError -from typing import Optional, Tuple +from typing import Optional, Tuple, Union from pydantic import BaseModel, Field @@ -190,7 +190,7 @@ def convert_video( output_dir: Path, arg_set: Optional[Tuple[str, str]], ffmpeg_thread_cnt: int = 0, -) -> tuple[str, Optional[str]]: +) -> Union[str, Tuple[str, str]]: """ Converts a video to a specified format using ffmpeg. @@ -245,7 +245,7 @@ def convert_video( subprocess.run( ffmpeg_command, check=True, capture_output=True, text=True ) - return (str(out_path), None) + return str(out_path) except CalledProcessError as e: error_msg = (