-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add stress test * show pytest durations * Fix the warning. * Shorter snapshot test. * Fix a bug in manage_running_pips * Use new test file instead.
- Loading branch information
1 parent
b334c93
commit 27e8ff5
Showing
7 changed files
with
70 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ jobs: | |
run: tomato --version | ||
- name: Run pytest | ||
shell: bash | ||
run: pytest -vv | ||
run: pytest -vvv --durations=0 |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: "0.2" | ||
sample: | ||
name: counter_20_1 | ||
method: | ||
- device: "counter" | ||
technique: "count" | ||
time: 20.0 | ||
delay: 1.0 | ||
tomato: | ||
verbosity: "DEBUG" |
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,11 @@ | ||
version: "1.0" | ||
sample: | ||
name: counter_stresstest | ||
method: | ||
- component_tag: "counter" | ||
technique_name: "count" | ||
max_duration: 0.2 | ||
sampling_interval: 0.1 | ||
settings: | ||
unlock_when_done: true | ||
verbosity: DEBUG |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import pytest | ||
import os | ||
import subprocess | ||
import xarray as xr | ||
from datetime import datetime | ||
|
||
from tomato.models import Job | ||
from . import utils | ||
|
||
PORT = 12345 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"case, nreps", | ||
[ | ||
("counter_stresstest", 5), | ||
], | ||
) | ||
def test_stresstest(case, nreps, datadir, stop_tomato_daemon): | ||
os.chdir(datadir) | ||
subprocess.run(["tomato", "init", "-p", f"{PORT}", "-A", ".", "-D", "."]) | ||
subprocess.run(["tomato", "start", "-p", f"{PORT}", "-A", ".", "-L", "."]) | ||
utils.wait_until_tomato_running(port=PORT, timeout=3000) | ||
|
||
subprocess.run(["tomato", "pipeline", "load", "-p", f"{PORT}", "pip-counter", case]) | ||
for i in range(nreps): | ||
subprocess.run(["ketchup", "submit", "-p", f"{PORT}", f"{case}.yml"]) | ||
|
||
subprocess.run(["tomato", "pipeline", "ready", "-p", f"{PORT}", "pip-counter"]) | ||
|
||
utils.wait_until_ketchup_status(jobid=nreps, status="c", port=PORT, timeout=40000) | ||
|
||
prev = None | ||
for i in range(nreps): | ||
i += 1 | ||
assert os.path.exists(f"results.{i}.nc") | ||
dt = xr.open_datatree(f"results.{i}.nc") | ||
completed_at = Job.model_validate_json(dt.attrs["tomato_Job"]).completed_at | ||
ti = datetime.fromisoformat(completed_at) | ||
if prev is not None: | ||
assert ti > prev | ||
prev = ti |