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

_cli.py: apply expandvars() to storage argument #717

Closed
wants to merge 1 commit into from

Conversation

nodakai
Copy link

@nodakai nodakai commented Nov 29, 2023

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code.
This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

  • I agree this patch may be ported to Goptuna by other Goptuna contributors.

What does this implement/fix? Explain your changes.

so that I can pass a database password as an environment variable, like:

$ export PG_PASS=53cr37  # or k8s secret or whatever
$ optuna-dashboard.py 'postgresql://optuna:$PG_PASS@db/optuna'

Note we must not let Bash interpret the $ notation as that'll expose the secret to other users on the machine through commands like ps, top

Apologies, but I haven’t had the opportunity to test it myself...

so that I can pass a database password as an environment variable
@c-bata
Copy link
Member

c-bata commented Nov 30, 2023

@not522 Could you review this PR?

@nodakai
Copy link
Author

nodakai commented Nov 30, 2023

Hmm, just realized that the optuna CLI (but not APIs) supports $OPTUNA_STORAGE as an experimental feature, accepting a full SQLAlchemy URI.

I think my patch addresses a similar scenario, but it requires the user to explicitly specify '$OPTUNA_STORAGE' (with single quotes). In contrast, with the optuna CLI, it's possible to omit --storage ... when $OPTUNA_STORAGE is set.

@c-bata c-bata removed their assignment Dec 1, 2023
@not522
Copy link
Member

not522 commented Dec 1, 2023

Thank you for your feedback! After discussing the issue, we've concluded that introducing $OPTUNA_STORAGE as the default database URI is a good approach. Do you think this change will resolve your problem?

@nabenabe0928
Copy link
Collaborator

@nodakai If the solution suggested by @not522 works for you, we would like to close this PR.
Could you confirm this with a comment rather than with an emoji?

@nodakai
Copy link
Author

nodakai commented Dec 18, 2023

Yes, please go ahead with #717 (comment)

@nodakai nodakai closed this Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants