Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
15.54k stars 1.86k forks source link

[🐛 BUG] Submit button unactive after data node lock #1608

Closed FlorianJacta closed 1 month ago

FlorianJacta commented 4 months ago

What went wrong? 🤔

When using a data node viewer and scenario viewer, editing the data node will lock the scenario and finishing the edition should unblock the possibility to submit the scenario.

However, the "Submit" button is still grey and inactive even it the edition has been done. Refreshing the scenario or the page will re-activate the button.

This happens everytime editing an input data node.

Expected Behavior

Finishing the edition should reactivate the button automatically if the scenario can be submitted without the need to refresh the scenario or the page.

Steps to Reproduce Issue

Run this code, choose a scenario, notice that the scenario could be submitted, and edit the data to 2. The button becomes grey and is inactive.


# Import necessary libraries
import pandas as pd
import taipy as tp
from taipy import Config, Scope, Frequency
from taipy.gui import notify
import time

import datetime as dt

Config.configure_job_executions(mode="standalone", max_nb_of_workers=2)

# Function to run a Dataiku scenario
def run_something(input_1, input_2):
    datetime = dt.datetime.now()
    date = dt.date(2018, 1, 1)
    int_var = 10
    string_var = "String"
    return datetime, date, int_var, string_var

data = {"toto": [i for i in range(10_000)], 
        "titi": [2*i for i in range(10_000)],
        "tata": [4*i for i in range(10_000)]}

input_1_cfg = Config.configure_data_node(
    id="input_1_data_node",
    default_data=1,
)

input_2_cfg = Config.configure_data_node(
    id="input_2_data_node",
    default_data=data,
)

datetime_cfg = Config.configure_data_node(id="datetime_data_node")
date_cfg = Config.configure_data_node(id="date_data_node")
int_cfg = Config.configure_data_node(id="int_data_node")
string_cfg = Config.configure_data_node(id="string_data_node")

# Scenario and task configuration in Taipy
scenario_task_cfg = Config.configure_task(
    id="scenario_task",
    function=run_something,
    input=[input_1_cfg, input_2_cfg],
    output=[datetime_cfg, date_cfg, int_cfg, string_cfg]
)

scenario_cfg = Config.configure_scenario(
    id="scenario",
    task_configs=[scenario_task_cfg],
    frequency=Frequency.DAILY)

data_node = None
# GUI Markdown content
scenario_md = """
<|{scenario}|scenario_selector|>

<|{data_node}|data_node|>

<|{scenario}|scenario|>
"""

def on_change(state, var_name, var_value):
    if var_name == "scenario" and isinstance(var_value, tp.Scenario):
        state.data_node = state.scenario.input_1_data_node
# Main execution block with GUI setup
if __name__ == "__main__":
    tp.Core().run()
    scenario = tp.create_scenario(scenario_cfg)

    tp.Gui(scenario_md).run(title="Bug replication", port=3248)

Version of Taipy

develop and 4.0.0.dev0

Acceptance Criteria

Code of Conduct

pravintargaryen commented 3 months ago

I could reproduce this

FredLL-Avaiga commented 3 months ago

I guess we're missing an event ? @jrobinAV @trgiangdo ?

trgiangdo commented 3 months ago

Hello @FredLL-Avaiga @FlorianJacta, This is working fine on taipy 3.1.1. We didn't change what is published during the submission. Can you check again?

FredLL-Avaiga commented 3 months ago

@trgiangdo do you think it's a regression then ?

FredLL-Avaiga commented 3 months ago

Return from is_readable, is_editable and is_promotable has changed from boolean to ReasonCollection

FlorianJacta commented 1 month ago

This has not been fixed or the error reappeared recently.

FlorianJacta commented 1 month ago

For me, this problem happens almost every time, but sometimes, the submit button will behave like it is supposed to.