Skip to content

Commit

Permalink
fix: remove hash from GET payload
Browse files Browse the repository at this point in the history
  • Loading branch information
cmelone committed Mar 4, 2024
1 parent 5a8a7a7 commit dee1b27
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
5 changes: 2 additions & 3 deletions gantry/routes/prediction/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ async def predict_single(db: aiosqlite.Connection, build: dict) -> dict:

# warn if the prediction is below some thresholds
if predictions["cpu_request"] < 0.25:
logger.warning(f"Warning: CPU request for {build['hash']} is below 0.25 cores")
logger.warning(f"Warning: CPU request for {build} is below 0.25 cores")
predictions["cpu_request"] = DEFAULT_CPU_REQUEST
if predictions["mem_request"] < 10_000_000:
logger.warning(f"Warning: Memory request for {build['hash']} is below 10MB")
logger.warning(f"Warning: Memory request for {build} is below 10MB")
predictions["mem_request"] = DEFAULT_MEM_REQUEST

# convert predictions to k8s friendly format
Expand All @@ -70,7 +70,6 @@ async def predict_single(db: aiosqlite.Connection, build: dict) -> dict:
predictions[k] = k8s.convert_bytes(v)

return {
"hash": build["hash"],
"variables": {
# spack uses these env vars to set the resource requests
# set them here at the last minute to avoid using these vars
Expand Down
2 changes: 0 additions & 2 deletions gantry/util/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ def validate_payload(payload: dict) -> bool:
if not (
# item must be dict
isinstance(payload, dict)
# must contain hash field
and isinstance(payload.get("hash"), str)
# must contain name and version
# for both package and compiler
and all(
Expand Down
2 changes: 0 additions & 2 deletions gantry/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ async def allocation(request: web.Request) -> web.Response:
acceptable payload:
{
"hash": "string",
"package": {
"name": "string",
"version": "string"
Expand All @@ -60,7 +59,6 @@ async def allocation(request: web.Request) -> web.Response:
returns:
{
"hash": "string",
"variables": {
"cpu_request": "float",
"mem_request": "float",
Expand Down

0 comments on commit dee1b27

Please sign in to comment.