Created
November 20, 2024 05:31
-
-
Save vitalibaranov/e5b1270f557e005092df210db2b8672e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# скрипт полученяи id-к вакансии и инициатора для таски реимпорта | |
select hh_vacancy_id, coalesce(manager_id, initiator_id) as manager_id | |
from tms.external_vacancy_binding evb | |
join tms.hh_vacancy_import_task on external_vacancy_id::int = hh_vacancy_id | |
where evb.created_at > '2024-11-13' -- баг появился на проде 2024-11-14 | |
and evb.created_at < '2024-11-19' -- пофикшен 2024-11-18 | |
and vacancy_type = 'HH'; | |
# python скрипт генерации данных для пуша в кафку | |
import time | |
with open('/tmp/Result_9.csv') as f: | |
for line in f: | |
vacancy_id, manager_id = line.strip().split(';') | |
time_stamp = int(time.time() * 1000) | |
rid = f"{time_stamp}-reimport-{vacancy_id}" | |
line = f'{{"hhVacancyId":{vacancy_id},"initiatorId":{manager_id},"initiatorType":"MANAGER","retry":0,"firstImport":false,"markVacancyUnread":false,"time": {time_stamp},"requestId":"{rid}"}}' | |
print(line) | |
# на выходе получаем | |
{"hhVacancyId":111039638,"initiatorId":97114,"initiatorType":"MANAGER","retry":0,"firstImport":false,"markVacancyUnread":false,"time": 1732079768320,"requestId":"1732079768320-reimport-111039638"} | |
{"hhVacancyId":111039634,"initiatorId":97114,"initiatorType":"MANAGER","retry":0,"firstImport":false,"markVacancyUnread":false,"time": 1732079768320,"requestId":"1732079768320-reimport-111039634"} | |
... | |
# инструкция пуша в кафку для exp | |
kafkacat \ | |
-P \ | |
-b xxx:10342 \ | |
-X "sasl.mechanism=PLAIN" \ | |
-X "security.protocol=SASL_PLAINTEXT" \ | |
-X "sasl.username=admin" \ | |
-X "sasl.password=PLACEHOLDER" \ | |
-t tms_hh_vacancy_reimport \ | |
< data.txt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment