Flush all Excel store instances and save to files Should be called at the end of crawler execution
(cls)
| 80 | |
| 81 | @classmethod |
| 82 | def flush_all(cls): |
| 83 | """ |
| 84 | Flush all Excel store instances and save to files |
| 85 | Should be called at the end of crawler execution |
| 86 | """ |
| 87 | with cls._lock: |
| 88 | for key, instance in cls._instances.items(): |
| 89 | try: |
| 90 | instance.flush() |
| 91 | utils.logger.info(f"[ExcelStoreBase] Flushed instance: {key}") |
| 92 | except Exception as e: |
| 93 | utils.logger.error(f"[ExcelStoreBase] Error flushing {key}: {e}") |
| 94 | cls._instances.clear() |
| 95 | |
| 96 | def __init__(self, platform: str, crawler_type: str = "search"): |
| 97 | """ |