License API
Import the licensing entry point from the Python package:
1 | |
For setup instructions, see Python activation, Offline Mode or the dedicated Compute License guide. The generated License reference lists the documented members from the current SIMBA assembly.
Activate a regular license
License.Activate(deployment_key)
Activates the Python API using a deployment key when an activation is needed. Returns Status.OK on success or Status.Error on failure. An already valid local activation can be reused. This method is synchronous; demo licenses cannot be used with the Python API.
1 2 3 4 5 6 7 | |
Setting SIMBA_DEPLOYMENT_KEY before importing the package also requests activation automatically. Check simulation statuses in unattended scripts even when using automatic activation.
License.SaveLicenseRequestFile(path)
Writes a .slr request file for the current computer and SIMBA version. Use it on a connected computer to obtain a corresponding offline license file from your SIMBA account. The method raises an exception if the request cannot be generated or written.
License.ActivateUserFromLicenseFile(path)
Loads and activates an offline license file. Returns a Simba.Data.LoginStatus value; compare its string representation with "LicenseOK" to check success:
1 2 3 | |
LoginStatus is a .NET enum and is not re-exported by aesim.simba. It is different from the Status enum returned by License.Activate() and simulation jobs.
License.LoadLicenseFile(path) is also available, but does not return the activation status. Prefer ActivateUserFromLicenseFile() when a script needs to check whether activation succeeded.
License.ClearStoredLicense()
Invalidates the local regular-license rights and clears the stored activation and deployment key. It does not close the Python interpreter. Reactivate explicitly before starting further simulations.
Inspect the license
| Member | Result |
|---|---|
GetLicenseStatus() |
Raw license category/status string from the solver, for example "Demo Mode". |
GetLicenseExpirationDate() |
Expiration date of the locally loaded license, in YYYY-MM-DD form. |
GetMaximumSimbaVersionDate() |
Latest SIMBA version date covered by the loaded license, in YYYY-MM-DD form. |
NumberOfAvailableParallelSimulationLicense() |
Available parallel simulation capacity. |
The local activation expiry and the latest supported SIMBA version date describe different limits. Neither replaces checking the returned status of activation or simulation jobs.
Refresh a regular activation
The package starts background validation automatically for regular licenses and stops it at interpreter exit. The generated reference describes the available methods:
The shared validation and renewal policy covers check intervals, network failures, expiration and revocation.
RefreshStoredLicenseAsync(): checks or renews a stored regular activation when due under the shared Desktop/Python policy.RevalidateMultiUserLicenseAsync(): requests a server revalidation for a multi-user license even when the local status is OK; it respects Offline Mode.StartPeriodicValidation()andStopPeriodicValidation(): manage the background checks. Normal Python scripts do not need to call these methods themselves.
Methods ending in Async return .NET tasks, rather than Python asyncio coroutines. A synchronous script can retrieve a result using .GetAwaiter().GetResult().
Compute API members
Compute key creation, worker configuration, activation examples and capacity management are documented in Compute Licenses.
ActivateCompute(keyId, secret, slots)selects Compute mode and requests capacity for the current process. It returns aSimba.Data.LoginStatusvalue.StopCompute()stops renewal and requests release of that process's allocation. Finish your jobs before releasing it.ComputeStatereturns the state of the latest Compute lease request of the process:NotStarted,Active,WaitingForSlot,Retrying,RejectedorStopped. It lets a service tell a full slot quota, which is retried automatically, from a refusal that needs the license administrator.ComputeLeaseRemainingSecondsreturns the seconds left on the Compute lease of the process, or0without a lease.ComputeWaitSecondssets how many seconds a calculation waits for a Compute lease before failing. The default,0, fails at once. The Python API sets it fromSIMBA_COMPUTE_WAIT_SECONDS.IsComputeModeSelectedindicates the process's licensing mode. It remains true after a failure, expiration or stop, and does not mean a valid lease is currently available.
Save an already authorized project
Projects authorized for saving while a regular license was active retain that permission for the current session if license rights later become unavailable. Demo-only projects cannot be saved.
SerializableProject.CanSaveindicates whether the project can currently be saved.JsonProjectRepository.SaveCopy(source, path)saves a copy without changing the source project's current path or unsaved state.
Handle file-system errors when saving. This permission lets you preserve an open project; it does not authorize new simulations after license rights have expired or been removed.