You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sdap.apache.org by ea...@apache.org on 2020/08/11 02:17:35 UTC

[incubator-sdap-ingester] branch poll-filesystem updated: Extra logging

This is an automated email from the ASF dual-hosted git repository.

eamonford pushed a commit to branch poll-filesystem
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-ingester.git


The following commit(s) were added to refs/heads/poll-filesystem by this push:
     new ad267c0  Extra logging
ad267c0 is described below

commit ad267c04b48b2cd5a809ef630bf6b152c3348de7
Author: Eamon Ford <ea...@gmail.com>
AuthorDate: Mon Aug 10 19:17:23 2020 -0700

    Extra logging
---
 .../collection_manager/services/CollectionWatcher.py       | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/collection_manager/collection_manager/services/CollectionWatcher.py b/collection_manager/collection_manager/services/CollectionWatcher.py
index 726f6b8..d30327b 100644
--- a/collection_manager/collection_manager/services/CollectionWatcher.py
+++ b/collection_manager/collection_manager/services/CollectionWatcher.py
@@ -1,4 +1,5 @@
 import asyncio
+import time
 import logging
 import os
 from collections import defaultdict
@@ -101,9 +102,13 @@ class CollectionWatcher:
     async def _reload_and_reschedule(self):
         try:
             updated_collections = self._get_updated_collections()
-            for collection in updated_collections:
-                await self._collection_updated_callback(collection)
             if len(updated_collections) > 0:
+                logger.info(f"Scanning files for {len(updated_collections)} collections...")
+                start = time.perf_counter()
+                for collection in updated_collections:
+                    await self._collection_updated_callback(collection)
+                logger.info(f"Finished scanning files in {time.perf_counter() - start} seconds.")
+
                 self._unschedule_watches()
                 self._schedule_watches()
         except CollectionConfigParsingError as e:
@@ -160,6 +165,11 @@ class _GranuleEventHandler(FileSystemEventHandler):
         self._callback = callback
         self._collections_for_dir = collections_for_dir
 
+    def on_any_event(self, event):
+        super().on_created(event)
+
+        logger.info(f"Collection Watcher received event: {event}")
+
     def on_created(self, event):
         super().on_created(event)
         for collection in self._collections_for_dir: