Conversation
swelborn
left a comment
There was a problem hiding this comment.
looks good, a few comments
| EMAIL_SERVER_HOST = os.getenv( 'COACT_EMAIL_SERVER_HOST', 'smtp.slac.stanford.edu' ) | ||
| EMAIL_SERVER_PORT = os.getenv( 'COACT_EMAIL_SERVER_PORT', 25 ) | ||
| ADMINS = re.sub( "\s", "", environ.get("ADMIN_USERNAMES",'')).split(',') | ||
| ADMINS = re.sub(r"\s", "", environ.get("ADMIN_USERNAMES",'')).split(',') |
There was a problem hiding this comment.
prob could be split out of this PR but not really big deal
There was a problem hiding this comment.
this (plus the other raw string addition) was simply to clean up the warnings in the test output, I don't believe it was causing any errors
| nodecpucount: Optional[int] = UNSET | ||
| nodecpucountdivisor: Optional[int] = UNSET | ||
| nodegpucount: Optional[int] = UNSET | ||
| nodegpucount: Optional[int] = None |
There was a problem hiding this comment.
what are ramifications of this
There was a problem hiding this comment.
high level: UNSET tells strawberry a value was unset vs explicitly set to None (similar to JavaScript's undefined.
The generated code in client/ already forces all UNSETs to Nones anyways, so this won't affect that path and why I assumed this was safe, tho there's a point to be made about the raw GraphQL query angle.
These specific values came up because the following was being raised in test_clusters on the newly seeded databases:
_______________________________________ test_clusters _______________________________________
client = <coact.client.client.CoactClient object at 0x10bbef8f0>
async def test_clusters(client: CoactClient):
> result = await client.clusters()
^^^^^^^^^^^^^^^^^^^^^^^
tests/integration/test_queries.py:46:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/coact/client/client.py:231: in clusters
data = self.get_data(response)
^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coact.client.client.CoactClient object at 0x10bbef8f0>
response = <Response [200 OK]>
def get_data(self, response: httpx.Response) -> dict[str, Any]:
if not response.is_success:
raise GraphQLClientHttpError(
status_code=response.status_code, response=response
)
try:
response_json = response.json()
except ValueError as exc:
raise GraphQLClientInvalidResponseError(response=response) from exc
if (not isinstance(response_json, dict)) or (
"data" not in response_json and "errors" not in response_json
):
raise GraphQLClientInvalidResponseError(response=response)
data = response_json.get("data")
errors = response_json.get("errors")
if errors:
> raise GraphQLClientGraphQLMultiError.from_errors_dicts(
errors_dicts=errors, data=data
)
E coact.client.exceptions.GraphQLClientGraphQLMultiError: Int cannot represent non-integer value: <UnsetType instance>; Int cannot represent non-integer value: <UnsetType instance>; Int cannot represent non-integer value: <UnsetType instance>; Int cannot represent non-integer value: <UnsetType instance>; Expected Iterable, but did not find one for field 'Cluster.memberprefixes'.; Expected Iterable, but did not find one for field 'Cluster.memberprefixes'.
.venv/lib/python3.12/site-packages/coact/client/async_base_client.py:146: GraphQLClientGraphQLMultiError
| COPY requirements.txt /app | ||
| COPY pyproject.toml /app | ||
|
|
||
| RUN pip3 install -r /app/requirements.txt |
There was a problem hiding this comment.
could also use uv for this dockerfile but that could be another PR
There was a problem hiding this comment.
done, doing this also made me discover we were using Python 3.10 in prod but it sounds like most people were using 3.12 in dev 🙂
A few design decisions that are up for debate:
mainand PRs opened againstmainunitandintegration(requires live backend)tests/directory vs. previousclient/tests/requirements.txtto modernpyproject.tomlscripts/dev/00-test-users.mongodbto fully seed a test mongodb databaseuvDiff looks scary, but 1,203 additions were a lock file