-
Notifications
You must be signed in to change notification settings - Fork 19
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
Clean up var names in unit tests, avoid MP API access in GitHub workflow #207
Conversation
I believe I have seen this error in another PR or somewhere: File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/mp_api/client/core/client.py", line 1031, in _submit_request_and_process
raise MPRestError(
mp_api.client.core.client.MPRestError: REST query returned with error status code 401 on URL https://api.materialsproject.org/materials/core/?deprecated=False&_fields=structure&material_ids=mp-19017&_limit=1000 with message:
Response {
"message":"No API key found in request"
}
Error: Process completed with exit code 1. Looks like MP API key got lost sometimes? |
i can't reproduce the error locally. just tried with the latest version
and it's passed correctly pymatviz/.github/workflows/test.yml Line 59 in 7e32978
|
Yep that occurs intermittently, not sure what the reason is. I didn't remember where I saw this last time, would post it here if I find that. |
70bd23e
to
38cbe70
Compare
This comment was marked as outdated.
This comment was marked as outdated.
e88bf9d
to
799011f
Compare
@DanielYang59 thanks for debugging. agreed that not sure that's the root cause here though. - name: Run script
run: python ${{ matrix.script }}
env:
MP_API_KEY: ${{ secrets.MP_API_KEY }} |
I might open an issue there for easier tracking |
d011fef
to
2c6f994
Compare
raise RuntimeError("api key is None") | ||
|
||
elif mp_api_key is not None and len(mp_api_key.strip()) == 0: | ||
raise RuntimeError("mp api key is empty") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janosh can you have another look at the MP_API_KEY secret in our repo (I don't have access to that)? It looks like being empty?
RuntimeError: mp api key is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can't see it either. once you set a secret you can only change it's value, not see the current value. i just reset the secret to what i think it was before so let's see if that makes a difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still no luck. I'm not seeing the test.yml
or the template from your workflows
repo being changed at all recently, so super confused what is causing this failure.
I would have another look tomorrow because I don't have my laptop with me ATM (which I usually use to code), so everything feels very awkward :)
Another thread I haven't got to look at, not sure if it's related at all: Github Actions reusable workflow doesn't recognize secrets #69082
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if it's related at all
don't think so, the test-scripts
job doesn't have a reusable workflow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's related to secrets access from forked repos:
With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository.
As you might have noticed both this PR and #210 were created from our forks.
However above documentation doesn't provide any workaround for this :(
Perhaps skip that particular script (structure_viz.py
) when running from fork?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that sounds like it could be the culprit. probably the thing to do is to rather than fetch those structures on the fly, save them as JSON to tests/files/structs
and load them from there in this script (while leaving the code that generated those structures files in place but behind if no os.path.isfile(...)
as documentation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You always have helpful suggestions :) How is 95614f2 looking? I don't really like to manually download and save files or such, it's always better to automate this
2c6f994
to
77ba1a5
Compare
…viz into interactive-unit-test
Notice another issue, both our test suite and At commit 1f11e0b, main branch has NOT been merged ( Update: Looks like something wrong with the "checkout" action perhaps actions/checkout#1359 leads to the following: i.e. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot @DanielYang59! much clearer now, which vars are module-scoped 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for uncovering actions/checkout#1359. didn't know about this subtlety. will try to remember if it comes up again
No problem! Thanks for reviewing (always amazed by how much you know about all those APIs) |
maybe time for a new release soon? what do you think? anything that should be done first? |
Perhaps let me finish #200 perhaps in one or two days? It's largely done, I just want to finish the interactive tester and have a try on it? But feel free to release a new one now and I'm happy to keep it slow and polish that more :) |
sure no hurry, we can definitely wait 2 days or more. looking forward to #200! 👍 |
I really appreciate that :) |
Summary