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

Use beta tag for Sirepo image #113

Merged
merged 20 commits into from
May 25, 2023
Merged

Conversation

mrakitin
Copy link
Member

@mrakitin mrakitin commented May 23, 2023

This PR updates the Sirepo startup script to (1) resolve the issue reported in radiasoft/sirepo#4749, and (2) be reusable by the start-sirepo-action (NSLS-II/start-sirepo-action#1).

I also hit this issue (psf/requests#6432) with requests and urllib3 (it's failing in scheduled runs in main as well).

Also, Sirepo API for bluesky auth changed and was causing these issues:

Client side:

In [2]: from sirepo_bluesky.sirepo_bluesky import SirepoBluesky

In [3]: sb = SirepoBluesky(server="http://localhost:8000", secret="bluesky")

In [4]: data, schema = sb.auth("srw", "00000000")
---------------------------------------------------------------------------
SirepoBlueskyClientException              Traceback (most recent call last)
Cell In [4], line 1
----> 1 data, schema = sb.auth("srw", "00000000")

File ~/src/mrakitin/SRW_Sirepo/sirepo-bluesky/sirepo_bluesky/sirepo_bluesky.py:76, in SirepoBluesky.auth(self, sim_type, sim_id)
     73 req["authHash"] = "v1:" + base64.urlsafe_b64encode(h.digest()).decode()
     75 self.cookies = None
---> 76 res = self._post_json("bluesky-auth", req)
     77 if not ("state" in res and res["state"] == "ok"):
     78     raise SirepoBlueskyClientException(f"bluesky_auth failed: {res}")

File ~/src/mrakitin/SRW_Sirepo/sirepo-bluesky/sirepo_bluesky/sirepo_bluesky.py:223, in SirepoBluesky._post_json(self, url, payload)
    221 def _post_json(self, url, payload):
    222     response = requests.post(f"{self.server}/{url}", json=payload, cookies=self.cookies)
--> 223     self._assert_success(response, url)
    224     if not self.cookies:
    225         self.cookies = response.cookies

File ~/src/mrakitin/SRW_Sirepo/sirepo-bluesky/sirepo_bluesky/sirepo_bluesky.py:219, in SirepoBluesky._assert_success(response, url)
    216 @staticmethod
    217 def _assert_success(response, url):
    218     if not response.status_code == requests.codes.ok:
--> 219         raise SirepoBlueskyClientException(f"{url} request failed, status: {response.status_code}")

SirepoBlueskyClientException: bluesky-auth request failed, status: 500

Server side:

/home/vagrant/.pyenv/versions/3.9.15/envs/py3/lib/python3.9/site-packages/sirepo/uri_router.py:325: RuntimeWarning: coroutine 'API.api_authBlueskyLogin' was never awaited

So I updated the code to use the new API.

@mrakitin
Copy link
Member Author

@hyperrealist, please have a lot at this PR as well.

@mrakitin mrakitin marked this pull request as ready for review May 24, 2023 01:40
@mrakitin mrakitin removed the request for review from jklynch May 24, 2023 01:40
@mrakitin
Copy link
Member Author

NSLS-II/start-sirepo-action#1 should be merged first, then tagged as v2, then I'll update the corresponding CI code to use the production version of the NSLS-II/start-sirepo-action@v2 action.

Copy link
Contributor

@thomaswmorris thomaswmorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@thomaswmorris thomaswmorris merged commit 557ac2b into NSLS-II:main May 25, 2023
@mrakitin mrakitin deleted the latest-docker branch May 25, 2023 16:58
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.

2 participants