[autotest] Force host_scheduler to use metadata_reporter
metadata_reporter uploads metadata in bulk and in a separate thread.
This change allows host_scheduler to use metadata_reporter if it's
running. If the reporter is not running, it will still upload the data
using UDP, which may lead to package lost.
Also replace the email alert with metrics data.
BUG=None
TEST=run host_scheduler locally and run test, confirm the data is
uploaded.
Change-Id: I6eb173c239ad4043b701c8964b1c422b2afc10b7
Reviewed-on: https://chromium-review.googlesource.com/502716
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/site_utils/job_overhead.py b/site_utils/job_overhead.py
index 7b2754b..f0d3f35 100644
--- a/site_utils/job_overhead.py
+++ b/site_utils/job_overhead.py
@@ -9,7 +9,7 @@
from autotest_lib.client.common_lib import enum
from autotest_lib.client.common_lib import host_queue_entry_states
from autotest_lib.client.common_lib import host_states
-from autotest_lib.client.common_lib.cros.graphite import autotest_es
+from autotest_lib.site_utils import metadata_reporter
# Metadata db type string for job time stats
@@ -51,8 +51,9 @@
id_str: int(job_or_task_id),
'hostname': hostname,
'status': status,
- 'duration': duration_secs}
- autotest_es.post(type_str=type_str, metadata=metadata)
+ 'duration': duration_secs,
+ '_type': type_str}
+ metadata_reporter.queue(metadata)
def record_suite_runtime(suite_job_id, suite_name, board, build, num_child_jobs,
@@ -75,5 +76,6 @@
'board': board,
'build': build,
'num_child_jobs': num_child_jobs,
- 'duration': runtime_in_secs}
- autotest_es.post(type_str=SUITE_RUNTIME_KEY, metadata=metadata)
+ 'duration': runtime_in_secs,
+ '_type': SUITE_RUNTIME_KEY}
+ metadata_reporter.queue(metadata)