Skip to content

Commit 84e25c5

Browse files
authored
Merge pull request #380 from toolforge/fix/large-file-error
Improve error message for files that exceed 5 GiB
2 parents 9ed71a5 + 7561d8b commit 84e25c5

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

video2commons/backend/encode/globals.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@
2727
# The total amout of time a transcoding shell command can take:
2828
background_time_limit = 3600 * 24 * 2 # 2 days
2929

30-
# Maximum file size transcoding processes can create, in KB.
31-
background_size_limit = 10 * 1024 * 1024 # 10GB
30+
# Maximum file size transcoding processes can create, passed to `ulimit -f`.
31+
#
32+
# /bin/sh on the workers is dash, which uses 512-byte blocks (per POSIX).
33+
# Matches the Commons 5 GiB upload limit. Anything larger would fail to upload
34+
# anyway, so there's no point in allowing anything higher than that.
35+
background_size_limit = 10 * 1024 * 1024
3236

3337
# Number of hardware threads available to ffmpeg for transcoding.
3438
ffmpeg_threads = __import__("multiprocessing").cpu_count()

video2commons/frontend/errors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@
8888
"i18n_key": "segfault-error",
8989
"reportable": True,
9090
},
91+
{
92+
# This error happens when the ulimit restriction prevents a file larger
93+
# than the Commons 5 GiB upload limit from being written to disk.
94+
"pattern": r"Exitcode: 153$",
95+
"i18n_key": "output-too-large-error",
96+
"urls": ["https://commons.wikimedia.org/wiki/Commons:Maximum_file_size"],
97+
},
9198
]
9299

93100

video2commons/frontend/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"title-forbidden-error": "The title of the file is not allowed. Please upload the file using a different title. Check the {{#a}}file naming policy{{/a}} for more information.",
8080
"unsupported-format-error": "The file could not be encoded. This may be caused by unsupported formats or incompatible settings. Please report a bug so we can investigate.",
8181
"video-not-found-error": "The file cannot be found at the provided URL. Please create a new task with a different URL.",
82+
"output-too-large-error": "The output file is too large to be uploaded to Commons. Files larger than 5 GiB cannot be uploaded at this time. See the {{#a}}maximum file size{{/a}} page on Commons for more information.",
8283
"youtube-bot-error": "The video cannot be downloaded due to YouTube's bot detection. Please try again in 1-3 hours.",
8384
"youtube-private-error": "The video cannot be downloaded from YouTube as it is marked as private.",
8485
"youtube-ratelimit-error": "The video cannot be downloaded from YouTube due to rate limiting. Please try again in 1-3 hours."

video2commons/frontend/i18n/qqq.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"title-forbidden-error": "Semi-plain text shown as an error message in task results rows in the tasks table. There is a link in the text that links to the [[:commons:Commons:File_naming|file naming policy]] on [[:commons:|Commons]]. <code><nowiki>{{#a}}</nowiki></code> indicates the start of the link while <code><nowiki>{{/a}}</nowiki></code> indicates the end of the link.",
8787
"unsupported-format-error": "Plain text shown as an error message in task results rows in the tasks table.",
8888
"video-not-found-error": "Plain text shown as an error message in task results rows in the tasks table.",
89+
"output-too-large-error": "Plain text shown as an error message in task results rows in the tasks table. There is a link in the text that links to the [[:commons:Commons:Maximum_file_size|maximum file size]] page on [[:commons:|Commons]]. <code><nowiki>{{#a}}</nowiki></code> indicates the start of the link while <code><nowiki>{{/a}}</nowiki></code> indicates the end of the link.",
8990
"youtube-bot-error": "Plain text shown as an error message in task results rows in the tasks table.",
9091
"youtube-private-error": "Plain text shown as an error message in task results rows in the tasks table.",
9192
"youtube-ratelimit-error": "Plain text shown as an error message in task results rows in the tasks table."

0 commit comments

Comments
 (0)