Skip to content

Commit

Permalink
Add test for case where additional store is not known to jobflow-remote
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Feb 22, 2024
1 parent 85f8963 commit d224cda
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
15 changes: 14 additions & 1 deletion src/jobflow_remote/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,20 @@ def check_env_var() -> str:

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

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})


@job(undefined_store="data")
def add_big_undefined_store(a: float, b: float):
"""Adds two numbers together and writes the answer to an artificially large file
which is attempted to be stored in a undefined store."""
import pathlib

result = a + b
Expand Down
8 changes: 3 additions & 5 deletions tests/integration/test_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ def test_undefined_additional_stores(worker, job_controller):
runner = Runner()
runner.run(ticks=10)

# Probably this should error somewhere
doc = job_controller.get_jobs({})[0]
assert job_controller.count_jobs(state=JobState.COMPLETED) == 1
assert job_controller.count_flows(state=FlowState.COMPLETED) == 1
assert job_controller.jobstore.get_output(uuid=doc["job"]["uuid"])["result"] == 200
# The job should fail, as the additional store is not defined
assert job_controller.count_jobs(state=JobState.FAILED) == 1
assert job_controller.count_flows(state=FlowState.FAILED) == 1

0 comments on commit d224cda

Please sign in to comment.