mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-06-22 10:03:54 +02:00
checkpoint(data-ingestion): Replace print statements with loguru
This commit is contained in:
@ -34,7 +34,7 @@ def work(company: typing.Any, company_service: CompanyMongoService) -> None:
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
|
|
||||||
from tqdm import tqdm
|
from loguru import logger
|
||||||
|
|
||||||
config_provider = JsonFileConfigProvider("./secrets.json")
|
config_provider = JsonFileConfigProvider("./secrets.json")
|
||||||
|
|
||||||
@ -49,14 +49,15 @@ if __name__ == "__main__":
|
|||||||
executor.submit(work, entry, company_service): entry for entry in companies
|
executor.submit(work, entry, company_service): entry for entry in companies
|
||||||
}
|
}
|
||||||
|
|
||||||
with tqdm(total=len(companies)) as pbar:
|
# with tqdm(total=len(companies)) as pbar:
|
||||||
# Wait for all tasks to complete
|
# Wait for all tasks to complete
|
||||||
for future in concurrent.futures.as_completed(future_to_entry):
|
for future in concurrent.futures.as_completed(future_to_entry):
|
||||||
entry = future_to_entry[future]
|
entry = future_to_entry[future]
|
||||||
# try:
|
logger.info(entry["name"])
|
||||||
|
try:
|
||||||
# Get the result of the completed task (if needed)
|
# Get the result of the completed task (if needed)
|
||||||
result = future.result()
|
result = future.result()
|
||||||
pbar.set_description(entry["name"])
|
# pbar.set_description(entry["name"])
|
||||||
pbar.update(1)
|
# pbar.update(1)
|
||||||
# except Exception as e:
|
except Exception as e:
|
||||||
# print(f"Error processing entry {entry}: {e}")
|
logger.error(f"Error processing entry {e}")
|
||||||
|
@ -8,7 +8,7 @@ from deutschland.bundesanzeiger import Bundesanzeiger as Ba
|
|||||||
from aki_prj23_transparenzregister.models.auditor import Auditor
|
from aki_prj23_transparenzregister.models.auditor import Auditor
|
||||||
from aki_prj23_transparenzregister.models.company import FinancialKPIEnum
|
from aki_prj23_transparenzregister.models.company import FinancialKPIEnum
|
||||||
|
|
||||||
pd.options.mode.chained_assignment = ""
|
pd.options.mode.chained_assignment = None # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class Bundesanzeiger:
|
class Bundesanzeiger:
|
||||||
|
Reference in New Issue
Block a user