modelon.impact.client package
Subpackages
- modelon.impact.client.entities package
- Subpackages
- modelon.impact.client.entities.interfaces package
- Submodules
- modelon.impact.client.entities.interfaces.case module
- modelon.impact.client.entities.interfaces.custom_artifact module
- modelon.impact.client.entities.interfaces.custom_function module
- modelon.impact.client.entities.interfaces.experiment module
- modelon.impact.client.entities.interfaces.external_result module
- modelon.impact.client.entities.interfaces.model module
- modelon.impact.client.entities.interfaces.model_executable module
- modelon.impact.client.entities.interfaces.workspace module
- Module contents
- modelon.impact.client.entities.interfaces package
- Submodules
- modelon.impact.client.entities.asserts module
- modelon.impact.client.entities.case module
Case
Case.execute()
Case.from_operation()
Case.from_reference()
Case.get_artifact()
Case.get_artifacts()
Case.get_definition()
Case.get_fmu()
Case.get_log()
Case.get_result()
Case.get_trajectories()
Case.get_variables()
Case.import_custom_artifact()
Case.import_result()
Case.info
Case.initialize_from_case
Case.initialize_from_external_result
Case.input
Case.is_successful()
Case.meta
Case.run_info
Case.sync()
CaseAnalysis
CaseInput
CaseMeta
CaseRunInfo
- modelon.impact.client.entities.content module
- modelon.impact.client.entities.custom_artifact module
- modelon.impact.client.entities.custom_function module
- modelon.impact.client.entities.experiment module
Experiment
Experiment.custom_function
Experiment.delete()
Experiment.execute()
Experiment.from_operation()
Experiment.from_reference()
Experiment.get_case()
Experiment.get_cases()
Experiment.get_cases_with_label()
Experiment.get_class_name()
Experiment.get_compiler_options()
Experiment.get_definition()
Experiment.get_last_point()
Experiment.get_runtime_options()
Experiment.get_simulation_options()
Experiment.get_solver_options()
Experiment.get_trajectories()
Experiment.get_variables()
Experiment.info
Experiment.is_successful()
Experiment.label
Experiment.metadata
Experiment.run_info
Experiment.set_label()
ExperimentMetaData
ExperimentResultPoint
ExperimentRunInfo
- modelon.impact.client.entities.external_result module
- modelon.impact.client.entities.file_uri module
- modelon.impact.client.entities.log module
- modelon.impact.client.entities.model module
- modelon.impact.client.entities.model_executable module
ModelDescription
ModelExecutable
ModelExecutable.delete()
ModelExecutable.download()
ModelExecutable.from_operation()
ModelExecutable.get_class_name()
ModelExecutable.get_log()
ModelExecutable.get_model_description()
ModelExecutable.get_settable_parameters()
ModelExecutable.id
ModelExecutable.info
ModelExecutable.input
ModelExecutable.is_successful()
ModelExecutable.metadata
ModelExecutable.new_experiment_definition()
ModelExecutable.run_info
ModelExecutableInput
ModelExecutableRunInfo
- modelon.impact.client.entities.project module
GitRepoURL
Project
Project.definition
Project.delete()
Project.from_operation()
Project.get_content()
Project.get_content_by_name()
Project.get_contents()
Project.get_modelica_library_by_name()
Project.get_options()
Project.id
Project.import_content()
Project.import_modelica_library()
Project.name
Project.project_type
Project.rename()
Project.size
Project.storage_location
Project.vcs_uri
ProjectDefinition
ProjectDependency
ProjectType
StorageLocation
SvnRepoURL
VcsUri
- modelon.impact.client.entities.result module
- modelon.impact.client.entities.status module
- modelon.impact.client.entities.workspace module
AccessSettings
AppMode
OwnerData
ProjectEntry
PublishedWorkspace
PublishedWorkspaceACL
PublishedWorkspaceDefinition
PublishedWorkspaceDefinition.app_mode
PublishedWorkspaceDefinition.created_at
PublishedWorkspaceDefinition.from_dict()
PublishedWorkspaceDefinition.name
PublishedWorkspaceDefinition.owner_username
PublishedWorkspaceDefinition.size
PublishedWorkspaceDefinition.status
PublishedWorkspaceDefinition.tenant_id
PublishedWorkspaceRequester
PublishedWorkspaceType
PublishedWorkspaceUploadStatus
ReceivedFrom
ReceivedFromWorkspace
Reference
ReleasedProjectReference
VcsReference
Workspace
Workspace.create_experiment()
Workspace.create_project()
Workspace.definition
Workspace.delete()
Workspace.download()
Workspace.execute()
Workspace.export()
Workspace.from_conversion_operation()
Workspace.from_import_operation()
Workspace.get_custom_function()
Workspace.get_custom_functions()
Workspace.get_default_project()
Workspace.get_dependencies()
Workspace.get_experiment()
Workspace.get_experiments()
Workspace.get_fmu()
Workspace.get_fmus()
Workspace.get_model()
Workspace.get_modelica_resource_uri()
Workspace.get_projects()
Workspace.get_published_workspace()
Workspace.get_shared_definition()
Workspace.id
Workspace.import_dependency_from_zip()
Workspace.import_project_from_zip()
Workspace.name
Workspace.received_from
Workspace.rename()
Workspace.size
Workspace.upload_result()
WorkspaceDefinition
WorkspaceDefinition.created_by
WorkspaceDefinition.default_project_id
WorkspaceDefinition.dependencies
WorkspaceDefinition.description
WorkspaceDefinition.format
WorkspaceDefinition.from_file()
WorkspaceDefinition.name
WorkspaceDefinition.projects
WorkspaceDefinition.received_from
WorkspaceDefinition.to_dict()
WorkspaceDefinition.to_file()
- Module contents
- Subpackages
- modelon.impact.client.experiment_definition package
- Subpackages
- modelon.impact.client.experiment_definition.interfaces package
- Submodules
- modelon.impact.client.experiment_definition.asserts module
- modelon.impact.client.experiment_definition.expansion module
- modelon.impact.client.experiment_definition.extension module
SimpleExperimentExtension
SimpleExperimentExtension.case_label
SimpleExperimentExtension.initialize_from
SimpleExperimentExtension.modifiers
SimpleExperimentExtension.simulation_log_level
SimpleExperimentExtension.simulation_options
SimpleExperimentExtension.solver_options
SimpleExperimentExtension.to_dict()
SimpleExperimentExtension.with_case_label()
SimpleExperimentExtension.with_initialize_from()
SimpleExperimentExtension.with_modifiers()
- modelon.impact.client.experiment_definition.fmu_based module
SimpleFMUExperimentDefinition
SimpleFMUExperimentDefinition.custom_function
SimpleFMUExperimentDefinition.extensions
SimpleFMUExperimentDefinition.fmu
SimpleFMUExperimentDefinition.initialize_from
SimpleFMUExperimentDefinition.modifiers
SimpleFMUExperimentDefinition.simulation_log_level
SimpleFMUExperimentDefinition.simulation_options
SimpleFMUExperimentDefinition.solver_options
SimpleFMUExperimentDefinition.to_dict()
SimpleFMUExperimentDefinition.validate()
SimpleFMUExperimentDefinition.with_cases()
SimpleFMUExperimentDefinition.with_extensions()
SimpleFMUExperimentDefinition.with_initialize_from()
SimpleFMUExperimentDefinition.with_modifiers()
- modelon.impact.client.experiment_definition.model_based module
SimpleModelicaExperimentDefinition
SimpleModelicaExperimentDefinition.compiler_log_level
SimpleModelicaExperimentDefinition.compiler_options
SimpleModelicaExperimentDefinition.custom_function
SimpleModelicaExperimentDefinition.expansion
SimpleModelicaExperimentDefinition.extensions
SimpleModelicaExperimentDefinition.fmi_target
SimpleModelicaExperimentDefinition.fmi_version
SimpleModelicaExperimentDefinition.initialize_from
SimpleModelicaExperimentDefinition.model
SimpleModelicaExperimentDefinition.modifiers
SimpleModelicaExperimentDefinition.platform
SimpleModelicaExperimentDefinition.runtime_options
SimpleModelicaExperimentDefinition.simulation_log_level
SimpleModelicaExperimentDefinition.simulation_options
SimpleModelicaExperimentDefinition.solver_options
SimpleModelicaExperimentDefinition.to_dict()
SimpleModelicaExperimentDefinition.validate()
SimpleModelicaExperimentDefinition.with_cases()
SimpleModelicaExperimentDefinition.with_expansion()
SimpleModelicaExperimentDefinition.with_extensions()
SimpleModelicaExperimentDefinition.with_initialize_from()
SimpleModelicaExperimentDefinition.with_modifiers()
- modelon.impact.client.experiment_definition.modifiers module
- modelon.impact.client.experiment_definition.operators module
- modelon.impact.client.experiment_definition.util module
- Module contents
- Subpackages
- modelon.impact.client.operations package
- Subpackages
- Submodules
- modelon.impact.client.operations.base module
- modelon.impact.client.operations.case module
- modelon.impact.client.operations.case_result module
- modelon.impact.client.operations.content_import module
- modelon.impact.client.operations.custom_artifact module
- modelon.impact.client.operations.experiment module
- modelon.impact.client.operations.external_result_import module
- modelon.impact.client.operations.fmu_import module
- modelon.impact.client.operations.model_executable module
- modelon.impact.client.operations.project_import module
- Module contents
- modelon.impact.client.sal package
- Submodules
- modelon.impact.client.sal.context module
- modelon.impact.client.sal.custom_function module
- modelon.impact.client.sal.exceptions module
- modelon.impact.client.sal.experiment module
ExperimentService
ExperimentService.case_artifact_get()
ExperimentService.case_artifacts_meta_get()
ExperimentService.case_get()
ExperimentService.case_get_log()
ExperimentService.case_put()
ExperimentService.case_result_get()
ExperimentService.case_result_upload()
ExperimentService.case_result_variables_get()
ExperimentService.case_trajectories_get()
ExperimentService.cases_get()
ExperimentService.custom_artifact_upload()
ExperimentService.execute_cancel()
ExperimentService.execute_status()
ExperimentService.experiment_delete()
ExperimentService.experiment_execute()
ExperimentService.experiment_result_variables_get()
ExperimentService.experiment_set_label()
ExperimentService.trajectories_get()
ResultFormat
- modelon.impact.client.sal.exports module
- modelon.impact.client.sal.external_result module
- modelon.impact.client.sal.http module
HTTPClient
HTTPClient.delete_json()
HTTPClient.get_csv()
HTTPClient.get_file_response()
HTTPClient.get_json()
HTTPClient.get_json_response()
HTTPClient.get_mat()
HTTPClient.get_octet_response()
HTTPClient.get_text()
HTTPClient.get_xml()
HTTPClient.get_zip()
HTTPClient.patch_json_no_response_body()
HTTPClient.post_json()
HTTPClient.post_json_no_response_body()
HTTPClient.put_json()
HTTPClient.put_json_no_response_body()
- modelon.impact.client.sal.imports module
- modelon.impact.client.sal.model_executable module
ModelExecutableService
ModelExecutableService.compile_cancel()
ModelExecutableService.compile_log()
ModelExecutableService.compile_model()
ModelExecutableService.compile_status()
ModelExecutableService.fmu_delete()
ModelExecutableService.fmu_setup()
ModelExecutableService.model_description_get()
ModelExecutableService.settable_parameters_get()
ModelExecutableService.ss_fmu_metadata_get()
- modelon.impact.client.sal.project module
ProjectService
ProjectService.fmu_import()
ProjectService.import_from_zip()
ProjectService.project_content_delete()
ProjectService.project_content_get()
ProjectService.project_content_upload()
ProjectService.project_default_options_get()
ProjectService.project_delete()
ProjectService.project_get()
ProjectService.project_options_get()
ProjectService.project_put()
ProjectService.projects_get()
- modelon.impact.client.sal.request module
- modelon.impact.client.sal.response module
- modelon.impact.client.sal.service module
- modelon.impact.client.sal.uri module
- modelon.impact.client.sal.users module
- modelon.impact.client.sal.workspace module
WorkspaceService
WorkspaceService.delete_published_workspace()
WorkspaceService.dependencies_get()
WorkspaceService.experiment_create()
WorkspaceService.experiment_get()
WorkspaceService.experiments_get()
WorkspaceService.fmu_download()
WorkspaceService.fmu_get()
WorkspaceService.fmus_get()
WorkspaceService.get_project_matchings()
WorkspaceService.get_published_workspace()
WorkspaceService.get_published_workspace_acl()
WorkspaceService.get_published_workspaces()
WorkspaceService.get_published_workspaces_by_kind()
WorkspaceService.get_workspace_conversion_status()
WorkspaceService.grant_community_access()
WorkspaceService.grant_group_access()
WorkspaceService.grant_user_access()
WorkspaceService.import_dependency_from_zip()
WorkspaceService.import_from_cloud()
WorkspaceService.import_from_shared_definition()
WorkspaceService.import_from_zip()
WorkspaceService.import_project_from_zip()
WorkspaceService.project_create()
WorkspaceService.projects_get()
WorkspaceService.rename_published_workspace()
WorkspaceService.request_user_access()
WorkspaceService.revoke_community_access()
WorkspaceService.revoke_group_access()
WorkspaceService.revoke_user_access()
WorkspaceService.shared_definition_get()
WorkspaceService.update_workspace()
WorkspaceService.workspace_conversion_setup()
WorkspaceService.workspace_create()
WorkspaceService.workspace_delete()
WorkspaceService.workspace_export_setup()
WorkspaceService.workspace_get()
WorkspaceService.workspaces_get()
- Module contents
Submodules
modelon.impact.client.client module
This module provides an entry-point to the client APIs.
- class Client(url=None, interactive=None, credential_manager=None, context=None)
Bases:
object
This Class contains methods to authenticate logins, create new workspaces and upload or fetch existing workspaces.
- Parameters:
url (
Optional
[str
]) – The URL for Modelon Impact client host. Defaults to the value specified by environment variable ‘MODELON_IMPACT_CLIENT_URL’ if set else uses the URL ‘https://impact.modelon.cloud/’.interactive (
Optional
[bool
]) –If True the client will prompt for an API key if no other login information can be found. An API key entered for this prompt will be saved to disk and re-used next time the Client is instantiated. If False no prompt will be given if no other login information can be found and login will be done as if no API key was given (anonymous login).
For scripts and notebooks that are running interactively by a user in a shell it is recommended to use interactive=True. For scripts or applications that are automated or for other reasons won’t have a user ready to enter an API key it is recommended to use interactive=False.
Default is False. It is possible to change the default value through the environment variable ‘MODELON_IMPACT_CLIENT_INTERACTIVE’.
credential_manager (
Optional
[CredentialManager
]) – Help class for managing credentials for the Impact server. Default is None and then the default credential manager is used.context (
Optional
[Context
]) – Request contexts to pass data alongside a HTTP request. Default is None and then the default context is used.
Example:
from modelon.impact.client import Client client = Client(url=impact_url) client = Client(url=impact_url, interactive=True)
- convert_workspace(workspace_id, backup_name=None)
Converts a workspace of an old version up to the new version the server is using.
- Parameters:
workspace_id (
str
) – The ID of the workspace to convert to the latestbackup_name (
Optional
[str
]) – If given then a backup will be created with thisNone. (name. Defaults to) –
- Return type:
- Returns:
The workspace conversion operation
Example:
workspace = client.convert_workspace(workspace_id, backup_name='old save') .wait()
- create_workspace(workspace_name)
Creates and returns a Workspace. Returns a workspace class object.
- Parameters:
workspace_name (
str
) – The name of the workspace to create.- Return type:
- Returns:
The created workspace class object.
Example:
workspace = client.create_workspace('my_workspace')
- get_case_by_reference(reference)
Return the Case class object given a CaseReference class.
- Parameters:
reference (
CaseReference
) – A CaseReference class object.- Return type:
- Returns:
A Case class object.
Example:
case_def = case.get_definition() baseline_case_ref = case_def.custom_function.parameter_values[ "baseline_case"] case = client.get_case_by_reference(baseline_case_ref)
- get_executions(workspace_id=None)
Yields running/active executions.
- Parameters:
workspace_id (
Optional
[str
]) – The id of the workspace.- Yields:
An ExperimentOperation or a ModelExecutableOperation class.
- Return type:
Iterable
[Union
[ExperimentOperation
,ModelExecutableOperation
,None
]]
Example:
list(client.get_executions())
- get_experiment_by_reference(reference)
Return the Experiment class object given a ExperimentReference class.
- Parameters:
reference (
ExperimentReference
) – An ExperimentReference class object.- Return type:
- Returns:
An Experiment class object.
Example:
exp_def = experiment.get_definition() experiment_ref = exp_def.custom_function.parameter_values[ "reference_experiment"] exp = client.get_experiment_by_reference(experiment_ref)
- get_me()
Return the User class object for the logged in user.
Example:
user = client.get_me() user_tenant_group_name = user.tenant.group_name
- Return type:
- get_project(project_id, vcs_info=True)
Returns a project class object.
- Parameters:
project_id (
str
) – The id of the project.vcs_info (
bool
) – If True, the versioning details are returned for the project(if under version control).
- Return type:
- Returns:
Project class objects.
Example:
client.get_project('hcbhsb11313321')
- get_project_matchings(shared_definition)
Returns all projects matchings that would happen during a workspace import. As import will fail if there are multiple possible matchings of local projects for a project, this method is used to get these matchings which can be resolved to an unequivocal ‘selection’. Selections are used as (optional) input to the
import_workspace_from_shared_definition
method.- Parameters:
shared_definition (
WorkspaceDefinition
) – The workspace definition for the shared workspace- Return type:
- Returns:
A ProjectMatchings class object.
Example:
# Import with conflicts(Multiple existing projects matches the URI) # Programatic workflow to resolve conflicts matchings = client.get_project_matchings(shared_definition) # Assume the first in list of matchings is good enough: selections = [entry.get_selection(index=0) for entry in matchings.entries] imported_workspace = client.import_from_shared_definition( shared_definition, selections ).wait() # Interactive workflow matchings = client.get_project_matchings(shared_definition) selections = matchings.make_selections_interactive() imported_workspace = client.import_workspace_from_shared_definition( shared_definition, selections ).wait()
- get_projects(vcs_info=True, project_type=None, storage_location=None)
Returns a list of project class object.
- Parameters:
vcs_info (
bool
) – If True, the versioning details are returned for the projects under version control.project_type (
Optional
[ProjectType
]) – Used to filter so only projects of a specified ProjectType are returned. If not given all project types are returned.storage_location (
Optional
[StorageLocation
]) – Used to filter so only projects of a specified StorageLocation are returned. If not given all project in all storage locations are returned.
- Return type:
List
[Project
]- Returns:
A list of Project class objects.
Example:
from modelon.impact.client import ProjectType, StorageLocation client.get_projects() client.get_projects( project_type=ProjectType.LOCAL, storage_location=StorageLocation.USERSPACE )
- get_published_workspaces_client()
Return the PublishedWorkspacesClient class object.
Example:
pw_client = client.get_published_workspaces_client() pw_client.get_by_id("2h98hciwsniucwincj")
- Return type:
- get_workspace(workspace_id)
Returns a Workspace class object.
- Parameters:
workspace_id (
str
) – The ID of the workspace.- Return type:
- Returns:
Workspace class object.
Example:
client.get_workspace('my_workspace')
- get_workspace_by_name(workspace_name)
Returns a list of Workspace class objects with the given name.
- Parameters:
workspace_name (
str
) – The name of the workspace.- Return type:
List
[Workspace
]- Returns:
A list of workspace class objects with the given name.
Example:
workspaces = client.get_workspace_by_name('TestWorkspace')
- get_workspaces(only_app_mode=False, name=None, sharing_id=None)
Returns a list of Workspace class object.
- Return type:
List
[Workspace
]- Returns:
A list of Workspace class objects.
Example:
workspaces = client.get_workspaces()
- import_project_from_zip(path_to_project)
Imports a Project from a compressed(.zip) project file. Returns the project class object.
- Parameters:
path_to_project (
str
) – The path for the compressed project(.zip)uploaded. (to be) –
- Return type:
- Returns:
A ProjectImportOperation class object.
Example:
client.import_project_from_zip(path_to_project).wait()
Imports a Workspace from a shared workspace definition.
- Parameters:
shared_definition (
WorkspaceDefinition
) – The workspace definition for the shared workspaceselection – Optional list of Selection class objects. This can be specified
URI. (if there are multiple existing projects with the same version control) –
- Return type:
- Returns:
A WorkspaceImportOperation class object.
Example:
# Import with no conflicts client.import_workspace_from_shared_definition(shared_definition).wait() # Import with conflicts(Multiple existing projects matches the URI) # Programatic workflow to resolve conflicts matchings = client.get_project_matchings(shared_definition) # Assume the first in list of matchings is good enough: selections = [entry.get_selection(index=0) for entry in matchings.entries] imported_workspace = client.import_workspace_from_shared_definition( shared_definition, selections ).wait() # Interactive workflow matchings = client.get_project_matchings(shared_definition) selections = matchings.make_selections_interactive() imported_workspace = client.import_workspace_from_shared_definition( shared_definition, selections ).wait()
- import_workspace_from_zip(path_to_workspace)
Imports a Workspace from a compressed(.zip) workspace file. Similar to
upload_workspace
, but gives more control for getting the workspace async. Returns an WorkspaceImportOperation class object.- Parameters:
path_to_workspace (
str
) – The path for the compressedworkspace (.zip) –
- Return type:
- Returns:
A WorkspaceImportOperation class object.
Example:
client.import_workspace_from_zip(path_to_workspace).wait()
- upload_workspace(path_to_workspace)
Imports a Workspace from a compressed(.zip) workspace file. Returns the workspace class object of the imported workspace. Similar to
import_workspace_from_zip
, but does the import in one go.- Parameters:
path_to_workspace (
str
) – The path for the compressed workspace(.zip)uploaded. (to be) –
- Return type:
- Returns:
Workspace class object.
Example:
workspace = client.upload_workspace(path_to_workspace)
- class Execution(kind, workspace_id, id)
Bases:
object
-
id:
str
-
kind:
ExecutionKind
-
workspace_id:
str
-
id:
- class ExecutionKind(value)
Bases:
Enum
An enumeration.
- COMPILATION = 'COMPILATION'
- EXPERIMENT = 'EXPERIMENT'
- class ProjectMatching(entry_id, vcs_uri, projects)
Bases:
object
-
entry_id:
str
- get_selection(index)
Returns the selection given the index of the selected project.
- Parameters:
index (
int
) – The index of the selected project- Return type:
- Returns:
A Selection class object.
Example:
matchings = client.get_project_matchings(imported_workspace_definition) selection = matchings.entries[0].get_selection(index=0) client.import_workspace_from_shared_definition(shared_definition).wait()
- make_selection_interactive()
Returns an interactively chosen Selection object.
- Return type:
- Returns:
A Selection class object.
Example:
matchings = client.get_project_matchings(imported_workspace_definition) selection = matchings.entries[0].make_selection_interactive()
-
vcs_uri:
str
-
entry_id:
- class ProjectMatchings(entries)
Bases:
object
-
entries:
List
[ProjectMatching
]
- make_selections_interactive()
Returns a list of Selection class objects based on interactive input from users. As import will fail if there are multiple possible matchings of local projects for a project, this method is used to resolve to an unequivocal ‘selection’. The list of preferred Selection objects could be specified during workspace import in the
import_workspace_from_shared_definition
method.- Return type:
List
[Selection
]- Returns:
A a list of Selection class objects.
Example:
# Interactive workflow matchings = client.get_project_matchings(shared_definition) selections = matchings.make_selections_interactive() imported_workspace = client.import_workspace_from_shared_definition( shared_definition, selections ).wait()
-
entries:
- class Selection(entry_id, project)
Bases:
object
-
entry_id:
str
- to_dict()
- Return type:
Dict
[str
,Any
]
-
entry_id:
modelon.impact.client.configuration module
- class Experimental(fn)
Bases:
object
- get_client_experimental()
Returns the default for if experimental client methods should be enabled or not.
Can be overridden by the environment variable IMPACT_PYTHON_CLIENT_EXPERIMENTAL.
- Return type:
bool
- get_client_interactive()
Returns the default for if client will run interactive or not if unspecified.
Can be overridden by the environment variable MODELON_IMPACT_CLIENT_INTERACTIVE.
- Return type:
bool
- get_client_url()
Returns the default URL the client will use if unspecified.
Can be overridden by the environment variable MODELON_IMPACT_CLIENT_URL.
- Return type:
str
modelon.impact.client.credential_manager module
- class CredentialManager(file_id='api.key', env_names=['MODELON_IMPACT_CLIENT_API_KEY'], interactive_help_text='Enter Modelon Impact API key:')
Bases:
object
- get_key(interactive=False)
- Return type:
Optional
[str
]
- get_key_from_env()
- Return type:
Optional
[str
]
- get_key_from_file()
- Return type:
Optional
[str
]
- get_key_from_prompt()
- Return type:
str
- write_key_to_file(api_key)
- Return type:
None
modelon.impact.client.exceptions module
- exception Error
Bases:
Exception
- exception OperationFailureError
Bases:
Error
- classmethod for_operation(operation_name)
- Return type:
modelon.impact.client.options module
- class BaseExecutionOptions(values, custom_function_name)
Bases:
Mapping
,ABC
Base class for the simulation, compiler, solver and runtime options settings.
- with_values(**modified)
Sets/updates the options.
- Parameters:
parameters – A key-worded, variable-length argument list of options.
- Return type:
Any
Example:
cmp_opts = custom_function.get_compiler_options().with_values( c_compiler='gcc') runtime_opts = custom_function.get_runtime_options().with_values( cs_solver=0) sol_opts = custom_function.get_solver_options().with_values(rtol=1e-7) sim_opts = custom_function.get_simulation_options().with_values(ncp=500)
- class CompilerOptions(values, custom_function_name)
Bases:
BaseExecutionOptions
- class ProjectExecutionOptions(data, name)
Bases:
object
- property compiler_options: CompilerOptions
- property custom_function: str
- property runtime_options: RuntimeOptions
- property simulation_options: SimulationOptions
- property solver_options: SolverOptions
- to_dict()
- Return type:
Dict
[str
,Any
]
- class RuntimeOptions(values, custom_function_name)
Bases:
BaseExecutionOptions
- class SimulationOptions(values, custom_function_name)
Bases:
BaseExecutionOptions
- with_result_filter(filter)
Sets the variable filter for results.
- Parameters:
filter (
List
[str
]) – A list of filter patterns for choosing which variables to actually store result for. The syntax can be found in https://en.wikipedia.org/wiki/Glob_(programming). An example for filter is *der, which would stores all variables ending with der.- Return type:
Example:
sim_opts = custom_function.get_simulation_options().with_result_filter( filter = ["*.phi"])
- class SolverOptions(values, custom_function_name)
Bases:
BaseExecutionOptions
modelon.impact.client.published_workspace_client module
- class PublishedWorkspaceAccess(sharing_id, requested_id, requested_username, published_workspace=None)
Bases:
object
-
published_workspace:
Optional
[PublishedWorkspace
] = None
-
requested_id:
str
-
requested_username:
str
-
sharing_id:
str
-
published_workspace:
- class PublishedWorkspaceAccessKind(value)
Bases:
Enum
An enumeration.
- REQUESTED_BY_ME = 'requestedByMe'
- REQUESTED_FROM_ME = 'requestedFromMe'
- SHARED_BY_ME = 'sharedByMe'
- SHARED_WITH_ME = 'sharedWithMe'
- class PublishedWorkspacesClient(service)
Bases:
object
- find(*, name='', first=0, maximum=20, has_data=True, owner_username='', type=None, group_name=None)
Returns a list of published workspaces. The snapshots could be filtered based on the key-worded arguments.
- Parameters:
name (
str
) – Name of the workspace.first (
int
) – Index of first matching resource to return.maximum (
int
) – Maximum number of resources to return.has_data (
bool
) – If true, filters withfalse (status==PublishedWorkspaceUploadStatus.CREATED. If) –
everything. (returns) –
owner_username (
str
) – If true, only workspaces published by the specifiedlisted. (user are) –
type (
Optional
[PublishedWorkspaceType
]) – Filter so only published workspace of a specified type are returned. If not given all published workspace types are returned.group_name (
Optional
[str
]) – Group name to query published workspaces for. Only a user with impact-sys-admin role can query published workspaces shared with a group other than his own.
- Return type:
List
[PublishedWorkspace
]- Returns:
A list of published workspace class objects.
Example:
pw_client = client.get_published_workspaces_client() pw_client.find()
- get_by_id(sharing_id, request_if_no_access=False)
Returns the published workspace class object with the given ID.
- Parameters:
sharing_id (
str
) – ID of the published workspace.request_if_no_access (
bool
) – Request access if user doesn’t have access.
- Return type:
Optional
[PublishedWorkspace
]- Returns:
The published workspace class object.
Example:
pw_client = client.get_published_workspaces_client() pw_client.get("2h98hciwsniucwincj")