• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EsupPortail / Esup-Pod / 8874638856

29 Apr 2024 07:07AM UTC coverage: 70.223%. First build
8874638856

Pull #1085

github

web-flow
Bump pydantic from 1.10.11 to 1.10.13 (#1116)

Bumps [pydantic](https://github.com/pydantic/pydantic) from 1.10.11 to 1.10.13.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v1.10.11...v1.10.13)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Pull Request #1085: [DONE - FREEZE] Develop #3.6.0

744 of 994 new or added lines in 37 files covered. (74.85%)

10530 of 14995 relevant lines covered (70.22%)

0.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pod/video_encode_transcript/encoding_tasks.py
1
"""Esup-Pod encoding tasks."""
2

3
# pip3 install celery==5.2.7
4
# pip3 install webvtt-py
5
# pip3 install redis==4.5.4
6
from celery import Celery
×
7
import logging
×
8
import requests
×
9

10
# call local settings directly
11
# no need to load pod application to send statement
12
try:
×
13
    from ..custom import settings_local
×
14
except ImportError:
×
15
    from .. import settings as settings_local
×
16

17
EMAIL_HOST = getattr(settings_local, "EMAIL_HOST", "")
×
18
DEFAULT_FROM_EMAIL = getattr(settings_local, "DEFAULT_FROM_EMAIL", "")
×
19
ADMINS = getattr(settings_local, "ADMINS", ())
×
20
DEBUG = getattr(settings_local, "DEBUG", True)
×
21
TEST_REMOTE_ENCODE = getattr(settings_local, "TEST_REMOTE_ENCODE", False)
×
22

23
admins_email = [ad[1] for ad in ADMINS]
×
24

25
logger = logging.getLogger(__name__)
×
26
if DEBUG:
×
27
    logger.setLevel(logging.DEBUG)
×
28

29
smtp_handler = logging.handlers.SMTPHandler(
×
30
    mailhost=EMAIL_HOST,
31
    fromaddr=DEFAULT_FROM_EMAIL,
32
    toaddrs=admins_email,
33
    subject="[POD ENCODING] Encoding Log Mail",
34
)
35
if not TEST_REMOTE_ENCODE:
×
36
    logger.addHandler(smtp_handler)
×
37

38
ENCODING_TRANSCODING_CELERY_BROKER_URL = getattr(
×
39
    settings_local, "ENCODING_TRANSCODING_CELERY_BROKER_URL", ""
40
)
41
POD_API_URL = getattr(settings_local, "POD_API_URL", "")
×
42
POD_API_TOKEN = getattr(settings_local, "POD_API_TOKEN", "")
×
43
encoding_app = Celery("encoding_tasks", broker=ENCODING_TRANSCODING_CELERY_BROKER_URL)
×
44
encoding_app.conf.task_routes = {
×
45
    "pod.video_encode_transcript.encoding_tasks.*": {"queue": "encoding"}
46
}
47

48

49
# celery -A pod.video_encode_transcript.encoding_tasks worker -l INFO -Q encoding
50
@encoding_app.task
×
51
def start_encoding_task(
×
52
    video_id, video_path, cut_start, cut_end, json_dressing, dressing_input
53
):
54
    """Start the encoding of the video."""
55
    print("Start the encoding of the video")
×
56
    from .Encoding_video import Encoding_video
×
57

58
    print(video_id, video_path, cut_start, cut_end)
×
59
    encoding_video = Encoding_video(
×
60
        video_id, video_path, cut_start, cut_end, json_dressing, dressing_input
61
    )
62
    encoding_video.start_encode()
×
63
    print("End of the encoding of the video")
×
64
    Headers = {"Authorization": "Token %s" % POD_API_TOKEN}
×
65
    url = POD_API_URL.strip("/") + "/store_remote_encoded_video/?id=%s" % video_id
×
66
    data = {
×
67
        "start": encoding_video.start,
68
        "video_id": video_id,
69
        "video_path": video_path,
70
        "cut_start": cut_start,
71
        "cut_end": cut_end,
72
        "stop": encoding_video.stop,
73
        "json_dressing": json_dressing,
74
        "dressing_input": dressing_input,
75
    }
76
    try:
×
77
        response = requests.post(url, json=data, headers=Headers)
×
78
        if response.status_code != 200:
×
NEW
79
            msg = "Calling store remote encoding error: {} {}".format(
×
80
                response.status_code, response.reason
81
            )
82
            logger.error(msg + "\n" + str(response.content))
×
83
        else:
84
            logger.info("Call importing encoded task ok")
×
85
    except (
×
86
        requests.exceptions.HTTPError,
87
        requests.exceptions.ConnectionError,
88
        requests.exceptions.InvalidURL,
89
        requests.exceptions.Timeout,
90
    ) as exception:
91
        msg = "Exception: {}".format(type(exception).__name__)
×
92
        msg += "\nException message: {}".format(exception)
×
93
        logger.error(msg)
×
94

95

96
@encoding_app.task
×
97
def start_studio_task(recording_id, video_output, videos, subtime, presenter):
×
98
    from .encoding_studio import start_encode_video_studio
×
99

100
    print("Start the encoding studio of the video")
×
101
    msg = start_encode_video_studio(video_output, videos, subtime, presenter)
×
102
    print("End of the encoding studio of the video")
×
103
    Headers = {"Authorization": "Token %s" % POD_API_TOKEN}
×
104
    url = (
×
105
        POD_API_URL.strip("/")
106
        + "/store_remote_encoded_video_studio/?recording_id=%s" % recording_id
107
    )
108
    data = {
×
109
        "video_output": video_output,
110
        "msg": msg,
111
    }
112
    try:
×
113
        response = requests.post(url, json=data, headers=Headers)
×
114
        if response.status_code != 200:
×
NEW
115
            msg = "Calling store remote encoding studio error: {} {}".format(
×
116
                response.status_code, response.reason
117
            )
118
            logger.error(msg + "\n" + str(response.content))
×
119
        else:
120
            logger.info("Call importing encoded studio task ok")
×
121
    except (
×
122
        requests.exceptions.HTTPError,
123
        requests.exceptions.ConnectionError,
124
        requests.exceptions.InvalidURL,
125
        requests.exceptions.Timeout,
126
    ) as exception:
127
        msg = "Exception: {}".format(type(exception).__name__)
×
128
        msg += "\nException message: {}".format(exception)
×
129
        logger.error(msg)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc