ncbo / ncbo_cron

Jobs that run on a regular basis in the NCBO infrastructure
Other
2 stars 6 forks source link

Spam deletion script broken in production (again) #75

Closed jvendetti closed 6 months ago

jvendetti commented 6 months ago

Attempting to execute the spam deletion script manually in production fails with a "Bad credentials" error message:

[ncbo-deployer@ncbo-prd-app-31 ncbo_cron]$ bin/ncbo_spam_deletion
(LD) >> Using rdf store ncbo-prd-ag-01:10035/repositories/bioportal
(LD) >> Using term search server at http://ncbo-prd-sol-01.stanford.edu:8983/solr/term_search_core1
(LD) >> Using property search server at http://ncbo-prd-sol-01.stanford.edu:8983/solr/prop_search_core1
(LD) >> Using HTTP Redis instance at ncbo-prd-rds-02.sunet:6380
(LD) >> Using Goo Redis instance at ncbo-prd-rds-03.sunet:6381
(AN) >> Using ANN Redis instance at ncbo-prd-rds-01.sunet:6379
(CNFG) >> OntologyRecommender not available, cannot load config
(CNFG) >> OntologiesAPI not available, cannot load config
(CR) >> Using Redis instance at localhost:6379
Processing details are logged to STDOUT
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    90  100    90    0     0    280      0 --:--:-- --:--:-- --:--:--   281
E, [2024-02-12T16:25:01.704420 #14798] ERROR -- :
Error while fetching the SPAM user list from https://api.github.com/repos/ncbo/documentation/contents/spam/spam_users.txt: {"message"=>"Bad credentials", "documentation_url"=>"https://docs.github.com/rest"}

Error while fetching the SPAM user list from https://api.github.com/repos/ncbo/documentation/contents/spam/spam_users.txt: {"message"=>"Bad credentials", "documentation_url"=>"https://docs.github.com/rest"}
E, [2024-02-12T16:25:01.704550 #14798] ERROR -- : Failed SPAM removal with exception: SystemExit: exit
/srv/ncbo/ncbo_cron/lib/ncbo_cron/spam_deletion.rb:36:in `exit'
/srv/ncbo/ncbo_cron/lib/ncbo_cron/spam_deletion.rb:36:in `run'
bin/ncbo_spam_deletion:50:in `<main>'
Failed SPAM removal with exception: SystemExit: exit
/srv/ncbo/ncbo_cron/lib/ncbo_cron/spam_deletion.rb:36:in `exit'
/srv/ncbo/ncbo_cron/lib/ncbo_cron/spam_deletion.rb:36:in `run'
bin/ncbo_spam_deletion:50:in `<main>'
alexskr commented 6 months ago

we are using Fine-grained personal access tokens for accessing the list of spam accounts. The max time for this type of PAT is 1 year and we don't have a robust mechanism for renewing it.

I manually renewed this PAT so script was able to run successfully