aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gcp/stress_test
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreek@google.com>2016-04-18 15:34:04 -0700
committerGravatar Sree Kuchibhotla <sreek@google.com>2016-04-19 09:53:25 -0700
commit5bc112c0c967d4f97823162ae4f2468c033eec79 (patch)
tree53d9dbbd7d2a61982ab2839761b635684f502cd5 /tools/gcp/stress_test
parent9192498a083825aa31f121f1002189589e0419c4 (diff)
Add a will_run_forever flag to handle cases where the process terminates with exit code of 0
Diffstat (limited to 'tools/gcp/stress_test')
-rwxr-xr-xtools/gcp/stress_test/run_client.py8
-rwxr-xr-xtools/gcp/stress_test/run_server.py8
2 files changed, 14 insertions, 2 deletions
diff --git a/tools/gcp/stress_test/run_client.py b/tools/gcp/stress_test/run_client.py
index 9a4bc8a391..8f2a9c1530 100755
--- a/tools/gcp/stress_test/run_client.py
+++ b/tools/gcp/stress_test/run_client.py
@@ -103,6 +103,11 @@ def run_client():
dataset_id = env['DATASET_ID']
summary_table_id = env['SUMMARY_TABLE_ID']
qps_table_id = env['QPS_TABLE_ID']
+ # The following parameter is to inform us whether the stress client runs
+ # forever until forcefully stopped or will it naturally stop after sometime.
+ # This way, we know that the stress client process should not terminate (even
+ # if it does with a success exit code) and flag the termination as a failure
+ will_run_forever = env.get('WILL_RUN_FOREVER', '1')
bq_helper = BigQueryHelper(run_id, image_type, pod_name, project_id,
dataset_id, summary_table_id, qps_table_id)
@@ -140,11 +145,12 @@ def run_client():
while True:
# Check if stress_client is still running. If so, collect metrics and upload
# to BigQuery status table
+ # If stress_p.poll() is not None, it means that the stress client terminated
if stress_p.poll() is not None:
end_time = datetime.datetime.now().isoformat()
event_type = EventType.SUCCESS
details = 'End time: %s' % end_time
- if stress_p.returncode != 0:
+ if will_run_forever == '1' or stress_p.returncode != 0:
event_type = EventType.FAILURE
details = 'Return code = %d. End time: %s' % (stress_p.returncode,
end_time)
diff --git a/tools/gcp/stress_test/run_server.py b/tools/gcp/stress_test/run_server.py
index 0d9a653d18..796f0923f8 100755
--- a/tools/gcp/stress_test/run_server.py
+++ b/tools/gcp/stress_test/run_server.py
@@ -69,6 +69,11 @@ def run_server():
dataset_id = env['DATASET_ID']
summary_table_id = env['SUMMARY_TABLE_ID']
qps_table_id = env['QPS_TABLE_ID']
+ # The following parameter is to inform us whether the server runs forever
+ # until forcefully stopped or will it naturally stop after sometime.
+ # This way, we know that the process should not terminate (even if it does
+ # with a success exit code) and flag any termination as a failure.
+ will_run_forever = env.get('WILL_RUN_FOREVER', '1')
logfile_name = env.get('LOGFILE_NAME')
@@ -106,7 +111,8 @@ def run_server():
stderr=subprocess.STDOUT)
returncode = stress_p.wait()
- if returncode != 0:
+
+ if will_run_forever == '1' or returncode != 0:
end_time = datetime.datetime.now().isoformat()
event_type = EventType.FAILURE
details = 'Returncode: %d; End time: %s' % (returncode, end_time)