Emoncms Sync module v3.x.x

Trystan, the sync works great! Thanks for setting this up.

I decided to bite the bullet and delete the feeds on emoncms.org for one of my systems. Then, I set up sync on the local Pi2. All the history is loaded onto emoncms.org, and it is working quite well.

I have one question about feed size vs. upload size. On the local machine, my feeds are around 5.2MB, but when the first sync upload occurred, it was under 1MB, with each subsequent sync being less than 1KB. All the data is showing in the emoncms.org cloud, so I am confused about the reported sizes. Is there some compression happening during the sync?

On the next site, I convert I will take some screen shots as I didn’t think to do this during the first conversion.

Thanks,

Hello @grod55, great! it may be that you need to click on ‘refresh feed size’ at the bottom of the feeds page on both local and remote to see the updated size.

That is good to know, but what I was referring to is on the sync screen where it shows the size of the last upload.
image

When I performed the initial sync it was nowhere near the 5MB that existed. I will capture some examples later today when I update another location.

Ok - tried one of my remote sites that uses a cellular connection and it does not appear to be syncing. I have tried deleting a feed in emoncms.org and starting over, but nothing is updating.
Not sure what do do next. Please advise.

Here are the feeds in sync on the Local emonPi2
image

And here is what is showing in emonCMS.org. This has been active for the past 45 minutes without any change.
image

The one feed that did a partial update looks like it only updated two months of data and then stopped. None of the other feeds have any data in emoncms.org
image

This is what should show for the feed above.
image

O dear, Can you check the emoncms_sync service log for this system:

Try:

journalctl -f -u emoncms_sync -n 1000

I am seeing a lot of timeout errors
Aug 24 17:19:45 emonpi emoncms_sync[24017]: - Upload size: 1048576
Aug 24 17:19:55 emonpi emoncms_sync[24017]: - timeout error

I had stopped the sync about 5 minutes ago and just restarted it and see the same error

Aug 24 17:33:24 emonpi emoncms_sync[24017]: ** Reloading feeds **
Aug 24 17:33:24 emonpi emoncms_sync[24017]: 08/24/2024 05:33:24 pm
Aug 24 17:33:24 emonpi emoncms_sync[24017]: - Upload size: 1048576
Aug 24 17:33:34 emonpi emoncms_sync[24017]: - timeout error

Thanks @grod55 that’s really useful. I’ve extended the timeout from 10s to 60s, could you update the module and see if that fixes it?

1 Like

PS: Apologies, that early timeout has probably been eating up your bandwidth!

1 Like

yikes - I have consumed almost 100MB in the past hour and am still seeing time out errors

Aug 24 18:32:53 emonpi emoncms_sync[24017]: 08/24/2024 06:32:53 pm
Aug 24 18:32:53 emonpi emoncms_sync[24017]: - Upload size: 1048576
Aug 24 18:33:01 emonpi emoncms_sync[24017]: - Upload data_start does not match local npoints for feedid=507930
Aug 24 18:34:01 emonpi emoncms_sync[24017]: 08/24/2024 06:34:01 pm
Aug 24 18:34:01 emonpi emoncms_sync[24017]: - Upload size: 1048576
Aug 24 18:34:11 emonpi emoncms_sync[24017]: - timeout error
Aug 24 18:35:11 emonpi emoncms_sync[24017]: 08/24/2024 06:35:11 pm
Aug 24 18:35:11 emonpi emoncms_sync[24017]: - Upload size: 1048576
Aug 24 18:35:21 emonpi emoncms_sync[24017]: - timeout error

it is slowly starting to populate emoncms.org, but each sync upload seems to be 1MB every 5 minutes. There needs to be a better way to sync history.
image

Are you sure the service is running the latest version? Could you try:

sudo systemctl restart emoncms_sync

the one feed is syncing every 5 minutes

I had to stop the sync upload as it was consuming 1MB every 5 minutes and killing my data plan. I only have 1 feed that is fully sync’d. the other 4 are not due to timeout errors.

I tried only syncing just 1 of the 4 remaining, and I still see a timeout error.

entered the above and received.

Aug 24 19:20:29 emonpi emoncms_sync[1861]: 08/24/2024 07:20:29 pm
Aug 24 19:20:30 emonpi emoncms_sync[1861]: - Nothing to upload (sleep 270s)
Aug 24 19:23:26 emonpi systemd[1]: Stopping emoncms_sync service...
Aug 24 19:23:26 emonpi systemd[1]: emoncms_sync.service: Succeeded.
Aug 24 19:23:26 emonpi systemd[1]: Stopped emoncms_sync service.
Aug 24 19:23:26 emonpi systemd[1]: emoncms_sync.service: Consumed 1.464s CPU time.
Aug 24 19:23:26 emonpi systemd[1]: Started emoncms_sync service.
Aug 24 19:23:27 emonpi emoncms_sync[6104]: 08/24/2024 07:23:27 pm
Aug 24 19:23:28 emonpi emoncms_sync[6104]: - Nothing to upload (sleep 92s)

I tried syncing a single feed after doing the restart command and still get a timeout error.

Sanity checking deleting a 45MB feed on emoncms.org and having sync re-upload it here, this is what I would expect to see in the log, a 1MB upload every 2-3 seconds, took 109 seconds in total to upload 45 MB after which it then returns to the standard longer sleep.

- Upload size: 1048576
08/24/2024 07:30:36 pm
- Upload size: 1048576
08/24/2024 07:30:39 pm
- Upload size: 1048576
08/24/2024 07:30:41 pm
- Upload size: 1048576
08/24/2024 07:30:44 pm
- Upload size: 1048576
08/24/2024 07:30:47 pm
- Upload size: 1048576
08/24/2024 07:30:49 pm
- Upload size: 1048576
08/24/2024 07:30:52 pm
- Upload size: 1048576
08/24/2024 07:30:55 pm
- Upload size: 1048576
08/24/2024 07:30:57 pm
- Upload size: 1048576
08/24/2024 07:31:00 pm
- Upload size: 1048576
08/24/2024 07:31:03 pm
- Upload size: 1048576
08/24/2024 07:31:06 pm
- Upload size: 1048576
08/24/2024 07:31:08 pm
- Upload size: 1048576
08/24/2024 07:31:11 pm
- Upload size: 1048576
08/24/2024 07:31:14 pm
- Upload size: 1048576
08/24/2024 07:31:16 pm
- Upload size: 1048576
08/24/2024 07:31:19 pm
- Upload size: 940388
08/24/2024 07:31:21 pm
- Nothing to upload (sleep 218s)

Is the timeout error appearing ~60s after you see upload size: … in the log?

I’ve made another minor change so that it prints how long the request took in seconds when it gives the timeout error. If you want to pull in the latest again that would be great!

Manual process is:

cd /opt/emoncms/modules/sync
git pull origin master
sudo systemctl restart emoncms_sync

Checking the version

cat module.json 

should be 3.1.6

That worked!

Aug 24 20:02:28 emonpi systemd[1]: Started emoncms_sync service.
Aug 24 20:02:30 emonpi emoncms_sync[9521]: 08/24/2024 08:02:30 pm
Aug 24 20:02:31 emonpi emoncms_sync[9521]: - Nothing to upload (sleep 149s)
Aug 24 20:02:59 emonpi emoncms_sync[9521]: ** Reloading feeds **
Aug 24 20:02:59 emonpi emoncms_sync[9521]: 08/24/2024 08:02:59 pm
Aug 24 20:02:59 emonpi emoncms_sync[9521]: - Upload size: 1048576
Aug 24 20:03:15 emonpi emoncms_sync[9521]: 08/24/2024 08:03:15 pm
Aug 24 20:03:15 emonpi emoncms_sync[9521]: - Upload size: 1048576
Aug 24 20:03:28 emonpi emoncms_sync[9521]: 08/24/2024 08:03:28 pm
Aug 24 20:03:28 emonpi emoncms_sync[9521]: - Upload size: 68080
Aug 24 20:03:31 emonpi emoncms_sync[9521]: 08/24/2024 08:03:31 pm
Aug 24 20:03:32 emonpi emoncms_sync[9521]: - Nothing to upload (sleep 88s)

I am syncing the remaining feeds one at a time so that I can monitor the upload. It looks like it uploads a maximum of 1MB at a time.

All are now fully sync’d. I changed the sync interval from 5 minutes to hourly and noticed that it said “nothing to upload (sleep 2999s)” and the time was 10 minutes past the hour. I assume this means that hourly sync happens on the hour versus one hour since the last sync - correct?

thanks for your assistance on this. This is going to be very helpful going forward, I just need to stage our conversion of all sites as we have a monthly data pool that I do not want to exceed in a single month by updating all sites in the same month.

1 Like

Thanks @grod55 glad to hear that sorted it!

All good. Thank you for being super responsive!

1 Like

@TrystanLea I just started the update on another site and noticed that the Full Update contains sync release 3.15, not the 3.16 version we used yesterday, and I did not see where to get 3.16. Are you planning to include 3.16 into the Full Update? Or should I continue with

Manual process is:

cd /opt/emoncms/modules/sync
git pull origin master
sudo systemctl restart emoncms_sync

Checking the version

cat module.json 

should be 3.1.6

Please advise.

Thank you,

Gordon