BallAerospace / COSMOS

Ball Aerospace COSMOS
https://ballaerospace.github.io/cosmos-website/
Other
361 stars 129 forks source link

Debugging Microservices, Cleanup Microservice process dies #1694

Closed kmgraves closed 2 years ago

kmgraves commented 2 years ago

I am trying to convert some background tasks to microservices to convert a plugin from Cosmos4 to Cosmos5

My microservices appear to be passing syntax checks and being initialized, but I cannot see them running. I attempted to add debug messages (Using Logger.info) but none are being displayed in the cosmos5 web interface log messages in the cmdtlmserver.

image

The "TEST TEST TEST" message is from plugin_microservice.rb

My main concern is I have noticed that the cleanup_microservice.rb is constantly crashing. Would this error cause all microservices to crash as well?

image

image

jmthomas commented 2 years ago

Logger.info messages should come out in the CmdTlmServer messages window. A typical microservice would like like so:

require 'cosmos/microservices/microservice'
require 'cosmos/utilities/logger'
module Cosmos
  class MyMicroservice < Microservice
    def run()
      Logger.level = Logger::INFO
      Thread.abort_on_exception = true
      while true
        # Do stuff!
        sleep 1
      end
    end
  end
end
Cosmos::MyMicroservice.run() if __FILE__ == $0

As far as your cleanup microservice crashing I think it's due to #1624 which changed how that was implemented. You probably need to update to latest or our last release.