Skip to content

How to enable edit capabilities on the Workbench

aherrera-simscale edited this page Aug 26, 2021 · 2 revisions

Compatibility with the Workbench is not fully supported yet. In particular, there is no guarantee that Simulations created via the SimScale API can be modified using the Workbench. If your Simulation model corresponds to a schema version other than the latest one, modification using the Workbench will not be possible. This is to prevent any unexpected change to your model that would make it incompatible with your code.

Follow the instructions below to update your models with the latest published schema version. Important: edit mode can still be disabled even if you are using the latest published Simulation Spec schema version. This is because the Workbench might use a newer schema version that is not available yet to SimScale API clients. You will have to wait until a new Simulation Spec schema version is released.

As a workaround, you can duplicate the Simulation or Mesh Operation on the Workbench. Modification will be enabled for the copy. The same can be achieved by copying the entire Project. Also, you can still run simulations and continue editing your setup via the API or the SDK.

Steps to enable edit capabilities on the Workbench

We are going to assume the latest SDK version is 0.0.12 and the latest simulation version is 0.7, but you should use the values for your SDK. They are found in the release notes.

  1. Update your local SDK installation to the latest version (0.0.12)
  2. If you explicitly set the Simulation schema version when you create SimulationSpec objects in your code, update the version number to the latest version (0.7):
    simulation_spec = SimulationSpec(name=name, geometry_id=geometry_id, model=model, version="0.7")
    
    If you currently do not set this parameter explicitly in your code, then this step is not needed and updating the local SDK installation is enough to enable edit capabilities for newly created simulations.
  3. For existing simulations, you need to update the stored simulation model. You can do that by retrieving the SimulationSpec object explicitly specifying the desired schema target version (0.7) and submitting it back. Example in Python:
import os
from simscale_sdk import *

# API client configuration
configuration = Configuration()
configuration.host = os.getenv('SIMSCALE_API_URL') + '/v0'
configuration.api_key = {
    'X-API-KEY': os.getenv('SIMSCALE_API_KEY'),
}
api_client = ApiClient(configuration)

# API clients
simulation_api = SimulationsApi(api_client)

# Project ID and simulation ID
project_id = "9158298118181001480"
simulation_id = "add288d0-6196-41ee-a14d-c0d9332228c0"

# Retrieve updated simulation spec and submit it back
simulation_spec = simulation_api.get_simulation(project_id, simulation_id, simulation_spec_schema_version='0.7')
simulation_api.update_simulation(project_id, simulation_id, simulation_spec)