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

KeyError: 'api_token' in NeptuneLogger #947

Closed
vfdev-5 opened this issue Apr 21, 2020 · 2 comments · Fixed by #951
Closed

KeyError: 'api_token' in NeptuneLogger #947

vfdev-5 opened this issue Apr 21, 2020 · 2 comments · Fixed by #951
Labels

Comments

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Apr 21, 2020

🐛 Bug description

When I specify api_token from os.environ["NEPTUNE_API_TOKEN"] I have the following warning

WARNING: It is not secure to place API token in your source code. You should treat it as a password to your account. It is strongly recommended to use NEPTUNE_API_TOKEN environment variable instead. Remember not to upload source file with API token to any public repository.

When I remove api_token

npt_logger = npt_module.NeptuneLogger(
        project_name="vfdev-5/my_project", 
        experiment_name="test",
        params=config
)

there is the following error:

  File "/opt/conda/lib/python3.7/site-packages/ignite/contrib/handlers/neptune_logger.py", line 447, in __init__
    neptune.init(api_token=kwargs["api_token"], project_qualified_name=kwargs["project_name"])
KeyError: 'api_token'

@jakubczakon shouldn't we explicitly set it up internally to None ?

Environment

  • PyTorch Version (e.g., 1.4): 1.4
  • Ignite Version (e.g., 0.3.0): 0.4.0.dev20200418
  • Neptune: 0.4.111
@vfdev-5 vfdev-5 added the bug label Apr 21, 2020
@jakubczakon
Copy link
Contributor

Hi @vfdev-5 I am looking into it right away.

@jakubczakon
Copy link
Contributor

jakubczakon commented Apr 21, 2020

Mhm, I see the problem.
I'll fix and PR.

The warning is on the neptune-client side, and it's not going to be converted to errors but still, it shouldn't be there.

Basically It's enough to change the getting of values here from kwargs["api_token"] to kwargs.get("api_token"):

            neptune.init(api_token=kwargs.get("api_token"), project_qualified_name=kwargs.get("project_name"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants