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.zip
    CODE

Use the following requests to evaluate Teamwork Cloud projects on the server:

Create a client/session and authenticate

client = EvaluationWebClient('http(s)://<server_host>:<server_port>', '<TWC_user_name>', '<TWC_user_password>', False)

This request starts a work session and provides authentication to Teamwork Cloud.

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
server_hostpathrequiredThe Teamwork Cloud server host name.
server_portpathrequiredThe Teamwork Cloud server port.
TWC_user_namepathoptional

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_passwordpathoptionalThe 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

client.get_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'}
]
SHELL


Get the list of project commits

client.get_commits(<projectID>)

This request provides the list of commits for the specified Teamwork Cloud project.

ParameterInRequired or optionalDescription
projectIDpathrequiredThe 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'}]}}
SHELL

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:

ParameterInRequired or optionalDescription
projectIDpathrequiredThe Teamwork Cloud project ID.
commitpathoptionalThe commit ID of the Teamwork Cloud project. If the commit ID is not specified, the latest committed version is used instead.
contextpathoptionalThe context path of the outputs, inputs, and expressions used to evaluate and retrieve data, e.g., SpacecraftMassRollup::spaceCraft.
inputsbodyoptionalThe set of inputs to be provided for the evaluation. Only inputs with initial values can be modified during evaluation.
outputsbodyoptionalThe set of outputs to be obtained after the evaluation. If no outputs are specified, all values are returned based on the specified context.
expressionsbodyoptional

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))
CODE

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:

ParameterInRequired or optionalDescription
projectIDpathrequiredThe Teamwork Cloud project ID.
commitpathoptionalThe commit ID of the Teamwork Cloud project. If the commit ID is not specified, the latest committed version is used instead.
contextpathoptionalThe context path of the table parameters and/or expressions used to evaluate and retrieve data, e.g. SpacecraftMassRollup::spaceCraft.
paramspathoptionalA 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.
titlepathoptionalThe title of the HML table.
verification pathoptionalSpecify 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)
CODE


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)
CODE


Request example

open_evaluation_table(self, dc8b24ee-462d-4874-8b52-b85978f242cc, params=SpacecraftMassRollup::spaceCraft.me,SpacecraftMassRollup::spaceCraft.propulsion.tank.me, title=SpaceCraftMassRollup)
CODE