Skip to content

Конфигурация

Bases: BaseSettings

Scheduler application settings.

The settings can be passed in several ways:

  1. By storing settings in a configuration file config.yml (preferred).
  2. By setting environment variables matching specific keys (SYNCMASTER__DATABASE__URL == database.url).
  3. By explicitly passing a settings object as an argument of application factory function.

More details can be found in Pydantic documentation <https://docs.pydantic.dev/latest/concepts/pydantic_settings/>_.

Examples

.. code-block:: yaml :caption: config.yml

database:
    url: postgresql+asyncpg://postgres:postgres@localhost:5432/syncmaster

broker:
    url: amqp://user:password@localhost:5672/

logging: {}
encryption: {}
scheduler: {}
Source code in syncmaster/scheduler/settings/__init__.py
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
class SchedulerAppSettings(BaseSettings):
    """
    Scheduler application settings.

    The settings can be passed in several ways:

    1. By storing settings in a configuration file ``config.yml`` (preferred).
    2. By setting environment variables matching specific keys (``SYNCMASTER__DATABASE__URL`` == ``database.url``).
    3. By explicitly passing a settings object as an argument of application factory function.

    More details can be found in
    `Pydantic documentation <https://docs.pydantic.dev/latest/concepts/pydantic_settings/>`_.

    Examples
    --------

    .. code-block:: yaml
        :caption: config.yml

        database:
            url: postgresql+asyncpg://postgres:postgres@localhost:5432/syncmaster

        broker:
            url: amqp://user:password@localhost:5672/

        logging: {}
        encryption: {}
        scheduler: {}
    """

    database: DatabaseSettings = Field(default_factory=DatabaseSettings, description="Database settings")  # type: ignore[arg-type]
    broker: RabbitMQSettings = Field(default_factory=RabbitMQSettings, description="Broker settings")  # type: ignore[arg-type]
    logging: LoggingSettings = Field(default=DEFAULT_LOGGING_SETTINGS, description="Logging settings")
    scheduler: SchedulerSettings = Field(default_factory=SchedulerSettings, description="Scheduler-specific settings")  # type: ignore[arg-type]
    encryption: CredentialsEncryptionSettings = Field(
        default_factory=CredentialsEncryptionSettings,  # type: ignore[arg-type]
        description="Settings for encrypting credential data",
    )

Bases: BaseModel

Scheduler settings.

Examples

.. code-block:: yaml :caption: config.yml

scheduler:
    transfer_fetching_timeout_seconds: 200
    misfire_grace_time_seconds: 300
Source code in syncmaster/scheduler/settings/__init__.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class SchedulerSettings(BaseModel):
    """Scheduler settings.

    Examples
    --------

    .. code-block:: yaml
        :caption: config.yml

        scheduler:
            transfer_fetching_timeout_seconds: 200
            misfire_grace_time_seconds: 300
    """

    TRANSFER_FETCHING_TIMEOUT_SECONDS: int = Field(
        180,
        description="Timeout for fetching transfers in seconds",
    )
    MISFIRE_GRACE_TIME_SECONDS: int = Field(
        300,
        description="Grace time for misfired jobs in seconds",
    )