IBM / dse-do-dashboard

Plotly/Dash dashboard for Decision Optimization projects in IBM Cloud Pak for Data
Apache License 2.0
4 stars 3 forks source link

Understand use of `globals()` and `locals()` when running DoNotebookRunner #18

Open victorterpstra opened 2 years ago

victorterpstra commented 2 years ago

The DoNotebookRunner seems to run fine if we grab the globals() and locals() from the main Python file. (For the dashboard, that is the xxx_index.py file)

Grabbing globals() and locals() somewhere within the call hierarchy, e.g. when creating the DoNotebookRunner does NOT seem to work! We get weird errors around importing packages, e.g. that pd is unknown, although the import pandas as pd statement doesn't throw an error.

So the current work-around is to grab the globals/locals at the root level, but that is not very elegant.

(Note that the DoNotebookRunner.run adds the inputs, and an empty outputs to the locals.)