-
Notifications
You must be signed in to change notification settings - Fork 0
Optimize news costs, translation latency, and crawl budget #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| [Unit] | ||
| Description=OddsFront asynchronous local news translation worker | ||
| After=network-online.target oddsfront-news.service | ||
| Wants=network-online.target | ||
| ConditionPathExists=/root/OddsFront/scripts/news/translate.py | ||
|
|
||
| [Service] | ||
| Type=oneshot | ||
| WorkingDirectory=/root/OddsFront | ||
| ExecStart=/root/OddsFront/.local/translation-venv/bin/python scripts/news/translate.py | ||
| ExecStartPost=-/usr/local/bin/node scripts/news/indexnow.mjs | ||
| ExecStartPost=-/usr/local/bin/node scripts/news/websub.mjs | ||
|
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If the bounded worker times out at 90 minutes or fails after exporting one or more languages, systemd does not execute Useful? React with 👍 / 👎. |
||
| Environment=NODE_ENV=production | ||
| Environment=PATH=/usr/local/bin:/usr/bin:/bin | ||
| Nice=10 | ||
| CPUQuota=200% | ||
| MemoryMax=2G | ||
| TasksMax=128 | ||
| PrivateTmp=true | ||
| NoNewPrivileges=true | ||
| ProtectSystem=strict | ||
| ProtectHome=read-only | ||
| ReadWritePaths=/root/OddsFront/.local/news /opt/oddsfront-market-feed/news /root/.codex | ||
| InaccessiblePaths=-/opt/arctrenches -/opt/arctrenches-legacy-6c13c07 -/root/DropsAnalytics -/root/DropsAnalytics-worktrees -/opt/sunder -/root/.ssh -/etc/oddsfront-market-feed.env | ||
| UMask=0077 | ||
| TimeoutStartSec=90min | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,11 @@ def select_pending_texts(active_articles, dictionary_texts, language, cache, cac | |
| article_pending.update(missing) | ||
| if len(article_pending) >= budget: | ||
| break | ||
| # Fresh, complete article translations are the search and readership | ||
| # priority. Do not delay their per-language export by filling the same | ||
| # inference pass with map labels or archive dictionary work. | ||
| if article_pending: | ||
| return sorted(article_pending) | ||
|
Comment on lines
+47
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When regular editions continue publishing, every worker invocation begins with missing article text, so this early return discards the remaining text budget and Useful? React with 👍 / 👎. |
||
| remaining = max(0, budget - len(article_pending)) | ||
| dictionary_pending = [ | ||
| text for text in sorted(dictionary_texts - article_pending) | ||
|
|
@@ -170,8 +175,8 @@ def backlog(language): | |
| owners.append(text) | ||
| translated = {text: [] for text in pending} | ||
| expected_pieces = Counter(owners) | ||
| for start in range(0, len(pieces), 16): | ||
| batch = pieces[start:start+16] | ||
| for start in range(0, len(pieces), 32): | ||
| batch = pieces[start:start+32] | ||
| results = translator.translate_batch(batch, target_prefix=[[f"__{target}__"] for _ in batch], beam_size=2, max_batch_size=512, batch_type="tokens", max_decoding_length=320, max_input_length=512, no_repeat_ngram_size=4) | ||
| for index, result in enumerate(results): | ||
| tokens = [token for token in result.hypotheses[0] if not token.startswith("__") and token not in ["</s>", "<s>"]] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sitemap-based
hreflang, each alternate URL must have its own<url><loc>entry and repeat the complete alternate set, including itself. Mapping every article to only the English URL here—and doing the same for listing, topic, and country pages above—leaves the localizedhrefvalues without reciprocal sitemap entries, so crawlers consuming the sitemap annotations cannot validate those language clusters and the localized pages are no longer directly submitted in the general sitemap.Useful? React with 👍 / 👎.