-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ebezzi/scib-metrics-scripts
- Loading branch information
Showing
72 changed files
with
1,815 additions
and
691 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
name: Profiler | ||
|
||
env: | ||
CELLXGENE_CENSUS_USERAGENT: "CZI-test" | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ on: | |
push: | ||
branches: [main] | ||
|
||
env: | ||
CELLXGENE_CENSUS_USERAGENT: "CZI-test" | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
40 changes: 40 additions & 0 deletions
40
api/python/cellxgene_census/src/cellxgene_census/_testing/logger_proxy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""This module defines a plugin class that logs each request to a logfile. | ||
This class needs to be importable by the proxy server which runs in a separate process. | ||
See the user agent tests for usage. | ||
""" | ||
|
||
import json | ||
import traceback | ||
from pathlib import Path | ||
|
||
import proxy | ||
from proxy.common.flag import flags | ||
|
||
flags.add_argument( | ||
"--request-log-file", | ||
type=str, | ||
default="", | ||
help="Where to log the requests to.", | ||
) | ||
|
||
|
||
class RequestLoggerPlugin(proxy.http.proxy.HttpProxyBasePlugin): # type: ignore | ||
def handle_client_request(self, request: proxy.http.parser.HttpParser) -> proxy.http.parser.HttpParser: | ||
# If anything fails in here, it just fails to respond | ||
try: | ||
with Path(self.flags.request_log_file).open("a") as f: | ||
record = { | ||
"method": request.method.decode(), | ||
"url": str(request._url), | ||
} | ||
|
||
if request.headers: | ||
record["headers"] = {k2.decode().lower(): v.decode() for _, (k2, v) in request.headers.items()} | ||
f.write(f"{json.dumps(record)}\n") | ||
except Exception as e: | ||
# Making sure there is some visible output | ||
print(repr(e)) | ||
traceback.print_exception(e) | ||
raise e | ||
return request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.