Improbable Icon

Automatically restart workers on rebuilding

v9-1-0

#1

Would it be possible to, when running spatialos locally, automatically restart workers (or better, perform a rolling upgrade) when they are rebuilt?

The use case that I see is that when I develop locally from Unity I would want to work on the FSim and Client simultaneously since they are somewhat closely coupled (especially when you are a one-man team).

At the moment my workflow is that I:

  1. change my game,
  2. rebuild the workers from Unity,
  3. stop the local setup,
  4. restart it,
  5. wait for it to initialize and boot,
  6. Repopulate it with test-data
  7. test again.

Downside to this is that without building a snapshotting mechanism and doing that too, that I lose the data that I had before.

What I hope my suggestion would solve is that my workflow becomes:

  1. change my game,
  2. rebuild the workers from Unity,
  3. Wait for a signal that all affected workers have cycled
  4. test again.

Is this already planned? Would this be possible? Or are there too many technical limitations at play here?


#2

I found myself in the same situation.

It would cut couple seconds every time, which is great!


#3

Hey @draconigra,

This is actually something we’ve been considering for later versions of SpatialOS. In the meantime, though, you can already use some of your suggested workflow (albeit manually). If you are testing with multiple managed workers locally, I’d suggest that you:

  1. Change your game*
  2. Rebuild your managed workers only
  3. Visit the local inspector, kill all of the existing managed workers manually
  4. Wait for SpatialOS to spool up managed workers to replace those that were killed (these will have the assemblies)
  5. Test again

In the short term, we will be adding a ‘kill all workers of type X’ shortcut to the Inspector, to make this a little easier (cc @ernest).

Hope that helps!

* Note that if you make a non-backwards-compatible schema change, it’s best to do a full rebuild & regenerate any snapshots you may have.


#4

Would it be possible to use a cli command to kill a type of worker? If so you could use a file watcher to see if the built executable changed and invoke the cli command to kill the workers. (as a workaround until you have a neat system in place :))


#5

Interesting!

It certainly would be possible - I’ll bring this idea to the team and see if we could get that done ahead of the shiny version :slight_smile:


#6

Update: I went to raise this feature request, and found that I myself had raised the same thing back in December :stuck_out_tongue:

The work to do this is already planned, but it’s a bit far down the line. I’ll bring it up with the team tomorrow and see if we can’t nudge it forward :wink:


#7

lol :slight_smile: Thanks, that would help a lot!