Skip to content

Commit

Permalink
workflow celery
Browse files Browse the repository at this point in the history
  • Loading branch information
Ammarmoulla committed Oct 11, 2023
1 parent 68f69b7 commit ffec31b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
expose:
- '8000'
volumes:
- .env:.env
- .env:/video_text/.env
entrypoint: ./scripts/server-entrypoint.sh
depends_on:
- redis
Expand Down
4 changes: 3 additions & 1 deletion video/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ def encode_image(frame):
return base64.b64encode(frame).decode("utf-8")

def decode_image(frame):
return base64.decodebytes(frame.encode())
return base64.decodebytes(frame.encode())


10 changes: 8 additions & 2 deletions video/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ def process_clip(clip, text, x, y, fontsize):

processed_frames = []

# g = group(
# job = group([
# process_frame.s(frame, text, x, y, fontsize)
# ])

# )
# result = job.apply_async()

# result.ready() # have all subtasks completed?

# result.successful()
for frame in clip.iter_frames():
processed_frame = process_frame.delay(frame, text, x, y, fontsize).get()
processed_frames.append(processed_frame)
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit ffec31b

Please sign in to comment.