[autotest] Allows set higher_is_better to None

Currently higher_is_better doesn't allow null in
tko_iteration_perf_value. Ideally we should alter the table
to allow it. But that would take very long down time (over 17 hours)
This cl is a workaround which makes the parser won't
insert higher_is_better if it is None (and the db bit will
default to True). Currently no one/no code is really using
this bit, so this seems fine. The piece that people do care
about, the value that is passed to perf uploader, can now
be set to None.

TEST=Run tko/parse with a result directory that
contains a perf_meansurements file. Change the higher_is_better
in the file to null/true/false and observe the parser logs.
BUG=None

Change-Id: I895f07c96e99f47cf018beb3958c671c674ec9ff
Reviewed-on: https://chromium-review.googlesource.com/234250
Reviewed-by: Dan Shi <dshi@chromium.org>
Tested-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Fang Deng <fdeng@chromium.org>
Trybot-Ready: Fang Deng <fdeng@chromium.org>
diff --git a/tko/db.py b/tko/db.py
index 2336490..68e2b86 100644
--- a/tko/db.py
+++ b/tko/db.py
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import re, os, sys, types, time, random
+import re, os, sys, time, random
 
 import common
 from autotest_lib.client.common_lib import global_config
@@ -440,7 +440,13 @@
                 data['value'] = perf_dict['value']
                 data['stddev'] = perf_dict['stddev']
                 data['units'] = perf_dict['units']
-                data['higher_is_better'] = perf_dict['higher_is_better']
+                # TODO(fdeng): In db, higher_is_better doesn't allow null,
+                # This is a workaround to avoid altering the
+                # table (very expensive) while still allows test to send
+                # higher_is_better=None. Ideally, the table should be
+                # altered to allow this.
+                if perf_dict['higher_is_better'] is not None:
+                    data['higher_is_better'] = perf_dict['higher_is_better']
                 data['graph'] = perf_dict['graph']
                 self.insert('tko_iteration_perf_value', data, commit=commit)