Scripting the tool surface#

class CaseClient(*, actor=None, workspace='.')#

Run gpf operations against one case session.

Each client owns its case, results, and session identity. The workspace selects initial navigation and audit storage. It defaults to the current directory, and opening a source does not change the audit location.

Examples

>>> s = CaseClient()
>>> s.load_case(path="grid.raw")
>>> s.solve()
>>> s.query(series="solve", sql="SELECT bus, vm FROM buses LIMIT 5")

Every tool the server exposes is a method. It takes the arguments that tool documents and answers its plain reply. Write each argument as JSON, so pass a dict where a tool documents an object. The journal records a call as it was written, and a model instance records as its str.

A tool that refuses raises CaseClientError. A script then stops on the step that failed.

property session#

Return the session identifier the journal records for this client.

case_hash()#

Return the content hash of the case this client holds, or None.

The journal records this hash beside an operation that changed the case. A script compares against it to check that it reached the same content.

class CaseClientError(refused)#

Report a rejected CaseClient operation.

kind identifies the rejection type. detail contains the complete rejection response.