Skip to content

Configuring the Core service

The CoreSection holds configuration fields related to the core package, in particular the fields related to the Taipy repository for entity storage.

Here are the (optional) configurable properties:

  • root_folder: The path of the base folder for the Taipy application, its default value is "./taipy/".
  • storage_folder: The folder name used to store Taipy data, its default value is ".data/". It is used in conjunction with the root_folder field. That means the default storage path is "./taipy/.data/".
  • read_entity_retry: An integer number only used with filesystem repository_type.
    It corresponds to the number of times Taipy retries reading an entity after a failed attempt for concurrent access.
    The default value is 1.
  • repository_type: The type of storage that will be used to hold Taipy entities. Available options are: filesystem and mongo. The filesystem will be used as the default repository if no repository type is informed.
  • repository_properties: A dictionary of properties that will be used to instantiate the chosen repository. Only required if the chosen repository is mongo.
    If repository_type is set to filesystem, Taipy uses root_folder and storage_folder to store entities. In this case, repository_properties attribute is not required.
    If repository_type is set to mongo, the possible properties are mongodb_hostname, mongodb_user, mongodb_password, mongodb_port, application_db, properties. Please refer to MongoDB storage section.
  • mode: A string that indicates the mode of the version management system. Possible values are "development" or "experiment". On Enterprise edition of Taipy, production mode is also available. Please refer to the Versioning management documentation page for more details.
  • version_number: The identifier of the version. In development mode, the version number is ignored.
  • force: Indicates whether Taipy will override a version even if the configuration has changed or not and run the application. Default to False.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from taipy import Config

Config.configure_core(
    root_folder=".taipy_root_folder/",
    storage_folder=".data_folder",
    read_entity_retry=2,
    mode="experiment",
    version_number="1.0.0",
    application_name="my_application",
)
1
2
3
from taipy import Config

Config.load("config.toml")
config.toml
1
2
3
4
5
6
7
8
9
[TAIPY]

[CORE]
root_folder = ".taipy_root_folder/"
storage_folder = ".data_folder"
read_entity_retry = "2:int"
mode = "experiment"
version_number = "1.0.0"
application_name = "my_application"

In this example, we configure:

  • Custom values for the root_folder, storage_folder, and read_entity_retry parameters. Note that most of the time, the default values can be used.
  • The mode of the version management system to experiment mode, and the version_number is set to "1.0.0".
    Please refer to the Version management configuration documentation page for more details.
  • In lines 9, a custom application_name property are specified.

MongoDB storage for Taipy entities

Available in Taipy Enterprise edition

This section is relevant only to the Enterprise edition of Taipy.

The configuration needed to use a mongo database is described in the lines 6-14.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from taipy import Config

Config.configure_core(
    root_folder=".taipy_root_folder/",
    storage_folder=".data_folder",
    repository_type="mongo",
    repository_properties={
        "mongodb_hostname": "localhost",
        "mongodb_user": "username",
        "mongodb_password": "passwd",
        "mongodb_port": 27017,
        "application_db": "taipy",
    }
)

Taipy will create a collection, in the database described in the configuration, for each Taipy entity (Cycle, Scenario, DataNode, Task and Job), where it will store information about the Taipy entities.

Here are the configurable properties for the Mongo repository:

  • mongodb_hostname: The URL for the mongo database.
  • mongodb_user: The username to access the database.
  • mongodb_password: The password to access the database.
  • mongodb_port: The port to access the database. This property is optional and has 27017 as a default value.
  • application_db: The database that will hold the taipy collections.