Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config object example - WIP #877

Closed
wants to merge 1 commit into from
Closed

Conversation

onmete
Copy link
Contributor

@onmete onmete commented May 6, 2024

Description

Example of config object and usage.

@onmete onmete marked this pull request as draft May 6, 2024 09:21
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 6, 2024
@openshift-ci openshift-ci bot requested review from bparees and thoraxe May 6, 2024 09:22
Copy link

openshift-ci bot commented May 6, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign thoraxe for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@onmete
Copy link
Contributor Author

onmete commented May 6, 2024

There are some alternative approaches too:

  • we can use singleton too, if we want to ensure that only one instance of config is used, eg.
class ConfigSingleton:
    pass
config = ConfigSingleton("path/to/config.yaml")
  • we can either initialize the singleton here and store it under the config variable, or we can just use the singleton directly in the other parts of the code (like logging at the top of each module that needs logging), eg.
from ols.utils.config import load_config
config = load_config()  # <- this will return the singleton instance

As we don't want to execute the query filters and index loader right away, lazily evaluated singleton might be a better fit than just module constant.

Copy link

openshift-ci bot commented May 6, 2024

@onmete: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/unit 4624207 link true /test unit
ci/prow/integration 4624207 link true /test integration
ci/prow/verify 4624207 link true /test verify

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 17, 2024
@openshift-merge-robot
Copy link

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@tisnik
Copy link
Contributor

tisnik commented May 21, 2024

@onmete ok to close this one now (your new PR already fixes this one)

@onmete
Copy link
Contributor Author

onmete commented May 21, 2024

closing, implemented in another PR

@onmete onmete closed this May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants