usnistgov / AusteniteCalculator

Software and GUI for uncertainty quantification of austenite phase fraction
Other
1 stars 0 forks source link

Errors after adding additional plots and tables #11

Closed creuzige closed 2 years ago

creuzige commented 2 years ago

It looks like I may have screwed something up when I added some additional plots and tables. I get the following error messages in docker. The code still seems to run ok though...

`[2021-12-29 18:23:01 +0000] [10] [INFO] Booting worker with pid: 10

GSAS-II binary directory: /root/g2full/GSASII/bindist

Exception on /_dash-update-component [POST]

Traceback (most recent call last):

File "/root/g2full/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app

response = self.full_dispatch_request()

File "/root/g2full/lib/python3.7/site-packages/flask/app.py", line 1518, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/root/g2full/lib/python3.7/site-packages/flask/app.py", line 1516, in full_dispatch_request

rv = self.dispatch_request()

File "/root/g2full/lib/python3.7/site-packages/flask/app.py", line 1502, in dispatch_request

return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)

File "/root/g2full/lib/python3.7/site-packages/dash/dash.py", line 1336, in dispatch

response.set_data(func(*args, outputs_list=outputs_list))

File "/root/g2full/lib/python3.7/site-packages/dash/_callback.py", line 166, in add_context

flat_output_values = flatten_grouping(output_value, output)

File "/root/g2full/lib/python3.7/site-packages/dash/_grouping.py", line 34, in flatten_grouping

validate_grouping(grouping, schema)

File "/root/g2full/lib/python3.7/site-packages/dash/_grouping.py", line 214, in validate_grouping

SchemaLengthValidationError.check(grouping, full_schema, path, len(schema))

File "/root/g2full/lib/python3.7/site-packages/dash/_grouping.py", line 183, in check

raise SchemaLengthValidationError(value, full_schema, path, expected_len)

dash._grouping.SchemaLengthValidationError: Schema: [<Output intensity-plot.figure>, <Output fitted-intensity-plot.figure>, <Output intensity-table.data>, <Output intensity-table.columns>, <Output normalized-intensity-plot.figure>, <Output two_theta-plot.figure>, <Output phase-frac-table.data>, <Output phase-frac-table.columns>]

            Path: ()

            Expected length: 8

            Received value of length 5:

                [Figure({

'data': [], 'layout': {'template': '...'}

}), Figure({

'data': [], 'layout': {'template': '...'}

}), [], [], Figure({

'data': [], 'layout': {'template': '...'}

})]`

dnewton600 commented 2 years ago

The issue was that we need to return the right number of empty objects at the start of the app; if we add an extra figure/table, we have to be sure to tell the code to return an empty figure table --

This is the change that we need to make

# return nothing when app opens
if n_clicks == 0:
    return go.Figure(), go.Figure(), [], [], go.Figure(), go.Figure(), [], [] # <-- added in the last 3 empty objects