

Void monitor_OnFileChanged(FileChangedEventArgs args)ĭ(SiteCacheProvider.CacheDependencyDurationInMinutes) Monitor.OnFileChanged += monitor_OnFileChanged When our application starts we register our event handler and start the monitor: public void Execute()
#Filewatcher change every 10 seconds update#
If a change is detected we update the FileState instance and raise the OnFileChanged event. Each file is retrieved using the storage provider and its modifed date compared to the LastChanged date of the matching FileState. On each cycle we check all the monitored files for changes. The monitor stores a FileState instance for each file we are monitoring. When the monitor starts we kick off a long running Task that checks the monitored files every 10 seconds (MonitorIntervalInSeconds). Public void SetLastChanged(DateTime lastChanged) FileChangedEventArgs contains a reference to the monitored file: public class FileChangedEventArgs The OnFileChanged event is raised when a file changes. Let’s start with the IFileChangeMonitor interface: public interface IFileChangeMonitor Like most of our Azure developments we didn’t want to be coupled to a specific environment (so we can use it with both local and Azure file systems). So we had no choice but to create our own monitor. Unfortunately this is tied to the local file system, so was not much use to us. A change made in the admin application should update the cache of our public (read-only) web application.Īzure Blob Storage was a good candidate for storing our cache dependency files as it can be accessed concurrently by multiple roles (and role instances).Īs we were using the 圜ache we looked at using the built in FileChangeMonitor.
#Filewatcher change every 10 seconds windows#
Although our Cloud Engineering team have not enabled Cloud Functions in our environment so this will have to wait until then.We recently had the need to synchronize (local) in-memory cache items between 2 web applications running in Windows Azure. I am guessing we could write a small Cloud Function that used the Dataiku REST API to trigger the scenario in Dataiku. Google Cloud Storage supports running Cloud Functions when new files are added to a bucket.

We need to score files within a minute max and it takes us around 10 seconds to score each file so we need to load them pretty quickly to meat our SLA.Īnother way we could go which I think seems to better fit is to transfer the file to a GCP bucket (Dataiku is running on a GCP VM). How does the trigger "run every" work? Is it a daemon sort of process or does it get kicked by some internal Dataiku scheduler? The reason I ask is that if it is not a daemon it might be better for us to run a daemon process on the OS which will be more efficient than Dataiku starting up a thread to check a directory. How much overhead is running a trigger very frequently? (say every 5 seconds).

This is a very common use case for data pipelines. It's a pity there isn't a built-in way to trigger a scenario when a file arrives.
