IntroductionΒΆ

Facilities in Omniverse help with the management of potentially stateful objects and allows an easy way to inject them into microservices without the service implementation becoming stateful. Developing them as facilities adds an abstraction layer to any lower level objects and allows them to be swapped with other Facilities that implement the same API. This will help with things such as unit testing where a Mock facility can be used but also, as the services grow and scale, the facility will provide the abstractions needed to change core functionality with new implementations that might be more performant without the service itself needing to change.

As facilities are extensions they can also be shared. Allowing for example a single DB facility that can be re-used by various teams. This means that any optimization and performance changes done in that one facility will benefit anyone else using that facility. They provide the building blocks that allows a developer to quickly and easily assemble a function and at the same time use standard ways of doing this.

The only requirement they have is that they inherit from omni.services.facilities.base.Facility and implement the stop function to handle a clean shutdown. Other than that they can be anything that a developer might need.

Omniverse comes with several facilities, and additional ones will be added.

Omniverse Farm uses facilities quite heavily as well and might be a good source for more advanced examples. Facilities allow OV Farm for example to re-use the task scheduling facility across both the Queue and Agent but with different backends.