Giter Site home page Giter Site logo

taipy-config's Introduction

⚠️ Archived ⚠️

WARNING: This repository is archived. Taipy has performed a repository restructuring. The taipy-config code has been moved and merged into the main taipy repository.


License

Copyright 2021-2024 Avaiga Private Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

taipy-config's People

Contributors

bobbyshermi avatar dinhlongviolin1 avatar dr-irv avatar fabienlelaquais avatar fredll-avaiga avatar joaoandre-avaiga avatar jrobinav avatar toan-quach avatar trgiangdo avatar tsuu2092 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

taipy-config's Issues

Improve the error message of Config.check()

Description

When config a SQLDataNode without required properties, the Config checker works correctly.

However, the message is kinda long. It can be improved for better readability.

For example,

y_cfg = Config.configure_data_node(id="y", storage_type="sql")

will output several error when running the Core service

[2023-02-03 09:37:39,172][Taipy][INFO] Issue(level='INFO', field='comparators', value=defaultdict(<class 'list'>, {}), message='No scenario comparators defined for scenario my_scenario', tag='_ScenarioConfigChecker')
[2023-02-03 09:37:39,172][Taipy][ERROR] Issue(level='ERROR', field='properties', value='db_username', message='`y` DataNode is missing the required property `db_username` for type `sql`', tag='_DataNodeConfigChecker')
[2023-02-03 09:37:39,172][Taipy][ERROR] Issue(level='ERROR', field='properties', value='db_password', message='`y` DataNode is missing the required property `db_password` for type `sql`', tag='_DataNodeConfigChecker')
[2023-02-03 09:37:39,172][Taipy][ERROR] Issue(level='ERROR', field='properties', value='db_name', message='`y` DataNode is missing the required property `db_name` for type `sql`', tag='_DataNodeConfigChecker')
[2023-02-03 09:37:39,172][Taipy][ERROR] Issue(level='ERROR', field='properties', value='db_engine', message='`y` DataNode is missing the required property `db_engine` for type `sql`', tag='_DataNodeConfigChecker')
[2023-02-03 09:37:39,172][Taipy][ERROR] Issue(level='ERROR', field='properties', value='read_query', message='`y` DataNode is missing the required property `read_query` for type `sql`', tag='_DataNodeConfigChecker')
[2023-02-03 09:37:39,172][Taipy][ERROR] Issue(level='ERROR', field='properties', value='write_query_builder', message='`y` DataNode is missing the required property `write_query_builder` for type `sql`', tag='_DataNodeConfigChecker')
Traceback (most recent call last):
  File "/Users/trgiangdo/Developer/test/test_migration.py", line 17, in <module>
    tp.Core().run()
  File "/Users/trgiangdo/.local/share/virtualenvs/test-ANcl6Zy-/lib/python3.10/site-packages/taipy/core/_core.py", line 49, in run
    self.__check_config()
  File "/Users/trgiangdo/.local/share/virtualenvs/test-ANcl6Zy-/lib/python3.10/site-packages/taipy/core/_core.py", line 66, in __check_config
    Config.check()
  File "/Users/trgiangdo/.local/share/virtualenvs/test-ANcl6Zy-/lib/python3.10/site-packages/taipy/config/config.py", line 178, in check
    cls.__log_message(cls)
  File "/Users/trgiangdo/.local/share/virtualenvs/test-ANcl6Zy-/lib/python3.10/site-packages/taipy/config/config.py", line 250, in __log_message
    raise ConfigurationIssueError("Configuration issues found.")
taipy.config.exceptions.exceptions.ConfigurationIssueError: Configuration issues found.

Expected behavior

The error message can be shorter, and no Exception raise at the end. For example:

[2023-02-03 09:37:39,172][Taipy][INFO] No scenario comparators defined for scenario my_scenario
[2023-02-03 09:37:39,172][Taipy][ERROR] `y` DataNode is missing the required property `db_username` for type `sql`
[2023-02-03 09:37:39,172][Taipy][ERROR] `y` DataNode is missing the required property `db_password` for type `sql`
[2023-02-03 09:37:39,172][Taipy][ERROR] `y` DataNode is missing the required property `db_name` for type `sql`
[2023-02-03 09:37:39,172][Taipy][ERROR] `y` DataNode is missing the required property `db_engine` for type `sql`
[2023-02-03 09:37:39,172][Taipy][ERROR] `y` DataNode is missing the required property `read_query` for type `sql`
[2023-02-03 09:37:39,172][Taipy][ERROR] `y` DataNode is missing the required property `write_query_builder` for type `sql`

Ignore unnecessary attributes on _ConfigComparator

Description

Create API to define unnecessary attributes that can be ignored when comparing the Config between versions on the Version control system.

These include:

  • Job execution Configuration
  • GUI Configuration

Add new checker for repository_type field on GlobalConfig

@bobbyshermi commented on Mon May 01 2023

It would be great to have a checker on the value of the repository_type field in GlobalAppConfig.

It can raise an error if the repository_type is unknown (sql or filesystem). Something like.

    def _check_repository_type(self, global_config: GlobalAppConfig):
        value = global_config.repository_type
        if value != "filesystem" and value != "sql":
            self._error(
                global_config._REPOSITORY_TYPE_KEY,
                value,
                f"unknown value: {value} for field {global_config._REPOSITORY_TYPE_KEY}.",
            )

@FlorianJacta commented on Tue May 02 2023

Thank you for your issue! The current behavior is that any repository_type different from “sql” and “filesystem” will eventually be “filesystem” (the default value). If this checker is added, then this behavior should also be changed.

The Taipy Core team will look through this issue and answer it.

Implement Config comparator to compare between versions

Description

The purpose is to compare between the Python Config and the Config from an older version when run on --experiment mode.

If there is any difference, the comparator API should be able to specify where the difference come from in Python Config so that the user can update it accordingly.

BUG- Applied config and Default config share the same instance

Description
The applied config and Default config share the same instance.

When compiling the _Config, the _applied_config is initialized with the _default_config using the same instance. Consequently, when updating the _applied_config with the subsequent compilations, the _default_config is also updated.

How to reproduce

The following test exhibits the problem :

def test_applied_config_compilation_does_not_change_other_configs():
    assert len(Config._default_config._unique_sections) == 1
    assert Config._default_config._unique_sections["unique_section_name"] is not None
    assert Config._default_config._unique_sections["unique_section_name"].attribute == "default_attribute"
    assert Config._default_config._unique_sections["unique_section_name"].prop is None
    assert len(Config._python_config._unique_sections) == 0
    assert len(Config._file_config._unique_sections) == 0
    assert len(Config._env_file_config._unique_sections) == 0
    assert len(Config._applied_config._unique_sections) == 1
    assert Config._applied_config._unique_sections["unique_section_name"] is not None
    assert Config._applied_config._unique_sections["unique_section_name"].attribute == "default_attribute"
    assert Config._applied_config._unique_sections["unique_section_name"].prop is None
    assert len(Config.unique_sections) == 1
    assert Config.unique_sections["unique_section_name"] is not None
    assert Config.unique_sections["unique_section_name"].attribute == "default_attribute"
    assert Config.unique_sections["unique_section_name"].prop is None
    assert Config._applied_config._unique_sections["unique_section_name"] is not 
    Config._default_config._unique_sections["unique_section_name"]

    Config.configure_unique_section_for_tests("qwe", prop="rty")

    assert len(Config._default_config._unique_sections) == 1
    assert Config._default_config._unique_sections["unique_section_name"] is not None
    assert Config._default_config._unique_sections["unique_section_name"].attribute == "default_attribute"
    assert Config._default_config._unique_sections["unique_section_name"].prop is None
    assert len(Config._python_config._unique_sections) == 1
    assert Config._python_config._unique_sections["unique_section_name"] is not None
    assert Config._python_config._unique_sections["unique_section_name"].attribute == "qwe"
    assert Config._python_config._unique_sections["unique_section_name"].prop == "rty"
    assert Config._python_config._unique_sections["unique_section_name"] != 
    Config._default_config._unique_sections["unique_section_name"]
    assert len(Config._file_config._unique_sections) == 0
    assert len(Config._env_file_config._unique_sections) == 0
    assert len(Config._applied_config._unique_sections) == 1
    assert Config._applied_config._unique_sections["unique_section_name"] is not None
    assert Config._applied_config._unique_sections["unique_section_name"].attribute == "qwe"
    assert Config._applied_config._unique_sections["unique_section_name"].prop == "rty"
    assert Config._python_config._unique_sections["unique_section_name"] != 
    Config._applied_config._unique_sections["unique_section_name"]
    assert Config._default_config._unique_sections["unique_section_name"] != 
    Config._applied_config._unique_sections["unique_section_name"]
    assert len(Config.unique_sections) == 1
    assert Config.unique_sections["unique_section_name"] is not None
    assert Config.unique_sections["unique_section_name"].attribute == "qwe"
    assert Config.unique_sections["unique_section_name"].prop == "rty"

Expected behavior
1 - The _applied_config should be a completely different instance from all other_Configs.
2 - All sections of the _applied_config should be different instances.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.