Session

Labs

class Session

Description

A connection to one model server.

Use as a context manager or call close(); after that every operation fails with SESSION_CLOSED. server must satisfy ServerUrl.parse().

auth is an AuthPolicy whose URL globs must match the server URL, or a BearerCallback / BasicCallback used for every request. An AuthPolicy that reads the OS keystore (AuthPolicy.from_env() without keyring=False) is refused, since the read can prompt; read a keystore through a BearerCallback, as its documentation shows.

max_retries and retry_budget bound retrying per operation: one load, push or branch creation, whatever number of requests it makes, retries failed GET requests at most max_retries times in all and spends at most retry_budget on backoff and retry attempts; a retry attempt is cut short when the budget runs out. A page of a discovery listing (projects(), branches(), tags(), commits()) is an operation of its own. POST requests are never retried.

library_stubs is for a server that keeps a reference only to an element of the same project: the OMG reference implementation (SysML-v2-API-Services) stores a reference to any other element as null in a project’s first commit and fails a later commit that has one with HTTP 500, so a model’s references into the standard library would be lost. With it, a push through this session, or a push without session= of a model loaded through it, adds to its commit a stub for each standard library element the commit refers to and the branch does not hold: an element with only its @id and @type, as the pilot implementation’s %publish writes them. Standard library ids are derived from each element’s path in the library, so a stub’s id names the element. Loads drop stubs whether or not the option is set. Off by default: servers that keep references to elements outside the project (Flexo) need no stubs, and stubs are elements of the user’s project.

Raises:
  • ValueError – From the constructor, if server is refused by ServerUrl.parse(), auth is invalid or reads the OS keystore, or the file SSL_CERT_FILE names cannot be read.

  • syside.project.AuthError – From the constructor, if the SYSAND_CRED_* variables auth reads are malformed, as syside.project refuses them.

Inheritance:

Members defined in Session (12 members)

credentials

R

The auth the session was opened with.

library_stubs

R

Whether a push adds stubs of the standard library elements it refers to; see above.

server

R

The validated server URL.

transport

R

The transport every request of this session goes through.

__enter__

__exit__

__init__

branches

The branches of project, one page requested at a time.

close

Close the connection pool. Idempotent.

commits

The commits of project, one page requested at a time.

projects

The projects of the server, one page requested at a time.

tags

The tags of project, one page requested at a time.

Attributes

property credentials: syside.experimental.remote.Credentials | None

The auth the session was opened with.

property library_stubs: bool

Whether a push adds stubs of the standard library elements it refers to; see above.

property server: syside.experimental.remote.ServerUrl

The validated server URL.

property transport: syside.experimental.remote.Transport

The transport every request of this session goes through.

Methods

__enter__() → Self
__exit__(*_exc: object) → None
__init__(server: str, *, auth: syside.experimental.remote.Credentials | None = ..., max_retries: int = ..., retry_budget: datetime.timedelta = ..., library_stubs: bool = ..., _transport: syside.experimental.remote.HttpTransport | None = ...) → None
branches(project: syside.experimental.remote.ProjectId) → Generator[syside.experimental.remote.BranchInfo, None, None]

The branches of project, one page requested at a time.

Raises:

RemoteError – From the generator, on a failed page or a malformed item.

close() → None

Close the connection pool. Idempotent.

commits(project: syside.experimental.remote.ProjectId) → Generator[syside.experimental.remote.CommitInfo, None, None]

The commits of project, one page requested at a time.

Raises:

RemoteError – From the generator, on a failed page or a malformed item.

projects() → Generator[syside.experimental.remote.ProjectInfo, None, None]

The projects of the server, one page requested at a time.

Raises:

RemoteError – From the generator, on a failed page or a malformed item.

tags(project: syside.experimental.remote.ProjectId) → Generator[syside.experimental.remote.TagInfo, None, None]

The tags of project, one page requested at a time.

Raises:

RemoteError – From the generator, on a failed page or a malformed item.