Pavlovia TIP: Avoid using the Inactive ↔ Running cycle if Pavlovia doesn’t sync
Occasionally projects fail to sync between Gitlab (where you interact with the files) and the Run server (which handles the actual data collection from participants). While the advice to reset the project status (set to Inactive and then back to Running) has worked to get new data collection working, it also deletes previous collected data. This thread explains why.
Note, first of all, that we’re not talking here about the project failing to sync between PsychoPy and Pavlovia. That’s generally caused by login/network/authentication issues and can usually be solved locally by examining the error messages.
We’re talking about projects where the data being collected in the study are no longer appearing in your Gitlab project, or where changes in the Gitlab project don’t appear in the study (although also try clearing the cache for that).
To understand the issue, you need to understand that there are these two, relatively independent servers: Gitlab and Run. Gitlab is where you interact with the project files and Run is the server that interacts with your participants (sending stimuli and collecting data). These stay in sync using git to “push” and “pull” changes between the two servers.
Nearly always the cause of a failure to sync is that the files in the git repository have got changes on both sides* - they were changed in the Gitlab repo at the same time as in the Run server. When a merge conflict occurs on your local computer it’s easy to spot and relatively easy to fix but when it occurs on the Run server you don’t have direct access to the files or repo to make the fixes. So Run then fails to push/pull the repository and can’t sync with Gitlab.
* why that conflict occurs is another question but, usually, it is caused by a push to the gitlab server at the same instant as the participant completes their run. This is most common with projects that perform analyses on data as they go but sometimes occurs following an outage on the server because there was a period where the projects couldn’t be kept in sync
So this has become a popular solution (and possibly more popular with AI giving it as advice) but before taking this approach you should be very aware that it causes data loss!
The idea is that when the project stops syncing you can set to Inactive and then Running on your Pavlovia project page. How does that help? When you set the project to Inactive the files on the Run server are deleted. When you set the project to Run or Pilot, if they aren’t already present on Run, then they are freshly cloned from Gitlab.
That solution is easy and means that further data collection will sync, but it’s like finding 2 files are conflicting and handling it by simply deleting one of the files, rather than investigating the differences and merging them together.
This approach may be OK if you barely collected any real data and you’re just testing the system (analogy: you know that the newer of the conflicting files isn’t important and you can just use the older one).
But the really key point here is that any data files that were collected in the period where sync was failing will be fully deleted when you set the project to Inactive. So only do this if you don’t care about the non-synchronised data!
If you need that data and the project appears not to sync then:
use the download button on the Pavlovia project page first - that fetches the data from the Run server and should therefore include data that has not yet synced to the Gitlab project.
get in touch and let us investigate on the server. We can check the git merge status on the files and hopefully combine them in a safe way for you.
The issue didn’t used to occur very often so it wasn’t a priority, but we are seeing the issue increasing so, yes, we’ll take some further steps to try and improve the situation for users.
So far, when simultaneous changes occur we just (over?) cautiously avoided any form of sync.
The plan going forwards will be:
start trying to merge changes automatically where this is safe. Where changes have been made to different files this should be fine and, for text/csv files, it should be possible even if changes are made to the same file in different areas. For other file types, like images or xlsx files, any change is not safe to merge.
when changes have been to the same file we will not try to merge or resolve for you (e.g. based on date). Hopefully, we can develop a system whereby we create a separate branch on your Gitlab project so that you can combine the files as you see fit.