quasarstream/python-ffmpeg-video-streaming

cannot schedule new futures after interpreter shutdown when use cloud (s3) to upload outputs

hir4k opened this issue · 2 comments

hir4k commented

**app.py

import os
import pathlib
import ffmpeg_streaming
from ffmpeg_streaming import Formats, S3, CloudManager

BASE_DIR = str(pathlib.Path(__file__).parent)

INPUT_PATH = os.path.join(BASE_DIR, 'video.mp4')
OUTPUT_PATH = os.path.join(BASE_DIR, 'output')

video = ffmpeg_streaming.input(INPUT_PATH)
hls = video.hls(Formats.h264())
hls.auto_generate_representations()

s3 = S3(
    region_name='sgp1',
    aws_access_key_id='<hidden_for_security_reason>',
    aws_secret_access_key='<hidden_for_security_reason>'
)

save_to_s3 = CloudManager().add(s3, bucket_name="tokbee")

hls.output(clouds=save_to_s3)

** Error Log

app_1  | Error in atexit._run_exitfuncs:
app_1  | Traceback (most recent call last):
app_1  |   File "/usr/local/lib/python3.8/site-packages/ffmpeg_streaming/_clouds.py", line 59, in upload_directory
app_1  |     self.s3.upload_file(join(directory, file), bucket_name, join(folder, file).replace("\\", "/"))
app_1  |   File "/usr/local/lib/python3.8/site-packages/boto3/s3/inject.py", line 143, in upload_file
app_1  |     return transfer.upload_file(
app_1  |   File "/usr/local/lib/python3.8/site-packages/boto3/s3/transfer.py", line 284, in upload_file
app_1  |     future = self._manager.upload(
app_1  |   File "/usr/local/lib/python3.8/site-packages/s3transfer/manager.py", line 330, in upload
app_1  |     return self._submit_transfer(
app_1  |   File "/usr/local/lib/python3.8/site-packages/s3transfer/manager.py", line 525, in _submit_transfer
app_1  |     self._submission_executor.submit(
app_1  |   File "/usr/local/lib/python3.8/site-packages/s3transfer/futures.py", line 474, in submit
app_1  |     future = ExecutorFuture(self._executor.submit(task))
app_1  |   File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 181, in submit
app_1  |     raise RuntimeError('cannot schedule new futures after '
app_1  | RuntimeError: cannot schedule new futures after interpreter shutdown
hls_transcoder_pro_app_1 exited with code 0

I am also facing same issue ,please do needful

Thank you for the report.
I am going to refactor this library and I will consider your bug report