Closed FlorianJacta closed 7 months ago
The callback is called twice with the same parameters. It leads to notifying twice the user that the scenario is completed.
from taipy.config import Config import taipy as tp from taipy.gui import Gui, notify # Normal function used by Taipy def double(nb): return nb * 2 # Configuration of Data Nodes input_cfg = Config.configure_data_node("input", default_data=21) output_cfg = Config.configure_data_node("output") # Configuration of tasks first_task_cfg = Config.configure_task("double", double, input_cfg, output_cfg) # Configuration of scenario scenario_cfg = Config.configure_scenario(id="my_scenario", task_configs=[first_task_cfg], name="my_scenario") def notify_from_submissions(state, submittable, details): submission_status = details.get('submission_status') if submission_status == 'COMPLETED': print("COMPLETED") print(submittable) print(details) notify(state, 'success', 'Completed!') # Add additional actions here, like updating the GUI or logging the completion. elif submission_status == 'FAILED': print("FAILED") notify(state, 'error', 'FAILED!') # Handle failure, like sending notifications or logging the error. if __name__=="__main__": tp.Core().run() scenario_1 = tp.create_scenario(scenario_cfg) scenario_md = """ <|{scenario_1}|scenario|on_submission_change=notify_from_submissions|> """ Gui(scenario_md).run()
COMPLETED COMPLETED my_scenario my_scenario {'submission_status': 'COMPLETED', 'job': my_scenario > double > JOB_double_6eaad931-d606-40ad-919c-3e315f80cee3} {'submission_status': 'COMPLETED', 'job': my_scenario > double > JOB_double_6eaad931-d606-40ad-919c-3e315f80cee3}
This callback should be called once with these parameters
Taipy 3.0.0
Duplicate #357
Issue
The callback is called twice with the same parameters. It leads to notifying twice the user that the scenario is completed.
How to replicate
Expected behavior
This callback should be called once with these parameters
Environment
Taipy 3.0.0