Evaluation using Jupyter Notebook
You can evaluate Teamwork Cloud projects on the server by using Jupyter Notebook. This chapter explains how to set up Jupyter Notebook for server-side evaluation and describes all available requests.
Server-side evaluation is available only with the Teamwork Cloud Enterprise license.
Setting up Jupyter Notebook
To set up Jupyter Notebook
- In Jupyter Notebook, run the following command to install a Python package from the <install_root>\plugins\com.nomagic.magicdraw.sysml2.evaluation.plugin/pyEval.zip file:
%pip install pyEval.zipCODE
Use the following requests to evaluate Teamwork Cloud projects on the server:
Create a client/session and authenticate
This request starts a work session and provides authentication to Teamwork Cloud.
The following table describes the parameters used in the request:
| Parameter | In | Required or optional | Description |
|---|---|---|---|
| server_host | path | required | The Teamwork Cloud server host name. |
| server_port | path | required | The Teamwork Cloud server port. |
| TWC_user_name | path | optional | The Teamwork Cloud user name. If you do not specify the user name in the request, an input field will be provided to specify it later. |
| TWC_user_password | path | optional | The Teamwork Cloud password. If you do not specify the password in the request, an input field will be provided to specify it later. |
Get the list of Teamwork Cloud projects
This request provides the list of Teamwork Cloud projects accessible to you depending on your permissions. Only projects that you can read (the Read Resources permission) are returned.
Request and response example
client.get_projects()
[
{'created': '2025-05-27T08:36:26.723Z',
'@id': '62b072da-22f7-4ee7-9abe-37605571f9b7',
'description': '',
'@type': 'Project',
'defaultBranch': {'@id': '7765ea2c-7cc4-4f12-9606-060ae8c8304d'},
'name': "Don't Panic Batmobile"},
{'created': '2025-05-27T08:29:52.949Z',
'@id': 'b906d747-63c2-4d37-a809-49bd07d2eeba',
'description': '',
'@type': 'Project',
'defaultBranch': {'@id': 'bbe03735-3093-44d1-bd48-9856b4c00da4'},
'name': 'SysML Customization'},
{'created': '2025-05-28T17:03:01.861Z',
'@id': 'e7b10c6e-ae3c-49e9-af97-42d6384ebc2c',
'description': '',
'@type': 'Project',
'defaultBranch': {'@id': 'e6d3df11-3260-4428-bb41-a0a2255e8c69'},
'name': 'Spacecraft Mass Rollup V2'},
{'created': '2025-05-28T17:07:08.197Z',
'@id': '76ac1bae-11c9-434b-9096-3639ab338cf0',
'description': '',
'@type': 'Project',
'defaultBranch': {'@id': 'fd07a9b3-8be1-4e6e-90f1-2992d983f8e0'},
'name': 'Hinge Monte Carlo Analysis V2'}
]
Get the list of project commits
This request provides the list of commits for the specified Teamwork Cloud project.
| Parameter | In | Required or optional | Description |
|---|---|---|---|
| projectID | path | required | The Teamwork Cloud project ID. |
Request and response example
client.get_commits('62b072da-22f7-4ee7-9abe-37605571f9b7')
[{'created': '2025-05-27T08:36:26.410Z',
'@id': '15a995d2-01cf-499b-a2d8-1f943af14320',
'description': '** no message **',
'owningProject': {'@id': '62b072da-22f7-4ee7-9abe-37605571f9b7'},
'previousCommit': [{'@id': None}]},
{'created': '2025-05-27T08:39:34.763Z',
'@id': 'b7a03a50-f42a-495d-9bd1-d87978d7f73f',
'description': '** no message **',
'owningProject': {'@id': '62b072da-22f7-4ee7-9abe-37605571f9b7'},
'previousCommit': [{'@id': '15a995d2-01cf-499b-a2d8-1f943af14320'}]}}
Evaluate a parameter or expression
client.evaluate(<projectID>, commit=<commitID>, context=<contextPath>, data=json.dumps(<parameters>))
This request evaluates the specified Teamwork Cloud project parameter or expression.
The following table describes the parameters used in the request:
| Parameter | In | Required or optional | Description |
|---|---|---|---|
| projectID | path | required | The Teamwork Cloud project ID. |
| commit | path | optional | The commit ID of the Teamwork Cloud project. If the commit ID is not specified, the latest committed version is used instead. |
| context | path | optional | The context path of the outputs, inputs, and expressions used to evaluate and retrieve data, e.g., SpacecraftMassRollup::spaceCraft. |
| inputs | body | optional | The set of inputs to be provided for the evaluation. Only inputs with initial values can be modified during evaluation. |
| outputs | body | optional | The set of outputs to be obtained after the evaluation. If no outputs are specified, all values are returned based on the specified context. |
| expressions | body | optional | The parameter or expression you want to evaluate. |
Request example with a request body
parameters = {
"inputs":
{
"propulsion.thruster.me":32,
"telecom.amplifier.me":15
},
"outputs":
[
"me",
"propulsion.mee",
"propulsion.tank.me",
"propulsion.thruster.me",
"telecom.me",
"telecom.antenna.me",
"telecom.amplifier.me"
]
}
client.evaluate('a9e055de-e288-4b81-81e4-e24bbb32cedd', context='SpacecraftMassRollup::spacecraft', data=json.dumps(parameters))
Display an interactive HTML table
open_evaluation_table(self, <projectID>, commit=<commitID>, context=<contextPath>, params=<parmaList>, title=<tableTitle>, verification=<FAIL/ALL/NONE>)
This REST API request returns a JSON object containing the URL to an interactive HTML table that dynamically retrieves data based on the specified context, parameters, and/or expressions.
The following table describes the parameters used in the REST API request:
| Parameter | In | Required or optional | Description |
|---|---|---|---|
| projectID | path | required | The Teamwork Cloud project ID. |
| commit | path | optional | The commit ID of the Teamwork Cloud project. If the commit ID is not specified, the latest committed version is used instead. |
| context | path | optional | The context path of the table parameters and/or expressions used to evaluate and retrieve data, e.g. SpacecraftMassRollup::spaceCraft. |
| params | path | optional | A comma-separated list of the parameters and/or expressions to display. Use the keyword 'all' to include all available parameters based on the specified context. |
| title | path | optional | The title of the HML table. |
| verification | path | optional | Specify which verification results to display: FAIL - failing values are highlighted in red; ALL - both failing and passing values are highlighted in red and green, respectively; NONE - no verification results are displayed. |
Request example
open_evaluation_table(self, dc8b24ee-462d-4874-8b52-b85978f242cc, commit=3fa85f64-5717-4562-b3fc-2c963f66afa6, context=SpacecraftMassRollup::spaceCraft, params=me,propulsion.tank.me,propulsion.thruster.me, title=SpaceCraftMassRollup)
Request example
open_evaluation_table(self, dc8b24ee-462d-4874-8b52-b85978f242cc, commit=3fa85f64-5717-4562-b3fc-2c963f66afa6, context=SpacecraftMassRollup::spaceCraft, params=all, title=SpaceCraftMassRollup, verification=fail)
Request example
open_evaluation_table(self, dc8b24ee-462d-4874-8b52-b85978f242cc, params=SpacecraftMassRollup::spaceCraft.me,SpacecraftMassRollup::spaceCraft.propulsion.tank.me, title=SpaceCraftMassRollup)