Simple use of a local Cegal Hub with headless Petrel in the background#

Ensure the Cegal Hub Petrel plugin is installed.

Launch Cegal Hub in local mode from the terminal (Windows Terminal is recommended). Local mode runs both a Cegal Hub Server and Cegal Hub Agent together.


Import from Cegal Hub

[ ]:
from cegalprizm.hub import Hub

Create a new Hub object

[ ]:
hub = Hub()

Get a default hub Agent context. As a hub Agent is running locally this will be a strong handle to your local running Agent.

[ ]:
agent_ctx = hub.default_agent_ctx()

Use the agent to programmatically launch petrel in the background.

[ ]:
petrel_ctx = agent_ctx.new_petrel_instance()

Once Petrel has started up in the background, use the petrel context to load a project

[ ]:

Perform some operations on the project

[ ]:

Close the project

[ ]:

Kill the instance of Petrel running in the background

[ ]: