Multiple instances of GoQat

Starting with GoQat version 3, you can run multiple instances of GoQat independently of each other. These instances are numbered sequentially in the order that you start them. The instance number is given in the title bar of the application. When you first start a new instance, it inherits a copy of the configuration file (GoQat-2.conf) from instance number 1 so it starts with the same settings as instance number 1. From there on, the configuration file belongs to the new instance and is named accordingly. So instance number 2 has a configuration file named GoQat-2_02.conf containing its own private settings. Any other files associated with that instance are also private to it, so the log file is called log_02.txt, for example.

Look! Three GoQats!


Because each instance of GoQat has its own settings and associated files, you might want to open a particular instance without having to open lower-numbered instances first. To do this, you need to tell GoQat which instance you want when you start it:

GoQat --instance 3

or:

GoQat -i 3

will both start instance number 3.

If you don't specify an instance number, GoQat will open the next available instance which will just be instance number 1 if no others are running. An exception to sequential instance numbering occurs if, for example, you have instances 1, 2 and 3 open and then close instance 2. GoQat 'fills in' missing instance numbers, so the next instance that you open will be instance 2, not instance 4.

Synchronisation between instances of GoQat

It's nice to be able to run independent instances of GoQat on the same machine, but what if you want to synchronise them so that they are not completely independent? You might want one instance to wait for another for example. That's what the SyncWait task is for.

Start GoQat and then start another instance, so that you have instances 1 and 2. For each instance of GoQat, go to the Tasks tab and click the 'Edit tasks...' button to open the tasks editing window. In instance 1, enter '2' in the 'Instance' box by the SyncWait button and click the SyncWait button to add the task to the queue. For instance 2, enter a '1' and click the SyncWait button. Now choose one of the instances and click the Play button on the Tasks tab. See how the SyncWait task is executed, but the task queue doesn't finish at that point - it just sits there, waiting. Now click the Play button in the other instance. You will see that both task queues finish together - the instance that was waiting carries on again when the other instance executes its SyncWait task. The instance that wasn't waiting doesn't have to wait because the other instance was already waiting for it, so they synchronise at that point.

Now add a PauseFor task to each queue. Enter the number of seconds to pause for and then click the PauseFor button. Choose, say, 10 seconds to wait for one instance and 20 seconds to wait for the other instance. Finally add another SyncWait command to each queue just as you did above, so that each task queue contains a SyncWait, PauseFor and another SyncWait task.

The task queue for instance 2 might look like this...

SyncWait 1 PauseFor 20 SyncWait 1

...and the task queue for instance 1 might look like this:

SyncWait 2 PauseFor 10 SyncWait 2

It doesn't matter which instance has the longer PauseFor time. Although it's natural to think of instance 1 as being the 'fundamental' instance against which others should be synchronised, all instances of GoQat are completely equivalent and any instance can wait for any other instance.

Now click the Play button on each Tasks tab. The instance you start first will wait for the other instance to execute its SyncWait task and then both will begin their PauseFor's together. The instance with the shorter PauseFor task will wait for the second instance at the SyncWait task and then both task queues will finish simultaneously.

"But wait", you're thinking, "what if we replace the PauseFor's with an Expose task, and put a GoTo task before the first SyncWait command in one of the task queues? Couldn't we have synchronised imaging by multiple cameras on the same telescope mount, with neither camera exposing until the GoTo has finished?" The answer is, yes you can! We'll look at that in the next tutorial, but first we will consider what to do if you want to synchronise GoQats that aren't even on the same machine. Yes, you can do that too...

Synchronising GoQats on different machines

GoQat uses a synchronisation directory for deciding which instance is running and for synchronising between instances. The directory is called 'Sync' and by default is in the GoQat subdirectory of your home folder. If the directory does not exist, GoQat will create it (so if things get muddled and the wrong instance number of GoQat starts or synchronisation doesn't work, close all GoQats and delete the Sync directory before re-starting). All instances of GoQat look in this default location for the Sync directory so any number of instances running on the same machine can always be synchronised with each other.

You do not have to use the default location - it's possible to start GoQat like this:

GoQat --syncdir /some/other/location

or:

GoQat -y /some/other/location

Either of these commands will start GoQat and force it to look in /some/other/location for the Sync directory. So to synchronise GoQats across multiple machines, all you have to do is make sure that each machine can see a common location for the Sync directory. One way to do this might be to use sshfs to mount a common remote Sync directory on each machine running GoQat. If you choose this, you may wish to use the cache_stat_timeout option:

sshfs -o cache_stat_timeout=0 astro@remoteserver:/home/astro ~/remotesync

If a user called 'fred' is logged in to the machine on which GoQat is to be run, the above command on fred's machine will mount the home directory of user 'astro' on machine 'remoteserver' beneath the 'remotesync' directory in /home/fred. The cach_stat_timeout option ensures that fred's machine will be aware of any changes in /home/astro immediately - the default may be much longer. So fred can start GoQat like this:

GoQat -y ~/remotesync

This creates the Sync directory in /home/fred/remotesync on fred's machine, which is really /home/astro on the remote machine, where other GoQats may see it. In this way it is very straightforward to synchronise multiple GoQats securely over WiFi as required.