-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
advance the Post-Processing Agent version and add system test for pos…
…t-processing task time limit
- Loading branch information
Showing
5 changed files
with
49 additions
and
3 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
Empty file.
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,8 @@ | ||
#!/usr/bin/env python | ||
import sys | ||
import time | ||
from datetime import datetime | ||
|
||
print("Running reduction for " + sys.argv[1] + " at " + datetime.isoformat(datetime.now())) | ||
|
||
time.sleep(10) |
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,37 @@ | ||
""" | ||
Test of the autoreducer memory management that sets a max limit | ||
on the memory used by reduction scripts. | ||
""" | ||
|
||
import time | ||
import tests.utils.db as db_utils | ||
|
||
|
||
class TestAutoreducerTimeLimit: | ||
user = "InstrumentScientist" | ||
pwd = "InstrumentScientist" | ||
instrument = "nom" | ||
IPTS = "IPTS-1001" | ||
run_number = 10002 | ||
|
||
def test_reduction_script_exceeds_time_limit(self, db_connection, request_page): | ||
"""test that the reduction is terminated and an error is logged""" | ||
run_id = db_utils.add_instrument_data_run(db_connection, self.instrument, self.IPTS, self.run_number) | ||
db_utils.clear_previous_runstatus(db_connection, run_id) | ||
|
||
# login and send reduction request | ||
response = request_page("/report/nom/10002/reduce/", self.user, self.pwd) | ||
assert response.status_code == 200 | ||
assert response.url.endswith("/report/nom/10002/") | ||
|
||
# wait for reduction job to be terminated and database to be updated | ||
# note: the post-processing task time limit is set to 6 seconds, since if it is too short, | ||
# the memory limit test will hit the time limit before it hits the memory limit | ||
time.sleep(7.0) | ||
|
||
assert db_utils.check_run_status_exist(db_connection, run_id, "REDUCTION.REQUEST") | ||
assert db_utils.check_run_status_exist(db_connection, run_id, "REDUCTION.STARTED") | ||
assert db_utils.check_run_status_exist(db_connection, run_id, "REDUCTION.DATA_READY") | ||
assert db_utils.check_run_status_exist(db_connection, run_id, "REDUCTION.ERROR") | ||
|
||
assert db_utils.check_error_msg_contains(db_connection, run_id, "Time limit exceeded") |