Skip to content

Commit

Permalink
Tweak store tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Feb 20, 2024
1 parent cde96af commit a8aced2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/jobflow_remote/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,20 @@ def check_env_var() -> str:
return os.environ.get("TESTING_ENV_VAR", "unset")


@job(big_files="data")
@job
def add_big(a: float, b: float):
"""Adds two numbers together and writes the answer to an artificially large file
which is stored in a pre-defined store."""
import pathlib
"""Adds two numbers together and inflates the answer
to an array too large to store in MongoDB, then tries
to store that within the defined store.
"""
import array

result = a + b
with open("file.txt", "w") as f:
f.writelines([f"{result}"] * int(1e5))
return Response({"data": pathlib.Path("file.txt"), "result": a + b})
# create a 1.6 MB array that will be too large to store in MongoDB
# the array type "d" is a double-precision float, which is 8 bytes
big_array = array.array("d", [result] * 200_000)
return Response({"data": big_array, "result": a + b})


@job(undefined_store="data")
Expand Down

0 comments on commit a8aced2

Please sign in to comment.