Avaiga / taipy

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

[🐛 BUG] Jobs not appearing in Job selector #1698

Closed FlorianJacta closed 1 month ago

FlorianJacta commented 2 months ago

Issue

After the first execution of a scenario, sometimes, no jobs are displayed in the job selector.

How to replicate

Run this code, create, and execute a scenario. Retry this same process until the job selector is not working properly.

from taipy import Config

import taipy as tp
import pandas as pd

def identity(input):
    print("     Identity")
    return input

## Input Data Nodes
input_cfg = Config.configure_data_node(id="input_dn", default_data=2)

## Remaining Data Node
output_cfg = Config.configure_data_node(id="output_dn")

# Task config objects
identity_task_cfg = Config.configure_task(id="identity",
                                            function=identity,
                                            input=input_cfg,
                                            output=output_cfg,
                                            skippable=True)

# Configure our scenario config.
scenario_cfg = Config.configure_scenario(id="my_scenario", task_configs=[identity_task_cfg])

scenario = None

page = """
<|{scenario}|scenario_selector|>
<|{scenario}|scenario|>

<|job_selector|>
"""

pages = {'/':'<|navbar|> <|toggle|theme|> <br/>',
         'Data-Node': page}

if __name__ == "__main__":
    tp.Orchestrator().run()

    tp.Gui(pages=pages).run()
     Identity
[2024-08-23 11:52:05.234][Taipy][INFO] job JOB_identity_dba73bf2-8793-4e19-8523-bd3d47eadb91 is completed.

Expected behavior

Jobs should be correctly displayed in the console and no warning displayed in the console.

Environment

develop - 8/23/24

Acceptance Criteria

Code of Conduct

FlorianJacta commented 2 months ago

The same can be seen when we add:

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

We also have the scenario viewer status always "Running" even if the task has been completed. (This issue: https://github.com/Avaiga/taipy/issues/1669)

image

FredLL-Avaiga commented 1 month ago

I can't replicate the refresh issue But I do see some warnings when I submit a scenario multiple times

[2024-09-12 15:11:04.357][Taipy][INFO] job JOB_identity_b7c2fe0a-f713-4391-b516-3aaba6cd10c1 is completed.
C:\Users\jeu\Projects\taipy\taipy\gui_core\_context.py:823: TaipyGuiWarning: Access to job (JOB_identity_30fb91bd-f24e-4c73-aa52-8feb4c7a8598) failed:
Traceback (most recent call last):
  File "C:\Users\jeu\Projects\taipy\taipy\gui_core\_context.py", line 808, in job_adapter
    entity = core_get(job.owner_id)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\taipy.py", line 417, in get
    return _TaskManagerFactory._build_manager()._get(TaskId(entity_id))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_manager\_manager.py", line 123, in _get
    return cls._repository._load(entity_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_repository\_filesystem_repository.py", line 80, in _load
    return self.__file_content_to_entity(file_content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_repository\_filesystem_repository.py", line 219, in __file_content_to_entity
    return self.converter._model_to_entity(model)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\task\_task_converter.py", line 47, in _model_to_entity
    output=cls.__to_data_nodes(model.output_ids),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\task\_task_converter.py", line 62, in __to_data_nodes
    if data_node := data_manager._get(_id):
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_manager\_manager.py", line 123, in _get
    return cls._repository._load(entity_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_repository\_filesystem_repository.py", line 80, in _load
    return self.__file_content_to_entity(file_content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_repository\_filesystem_repository.py", line 217, in __file_content_to_entity
    file_content = json.loads(file_content, cls=_Decoder)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\json\__init__.py", line 359, in loads
    return cls(**kw).decode(s)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\json\decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 22 column 2 (char 649)

  _warn(f"Access to job ({job.id if hasattr(job, 'id') else 'No_id'}) failed", e)
C:\Users\jeu\Projects\taipy\taipy\gui_core\_context.py:823: TaipyGuiWarning: Access to job (JOB_identity_234d6fb1-20d4-4573-8cf8-fb0f4eb70dc4) failed:
Traceback (most recent call last):
  File "C:\Users\jeu\Projects\taipy\taipy\gui_core\_context.py", line 808, in job_adapter
    entity = core_get(job.owner_id)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\taipy.py", line 417, in get
    return _TaskManagerFactory._build_manager()._get(TaskId(entity_id))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_manager\_manager.py", line 123, in _get
    return cls._repository._load(entity_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_repository\_filesystem_repository.py", line 80, in _load
    return self.__file_content_to_entity(file_content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_repository\_filesystem_repository.py", line 219, in __file_content_to_entity
    return self.converter._model_to_entity(model)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\task\_task_converter.py", line 47, in _model_to_entity
    output=cls.__to_data_nodes(model.output_ids),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\task\_task_converter.py", line 62, in __to_data_nodes
    if data_node := data_manager._get(_id):
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_manager\_manager.py", line 123, in _get
    return cls._repository._load(entity_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_repository\_filesystem_repository.py", line 80, in _load
    return self.__file_content_to_entity(file_content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeu\Projects\taipy\taipy\core\_repository\_filesystem_repository.py", line 217, in __file_content_to_entity
    file_content = json.loads(file_content, cls=_Decoder)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\json\__init__.py", line 359, in loads
    return cls(**kw).decode(s)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\json\decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 27 column 2 (char 784)

any hint @jrobinAV ?