Session
- class Session
Description
A connection to one model server.
Use as a context manager or call
close(); after that every operation fails withSESSION_CLOSED.servermust satisfyServerUrl.parse().authis anAuthPolicywhose URL globs must match the server URL, or aBearerCallback/BasicCallbackused for every request. AnAuthPolicythat reads the OS keystore (AuthPolicy.from_env()withoutkeyring=False) is refused, since the read can prompt; read a keystore through aBearerCallback, as its documentation shows.max_retriesandretry_budgetbound retrying per operation: one load, push or branch creation, whatever number of requests it makes, retries failedGETrequests at mostmax_retriestimes in all and spends at mostretry_budgeton 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.POSTrequests are never retried.library_stubsis 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 withoutsession=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@idand@type, as the pilot implementation’s%publishwrites 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
serveris refused byServerUrl.parse(),authis invalid or reads the OS keystore, or the fileSSL_CERT_FILEnames cannot be read.syside.project.AuthError – From the constructor, if the
SYSAND_CRED_*variablesauthreads are malformed, assyside.projectrefuses them.
Inheritance:
Members defined in
Session(12 members)RThe
auththe session was opened with.RWhether a push adds stubs of the standard library elements it refers to; see above.
RThe validated server URL.
RThe transport every request of this session goes through.
The branches of
project, one page requested at a time.Close the connection pool. Idempotent.
The commits of
project, one page requested at a time.The projects of the server, one page requested at a time.
The tags of
project, one page requested at a time.Attributes
- property credentials: syside.experimental.remote.Credentials | None
The
auththe 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
- __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.
- 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.