Which SDK and Platform version are you using?
SDK: v13.2.1
Platform: v22.06.4
Current Behavior
During a lengthy calculation triggered by an Downloadbutton exceptions don’t seem to be caught by the progressmessage: the progressmessage freezes and the cancel button is not working. I have to refresh the page to get out.
The weird thing: when I trigger the same calculation by a slow view the exception is caught as expected and I can close the pop up as excpeted.
…
Expected Behavior
Same behaviour as at the slow view
…
Hi Wichard,
Is this a constant issue or does it occur randomly? Do you perhaps have a minimal code example to help us reproduce the issue?
It seems a constant issue: Not sure if a code snippet is helpful but here it is.
@WebView("SCIA results Energy Equilibrium", duration_guess=5)
def visualize_scia_results_iterative_calculation(self, params, entity_id, **kwargs):
try:
scia_model = pickle.loads(Storage().get("scia_model", scope="entity").getvalue_binary())
results = pickle.loads(Storage().get("intermediate_results", scope="entity").getvalue_binary())
except FileNotFoundError:
_, updated_scia_file, scia_model, results = self.scia_optimize_energy_absorption(params)
Storage().set("final_iteration_model", data=File.from_data(updated_scia_file.getvalue()), scope="entity")
Storage().set("scia_model", data=File.from_data(pickle.dumps(scia_model)), scope="entity")
Storage().set("intermediate_results", data=File.from_data(pickle.dumps(results)), scope="entity")
plotly_figure = create_plotly_iterative_energy_calculation_results(scia_model, results, params)
def download_scia_model_after_iterations(self, params, entity_name, **kwargs):
try:
updated_scia_model = Storage().get("final_iteration_model", scope="entity")
except FileNotFoundError:
_, updated_scia_model, scia_model, results = self.scia_optimize_energy_absorption(params)
Storage().set("final_iteration_model", data=File.from_data(updated_scia_model.getvalue()), scope="entity")
Storage().set("scia_model", data=File.from_data(pickle.dumps(scia_model)), scope="entity")
Storage().set("intermediate_results", data=File.from_data(pickle.dumps(results)), scope="entity")
return DownloadResult(
updated_scia_model,
file_name=f"{entity_name}_ESA_model_final_iteration.esa",
)
Could you exaplain a bit what is happening in scia_optimize_energy_absorption
, I assume you are raising the UserException over there?
How long does the method take approximately?
(How often) do you send a progress message + percentage?
in scia_optimize_energy_absorptioin a iterative scia calculation is started. The method is lenghty, somewhere between 3 and 20 minutes depending on the number of loops.
De progress message + percentage is updated every loop (so every 3 minutes?). De weird thing is (as you can see) when triggered by a slow view: it works (same method). when triggered by a button the error is not caught en the screen freezes.
The UserException I tested is even before the iterative calculation starts → the input parameters are checked before the loop starts, (and before I initated a usermessage)
Hi Wichard,
Could you show the Parametrization side of this as well? We have sometimes seen weird behaviour where there was a mismatch between the button-type (e.g. DownloadButton/SetParamsButton) and the result type on the controller (e.g. DownloadResult, etc.).
scia = Page("SCIA", views=["visualize_scia_results_iterative_calculation"])
scia.downloads = Section("Downloads")
scia.downloads.input_xml_btn = DownloadButton("Input .xml +.def", method="download_scia_input_xml")
scia.downloads.esa = DownloadButton("SCIA model: single run", method="download_scia_model_esa")
scia.downloads.new_line = LineBreak()
scia.downloads.esa_energy_optimalisation = DownloadButton(
"SCIA model: iterative", method="download_scia_model_after_iterations"
)
Does the issue occur in development and / or production?
In development, I haven’t checkt production yet
Are you running on venv or docker isolation?
This issue is caused by a connector version which we have now downgraded.
In case anyone experiences the same issue, please reinstall the app!