Max Magid
Max Magid

Reputation: 355

Why are visualizations not appearing on the correct nodes in Code Workbook?

I have a code workbook in which I create several plots using Matplotib: enter image description here

If I run all downstream from my data-dataset the plots are not shown at the expected node, sometimes they do not contain any plots and sometimes some of the nodes contain more than one visualization.

Upvotes: 0

Views: 74

Answers (1)

Max Magid
Max Magid

Reputation: 355

This is happening because matplotlib is not thread safe. By adding @synchronous_node_execution to each of the plot_-code workbook nodes, you can lock each node to ensure the visualization is shown on the correct node:

# plot 1 
import matplotlib.pyplot as plt

@synchronous_node_execution
def plot_1(data):
    df = data
    [...]

Upvotes: 0

Related Questions