Skip to content

Commit

Permalink
category-counts: fix missing import and file name in jobs.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Nov 6, 2024
1 parent cedd962 commit 60c83ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion category-counts/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {bot, emailOnError, log} from "../botbase";
import {bot, emailOnError, log, fs} from "../botbase";
import {ApiQueryCategoryInfoParams} from "types-mediawiki/api_params";
import {ElasticDataStore} from "../elasticsearch";
import {getKey, normalizeCategory} from "./util";

(async function () {
log(`[i] Started`);
const countStore = new ElasticDataStore('category-counts-enwiki');
await bot.getTokensAndSiteInfo();

Expand Down Expand Up @@ -40,12 +41,14 @@ import {getKey, normalizeCategory} from "./util";
}
}
}
log(`[i] Finished updating data in ElasticSearch`)

// Backup data to NFS
process.chdir(__dirname);
fs.writeFileSync(
`backups/category-counts-backup-${new bot.Date().format('YYYY-MM-DD', 'utc')}.json`,
JSON.stringify(countStore.dump(), null, 2)
);
log(`[i] Finished backing up counts on disk`);

})().catch(err => emailOnError(err, 'cat-counts'));
2 changes: 1 addition & 1 deletion jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
- {"schedule": "25 1,5,9,13,17,21 * * *", "name": "db-tabulator", mem: "512Mi", "command": "~/SDZeroBot/job db-tabulator/main.js", "image": "node18", "emails": "onfailure"}
- {"schedule": "8 16 * * *", "name": "gans-list", mem: "256Mi", "command": "~/SDZeroBot/job most-gans/gans-lister.js", "image": "node18", "emails": "onfailure"}
- {"schedule": "0 4 * * *", "name": "shells", mem: "128Mi", "command": "~/SDZeroBot/job terminate-shell-pods.js", "image": "node18", "emails": "onfailure"}
- {"schedule": "15 1 * * *", "name": "cat-count", mem: "256Mi", "command": "~/SDZeroBot/job category-counter/main.js", "image": "node18", "emails": "onfailure"}
- {"schedule": "15 1 * * *", "name": "cat-count", mem: "256Mi", "command": "~/SDZeroBot/job category-counts/main.js", "image": "node18", "emails": "onfailure"}

0 comments on commit 60c83ce

Please sign in to comment.