Improve speed
This commit is contained in:
@@ -20,9 +20,9 @@ from app.algo_host.result_adapter import (
|
||||
)
|
||||
from app.algo_host.subprocess_runner import run_batch_main, run_visualization_script
|
||||
from app.algo_host.transcode import (
|
||||
ensure_batch_pipeline_input_video,
|
||||
is_browser_compatible_mp4,
|
||||
is_readable_mp4,
|
||||
stage_batch_pipeline_input,
|
||||
transcode_visualization_for_browser,
|
||||
)
|
||||
from app.domain.consumption import SurgeryConsumptionStored
|
||||
@@ -189,19 +189,23 @@ class BatchAlgorithmService:
|
||||
candidates = resolve_reference_candidates(candidate_consumables)
|
||||
candidate_key = candidate_cache_key(candidates)
|
||||
|
||||
surgery_input_dir = self._root_dir / surgery_id / "input"
|
||||
surgery_input_dir.mkdir(parents=True, exist_ok=True)
|
||||
surgery_input = surgery_input_dir / f"{digest[:12]}.mp4"
|
||||
ensure_batch_pipeline_input_video(
|
||||
pipeline_video = (
|
||||
self._root_dir
|
||||
/ "cache"
|
||||
/ digest
|
||||
/ "input"
|
||||
/ f"pipeline{uploaded_video_path.suffix or '.mp4'}"
|
||||
)
|
||||
stage_batch_pipeline_input(
|
||||
source_path=uploaded_video_path,
|
||||
dest_path=surgery_input,
|
||||
dest_path=pipeline_video,
|
||||
)
|
||||
|
||||
cache_dir = self._root_dir / "cache" / digest / candidate_key
|
||||
job = prepare_batch_job(
|
||||
bundle_dir=self._bundle_dir_override,
|
||||
cache_dir=cache_dir,
|
||||
uploaded_video_path=uploaded_video_path,
|
||||
pipeline_video_path=pipeline_video,
|
||||
candidate_consumables=candidates,
|
||||
)
|
||||
|
||||
@@ -240,7 +244,7 @@ class BatchAlgorithmService:
|
||||
return BatchRunResult(
|
||||
video_sha256=digest,
|
||||
candidate_cache_key=candidate_key,
|
||||
input_path=surgery_input,
|
||||
input_path=pipeline_video,
|
||||
work_dir=job.work_dir,
|
||||
output_path=job.output_path,
|
||||
details=details,
|
||||
|
||||
Reference in New Issue
Block a user