Need help - Hazel Notifications

Hi guys,

I have a Hazel rule that fires a Python script to do multiple actions on an Excel sheet produced by an external system once a week and then bring the data to a main Excel sheet. Once everything is done, it deletes the weekly file.

Since the weekly Excel files is getting bigger and bigger each week, running the Python script takes a very long time so I would like to monitor the time the script takes to run.

Do you know if there’s a way to show in the notification at the end of the rule the time it took to run?

I have an idea of monitoring the time with Python, store it in a variable and then display it, but I’m sure there’s a better way.

Any ideas?

Thanks!

1 Like

If you want to truly monitor it, I would suggest having Python write the time and the file size to a log and then using that for the notification. When you have a log of size and time taken you can analyse performance as well over time.

But what is it you really want to monitor and why? Is there some critical threshold you need to be notified of or a point at which is will break?

If you are carrying out other activities this will impact how long the script takes as it may not have “enough” resources available to it to perform at full speed. You may also wish to consider running the processing out of hours as it were. This would forego Hazel and utilise a scheduler instead. This of course assumes the processing has an acceptable deadline that processing can be delayed.

Thanks sylumer!

I like the Python log idea so I analyze the performance in the long term. It’s a good practice to have a great log anyway! Will do!

For the notification, do you suggest that Python sends the notification instead of Hazel or I pass the time in a variable from Python to Hazel (will have to check how to do that) and let Hazel notify? What do you think?

This whole process is taking most of my MacBook Pro juice! The temperature is rising and my fan in running at 7200 RPM! The weekly file has more than 20K lines and the script passes thru around 22K lines in the main file to check if something has changed or append it if it doesn’t exist. I can’t put in on a scheduler task instead because I carry my laptop with me and I know myself, I’ll forget to plug and open it at home… That’s the whole beauty of automation : I don’t have to think about it and it will be done!

Thanks!

I would run it from Python. Keeps all of the processing in one place, which makes it portable.

Take a look at the AppleScript call in the second response in this thread. It uses an on the fly osascript command to display the notification.

That’s awesome!

Thank you so much!