diff --git a/tko/job_serializer.py b/tko/job_serializer.py
new file mode 100644
index 0000000..55c1169
--- /dev/null
+++ b/tko/job_serializer.py
@@ -0,0 +1,451 @@
+#!/usr/bin/python
+
+"""A script that provides convertion between models.job and a protocol
+buffer object.
+
+This script contains only one class that takes an job instance and
+convert it into a protocol buffer object. The class will also be
+responsible for serializing the job instance via protocol buffers.
+
+"""
+
+# import python libraries
+import os
+import datetime
+import time
+import random
+
+# import autotest libraries
+from autotest_lib.tko import models
+from autotest_lib.tko import tko_pb2
+
+__author__ = 'darrenkuo@google.com (Darren Kuo)'
+
+mktime = time.mktime
+datetime = datetime.datetime
+
+class JobSerializer(object):
+    """A class that takes a job object of the tko module and package
+    it with a protocol buffer.
+
+    This class will take a model.job object as input and create a
+    protocol buffer to include all the content of the job object. This
+    protocol buffer object will be serialized into a binary file.
+    """
+
+    def __init__(self):
+
+        self.job_type_dict = {'dir':str, 'tests':list, 'user':str,
+                              'label':str, 'machine':str,
+                              'queued_time':datetime,
+                              'started_time':datetime,
+                              'finished_time':datetime,
+                              'machine_owner':str,
+                              'machine_group':str, 'aborted_by':str,
+                              'aborted_on':datetime,
+                              'keyval_dict':dict}
+
+        self.test_type_dict = {'subdir':str, 'testname':str,
+                               'status':str, 'reason':str,
+                               'kernel':models.kernel, 'machine':str,
+                               'started_time':datetime,
+                               'finished_time':datetime,
+                               'iterations':list, 'attributes':dict,
+                               'labels':list}
+
+        self.kernel_type_dict = {'base':str, 'patches':list,
+                                 'kernel_hash':str }
+
+        self.iteration_type_dict = {'index':int, 'attr_keyval':dict,
+                                    'perf_keyval':dict }
+
+        self.patch_type_dict = {'spec':str, 'reference':str,
+                                'hash':int}
+
+
+    def deserialize_from_binary(self, infile):
+        """Takes in a binary file name and returns a tko job object.
+
+        The method first deserialize the binary into a protocol buffer
+        job object and then converts the job object into a tko job
+        object.
+
+        @param
+        infile: the name of the binary file that will be deserialized.
+
+        @return a tko job that is represented by the binary file will
+        be returned.
+        """
+
+        job_pb = tko_pb2.job()
+
+        binary = open(infile, 'r')
+        try:
+            job_pb.ParseFromString(binary.read())
+        finally:
+            binary.close()
+
+        return self.get_tko_job(job_pb)
+
+
+    def serialize_to_binary(self, the_job, binaryfilename):
+        """Serializes the tko job object into a binary by using a
+        protocol buffer.
+
+        The method takes a tko job object and constructs a protocol
+        buffer job object. Then invokes the native serializing
+        function on the object to get a binary string. The string is
+        then written to outfile.
+
+        Precondition: Assumes that all the information about the job
+        is already in the job object. Any fields that is None will be
+        provided a default value.
+
+        @param
+        the_job: the tko job object that will be serialized.
+        binaryfilename: the name of the file that will be written to
+
+        @return the filename of the file that contains the
+        binary of the serialized object.
+        """
+
+        job_pb = tko_pb2.job()
+        self.set_pb_job(the_job, job_pb)
+
+        out = open(binaryfilename, 'wb')
+        try:
+            out.write(job_pb.SerializeToString())
+        finally:
+            out.close()
+
+
+    # getter setter methods
+    def get_tko_job(self, job):
+        """Creates a a new tko job object from the pb job object.
+
+        Uses getter methods on the pb objects to extract all the
+        attributes and finally constructs a tko job object using the
+        models.job constructor.
+
+        @param
+        job: a pb job where data is being extracted from.
+
+        @return a tko job object.
+        """
+
+        fields_dict = self.get_trivial_attr(job, self.job_type_dict)
+
+        fields_dict['tests'] = [self.get_tko_test(test) for test in job.tests]
+
+        fields_dict['keyval_dict'] = dict((keyval.name, keyval.value)
+                                          for keyval in job.keyval_dict)
+
+        newjob = models.job(fields_dict['dir'], fields_dict['user'],
+                            fields_dict['label'],
+                            fields_dict['machine'],
+                            fields_dict['queued_time'],
+                            fields_dict['started_time'],
+                            fields_dict['finished_time'],
+                            fields_dict['machine_owner'],
+                            fields_dict['machine_group'],
+                            fields_dict['aborted_by'],
+                            fields_dict['aborted_on'],
+                            fields_dict['keyval_dict'])
+
+        newjob.tests.extend(fields_dict['tests'])
+
+        return newjob
+
+
+    def set_pb_job(self, tko_job, pb_job):
+        """Set the fields for the new job object.
+
+        Method takes in a tko job and an empty protocol buffer job
+        object.  Then safely sets all the appropriate field by first
+        testing if the value in the original object is None.
+
+        @param
+        tko_job: a tko job instance that will have it's values
+        transfered to the new job
+        pb_job: a new instance of the job class provided in the
+        protocol buffer.
+
+        """
+
+        self.set_trivial_attr(tko_job, pb_job, self.job_type_dict)
+
+        for test in tko_job.tests:
+            newtest = pb_job.tests.add()
+            self.set_pb_test(test, newtest)
+
+        for key, val in tko_job.keyval_dict.iteritems():
+            newkeyval = pb_job.keyval_dict.add()
+            newkeyval.name = key
+            newkeyval.value = str(val)
+
+
+    def get_tko_test(self, test):
+        fields_dict = self.get_trivial_attr(test, self.test_type_dict)
+
+        fields_dict['kernel'] = self.get_tko_kernel(test.kernel)
+
+        fields_dict['iterations'] = [self.get_tko_iteration(iteration)
+                                     for iteration in test.iterations]
+
+        fields_dict['attributes'] = dict((keyval.name, keyval.value)
+                                         for keyval in test.attributes)
+
+        fields_dict['labels'] = list(test.labels)
+
+        return models.test(fields_dict['subdir'],
+                           fields_dict['testname'],
+                           fields_dict['status'],
+                           fields_dict['reason'],
+                           fields_dict['kernel'],
+                           fields_dict['machine'],
+                           fields_dict['started_time'],
+                           fields_dict['finished_time'],
+                           fields_dict['iterations'],
+                           fields_dict['attributes'],
+                           fields_dict['labels'])
+
+
+    def set_pb_test(self, tko_test, pb_test):
+        """Sets the various fields of test object of the tko protocol.
+
+        Method takes a tko test and a new test of the protocol buffer and
+        transfers the values in the tko test to the new test.
+
+        @param
+        tko_test: a tko test instance.
+        pb_test: an empty protocol buffer test instance.
+
+        """
+
+        self.set_trivial_attr(tko_test, pb_test, self.test_type_dict)
+
+        self.set_pb_kernel(tko_test.kernel, pb_test.kernel)
+
+        for current_iteration in tko_test.iterations:
+            pb_iteration = pb_test.iterations.add()
+            self.set_pb_iteration(current_iteration, pb_iteration)
+
+        for key, val in tko_test.attributes.iteritems():
+            newkeyval = pb_test.attributes.add()
+            newkeyval.name = key
+            newkeyval.value = str(val)
+
+        for current_label in tko_test.labels:
+            pb_test.labels.append(current_label)
+
+
+    def get_tko_kernel(self, kernel):
+        """Constructs a new tko kernel object from a pb kernel object.
+
+        Uses all the getter methods on the pb kernel object to extract
+        the attributes and constructs a new tko kernel object using
+        the model.kernel constructor.
+
+        @param
+        kernel: a pb kernel object where data will be extracted.
+
+        @return a new tko kernel object.
+        """
+
+        fields_dict = self.get_trivial_attr(kernel, self.kernel_type_dict)
+
+        fields_dict['patches'] = [self.get_tko_patch(patch) for patch
+                                  in kernel.patches]
+
+        return models.kernel(fields_dict['base'], fields_dict['patches'],
+                             fields_dict['kernel_hash'])
+
+
+    def set_pb_kernel(self, tko_kernel, pb_kernel):
+        """Set a specific kernel of a test.
+
+        Takes the same form of all the other setting methods.  It
+        seperates the string variables from the int variables and set
+        them safely.
+
+        @param
+        tko_kernel: a tko kernel.
+        pb_kernel: an empty protocol buffer kernel.
+
+        """
+
+        self.set_trivial_attr(tko_kernel, pb_kernel, self.kernel_type_dict)
+
+        for patch in tko_kernel.patches:
+            newpatch = pb_kernel.patches.add()
+            self.set_pb_patch(patch, newpatch)
+
+
+    def get_tko_patch(self, patch):
+        """Constructs a new tko patch object from the provided pb
+        patch instance.
+
+        Extracts data from the provided pb patch and creates a new tko
+        patch using the models.patch constructor.
+
+        @param
+        patch: a pb patch that contains the data for the new tko patch
+
+        @return a new tko patch with the same data as in the pb patch.
+        """
+
+        fields_dict = self.get_trivial_attr(patch, self.patch_type_dict)
+        return models.patch(fields_dict['spec'],
+                            fields_dict['reference'],
+                            fields_dict['hash'])
+
+
+    def set_pb_patch(self, tko_patch, pb_patch):
+        """Set a specific patch of a kernel.
+
+        Takes the same form of all the other setting methods.  It
+        seperates the string variables from the int variables and set
+        them safely.
+
+        @param
+        tko_patch: a tko patch.
+        pb_patch: an empty protocol buffer patch.
+
+        """
+
+        self.set_trivial_attr(tko_patch, pb_patch, self.patch_type_dict)
+
+
+    def get_tko_iteration(self, iteration):
+        """Creates a new tko iteration with the data in the provided
+        pb iteration.
+
+        Uses the data in the pb iteration and the models.iteration
+        constructor to create a new tko iterations
+
+        @param
+        iteration: a pb iteration instance
+
+        @return a tko iteration instance with the same data.
+        """
+
+        fields_dict = self.get_trivial_attr(iteration,
+                                            self.iteration_type_dict)
+
+        fields_dict['attr_keyval'] = dict((keyval.name, keyval.value)
+                                          for keyval in iteration.attr_keyval)
+
+        fields_dict['perf_keyval'] = dict((keyval.name, keyval.value)
+                                          for keyval in iteration.perf_keyval)
+
+        return models.iteration(fields_dict['index'],
+                                fields_dict['attr_keyval'],
+                                fields_dict['perf_keyval'])
+
+
+    def set_pb_iteration(self, tko_iteration, pb_iteration):
+        """Sets all fields for a particular iteration.
+
+        Takes same form as all the other setting methods. Sets int,
+        str and datetime variables safely.
+
+        @param
+        tko_iteration: a tko test iteration.
+        pb_iteration: an empty pb test iteration.
+
+        """
+
+        self.set_trivial_attr(tko_iteration, pb_iteration,
+                              self.iteration_type_dict)
+
+        for key, val in tko_iteration.attr_keyval.iteritems():
+            newkeyval = pb_iteration.attr_keyval.add()
+            newkeyval.name = key
+            newkeyval.value = str(val)
+
+        for key, val in tko_iteration.perf_keyval.iteritems():
+            newkeyval = pb_iteration.perf_keyval.add()
+            newkeyval.name = key
+            newkeyval.value = str(val)
+
+
+    def get_trivial_attr(self, obj, objdict):
+        """Get all trivial attributes from the object.
+
+        This function is used to extract attributes from a pb job. The
+        dictionary specifies the types of each attribute in each tko
+        class.
+
+        @param
+        obj: the pb object that is being extracted.
+        objdict: the dict that specifies the type.
+
+        @return a dict of each attr name and it's corresponding value.
+        """
+
+        resultdict = {}
+        for field, field_type in objdict.items():
+            value = getattr(obj, field)
+            if field_type in (str, int, long):
+                resultdict[field] = field_type(value)
+            elif field_type == datetime:
+                resultdict[field] = (
+                            datetime.fromtimestamp(value/1000.0))
+
+        return resultdict
+
+
+    def set_trivial_attr(self, tko_obj, pb_obj, objdict):
+        """Sets all the easy attributes appropriately according to the
+        type.
+
+        This function is used to set all the trivial attributes
+        provided by objdict, the dictionary that specifies the types
+        of each attribute in each tko class.
+
+        @param
+        tko_obj: the original object that has the data being copied.
+        pb_obj: the new pb object that is being copied into.
+        objdict: specifies the type of each attribute in the class we
+        are working with.
+
+        """
+        for attr, attr_type in objdict.iteritems():
+            if attr_type == datetime:
+                t = getattr(tko_obj, attr)
+                if not t:
+                    self.set_attr_safely(pb_obj, attr, t, int)
+                else:
+                    t = mktime(t.timetuple()) + 1e-6 * t.microsecond
+                    setattr(pb_obj, attr, long(t*1000))
+            else:
+                value = getattr(tko_obj, attr)
+                self.set_attr_safely(pb_obj, attr, value, attr_type)
+
+
+    def set_attr_safely(self, var, attr, value, vartype):
+        """Sets a particular attribute of var if the provided value is
+        not None.
+
+        Checks if value is None. If not, set the attribute of the var
+        to be the default value. This is necessary for the special
+        required fields of the protocol buffer.
+
+        @param
+        var: the variable of which one of the attribute is being set.
+        attr: the attribute that is being set.
+        value: the value that is being checked
+        vartype: the expected type of the attr
+
+        """
+
+        supported_types = [int, long, str]
+        if vartype in supported_types:
+            if value is None:
+                value = vartype()
+            else:
+                assert isinstance(value, vartype), (
+                'Unexpected type %s for attr %s, should be %s' %
+                (type(value), attr, vartype))
+
+            setattr(var, attr, value)
diff --git a/tko/job_serializer_unittest.py b/tko/job_serializer_unittest.py
new file mode 100644
index 0000000..368e584
--- /dev/null
+++ b/tko/job_serializer_unittest.py
@@ -0,0 +1,331 @@
+#!/usr/bin/python
+
+"""Unittests for the JobSerializer class.
+
+Mostly test if the serialized object has the expected content.
+
+"""
+
+import common
+import time
+import os
+import datetime
+import tempfile
+
+from autotest_lib.tko import tko_pb2
+from autotest_lib.tko import job_serializer
+from autotest_lib.tko import models
+from autotest_lib.client.common_lib.test_utils import unittest
+
+NamedTemporaryFile = tempfile.NamedTemporaryFile
+datetime = datetime.datetime
+mktime = time.mktime
+
+class JobSerializerUnittest(unittest.TestCase):
+    """Base class as a job serializer unittest"""
+
+    def setUp(self):
+        tko_patches = []
+        tko_patches.append(models.patch('New spec!', 'Reference?',
+                                        123456))
+
+        tko_kernel = models.kernel('tubes', tko_patches, '1234567')
+        tko_time = datetime.now()
+
+        tko_job = models.job('/tmp/', 'root', 'test', 'My Computer',
+                             tko_time, tko_time, tko_time, 'root',
+                             'www', 'No one', tko_time, {'1+1':2})
+
+        tko_iteration = models.iteration(0, {'2+2':4, '3+3':6},
+                                   {'4+4':8, '5+5':10, '6+6':12})
+
+        tko_labels = ['unittest', 'dummy test', 'autotest']
+
+        tko_test = models.test('/tmp/', 'mocktest', 'PASS', 'N/A',
+                               tko_kernel, 'My Computer', tko_time,
+                               tko_time, [tko_iteration,
+                               tko_iteration, tko_iteration],
+                               {'abc':'def'}, tko_labels)
+
+        self.tko_job = tko_job
+        self.tko_job.tests = [tko_test, tko_test, tko_test]
+
+        self.pb_job = tko_pb2.job()
+        js = job_serializer.JobSerializer()
+        js.set_pb_job(self.tko_job, self.pb_job)
+
+
+    def test_job_dir(self):
+        """Check if the dir field are the same.
+        """
+        self.assertEqual(self.tko_job.dir, self.pb_job.dir)
+
+
+    def test_number_of_test(self):
+        """Check if the number of test are the same.
+        """
+        self.assertEqual(len(self.tko_job.tests),
+                         len(self.pb_job.tests))
+
+
+    def test_user(self):
+        """Check if the user field are the same.
+        """
+        self.assertEqual(self.tko_job.user, self.pb_job.user)
+
+
+    def test_machine(self):
+        """Check if the machine fields are the same.
+        """
+        self.assertEqual(self.tko_job.machine, self.pb_job.machine)
+
+
+    def test_queued_time(self):
+        """Check if queued_time are the same.
+        """
+        self.check_time(self.tko_job.queued_time,
+                        self.pb_job.queued_time)
+
+
+    def test_started_time(self):
+        """Check if the started_time are the same.
+        """
+        self.check_time(self.tko_job.started_time,
+                        self.pb_job.started_time)
+
+
+    def test_finished_time(self):
+        """Check if the finished_time are the same.
+        """
+        self.check_time(self.tko_job.finished_time,
+                        self.pb_job.finished_time)
+
+
+    def test_machine_owner(self):
+        """Check if the machine owners are the same.
+        """
+        self.assertEqual(self.tko_job.machine_owner,
+                         self.pb_job.machine_owner)
+
+
+    def test_machine_group(self):
+        """Check if the machine groups are the same.
+        """
+        self.assertEqual(self.tko_job.machine_group,
+                         self.pb_job.machine_group)
+
+    def test_aborted_by(self):
+        """Check if the jobs are aborted by the same person.
+        """
+        self.assertEqual(self.tko_job.aborted_by,
+                         self.pb_job.aborted_by)
+
+
+    def test_aborted_on(self):
+        self.check_time(self.tko_job.aborted_on,
+                        self.pb_job.aborted_on)
+
+
+    def test_keyval_dict(self):
+        """Check if the contents of the dictionary are the same.
+        """
+        self.assertEqual(len(self.tko_job.keyval_dict),
+                         len(self.pb_job.keyval_dict))
+        self.check_dict(self.tko_job.keyval_dict,
+                        self.convert_keyval_to_dict(self.pb_job,
+                        'keyval_dict'))
+
+
+    def test_tests(self):
+        """Check if all the test are the same.
+        """
+
+        for test, newtest in zip(self.tko_job.tests,
+                                 self.pb_job.tests):
+
+            self.assertEqual(test.subdir, newtest.subdir)
+            self.assertEqual(test.testname, newtest.testname)
+            self.assertEqual(test.status, newtest.status)
+            self.assertEqual(test.reason, newtest.reason)
+            self.assertEqual(test.machine, newtest.machine)
+            self.assertEqual(test.labels, newtest.labels)
+
+            self.check_time(test.started_time, newtest.started_time)
+            self.check_time(test.finished_time, newtest.finished_time)
+
+            self.check_iteration(test.iterations, newtest.iterations)
+
+            self.check_dict(test.attributes,
+                            self.convert_keyval_to_dict(newtest,
+                            'attributes'))
+
+            self.check_kernel(test.kernel, newtest.kernel)
+
+
+    def check_time(self, dTime, stime):
+        """Check if the datetime object contains the same time value
+        in microseconds.
+        """
+        t = mktime(dTime.timetuple()) + 1e-6 * dTime.microsecond
+        self.assertEqual(long(t), stime/1000)
+
+
+    def check_iteration(self, tko_iterations, pb_iterations):
+        """Check if the iteration objects are the same.
+        """
+        for tko_iteration, pb_iteration in zip(tko_iterations,
+                                               pb_iterations):
+
+            self.assertEqual(tko_iteration.index, pb_iteration.index)
+
+            self.check_dict(tko_iteration.attr_keyval,
+                            self.convert_keyval_to_dict(pb_iteration,
+                                                        'attr_keyval'))
+
+            self.check_dict(tko_iteration.perf_keyval,
+                            self.convert_keyval_to_dict(pb_iteration,
+                                                        'perf_keyval'))
+
+
+    def convert_keyval_to_dict(self, var, attr):
+        """Convert a protocol buffer repeated keyval object into a
+        python dict.
+        """
+
+        return dict((keyval.name, keyval.value) for keyval in
+                    getattr(var,attr))
+
+
+    def check_dict(self, dictionary, keyval):
+        """Check if the contents of the dictionary are the same as a
+        repeated keyval pair.
+        """
+        for key, value in dictionary.iteritems():
+            self.assertTrue(key in keyval);
+            self.assertEqual(str(value), keyval[key])
+
+
+    def check_kernel(self, kernel, newkernel):
+        """Check if the kernels are the same.
+        """
+
+        self.assertEqual(kernel.base, newkernel.base)
+        self.assertEqual(kernel.kernel_hash, newkernel.kernel_hash)
+
+        self.check_patches(kernel.patches, newkernel.patches)
+
+
+    def check_patches(self, patches, newpatches):
+        for patch, newpatch in zip(patches, newpatches):
+            self.assertEqual(patch.spec, newpatch.spec)
+            self.assertEqual(patch.reference, newpatch.reference)
+            self.assertEqual(patch.hash, newpatch.hash)
+
+
+class ReadBackTest(JobSerializerUnittest):
+    """Check if convert between models.job and pb job is correct even
+    after being written to binary and read by manually
+    """
+
+    def setUp(self):
+        super(ReadBackTest, self).setUp()
+
+        out_binary = NamedTemporaryFile(mode='wb')
+        try:
+            out_binary.write(self.pb_job.SerializeToString())
+            out_binary.flush()
+
+            binary = open(out_binary.name, 'rb')
+            try:
+                self.pb_job = tko_pb2.job()
+                self.pb_job.ParseFromString(binary.read())
+            finally:
+                binary.close()
+        finally:
+            out_binary.close()
+
+
+class ReadBackGetterTest(JobSerializerUnittest):
+    """Check if convert between models.job and pb job is correct after
+    using the getter methods in JobSerializer to read back the
+    data.
+    """
+
+    def setUp(self):
+        super(ReadBackGetterTest, self).setUp()
+
+        temp_binary = NamedTemporaryFile(mode='wb')
+        try:
+            temp_binary.write(self.pb_job.SerializeToString())
+            temp_binary.flush()
+
+            js = job_serializer.JobSerializer()
+            self.from_pb_job = js.deserialize_from_binary(temp_binary.name)
+        finally:
+            temp_binary.close()
+
+
+    def test_keyval_dict(self):
+        """Check if the contents of the dictionary are the same.  """
+
+        self.assertEqual(len(self.tko_job.keyval_dict),
+                         len(self.from_pb_job.keyval_dict))
+
+        self.check_dict(self.tko_job.keyval_dict,
+                        self.from_pb_job.keyval_dict)
+
+
+    def test_tests(self):
+        """Check if all the test are the same.
+        """
+        for test, newtest in zip(self.tko_job.tests,
+                                 self.from_pb_job.tests):
+
+            self.assertEqual(test.subdir, newtest.subdir)
+            self.assertEqual(test.testname, newtest.testname)
+            self.assertEqual(test.status, newtest.status)
+            self.assertEqual(test.reason, newtest.reason)
+            self.assertEqual(test.machine, newtest.machine)
+            self.assertEqual(test.labels, newtest.labels)
+
+            self.check_time(test.started_time, newtest.started_time)
+            self.check_time(test.finished_time, newtest.finished_time)
+
+            self.check_iteration(test.iterations, newtest.iterations)
+
+            self.check_dict(test.attributes, newtest.attributes)
+
+            self.check_kernel(test.kernel, newtest.kernel)
+
+
+    def check_time(self, dTime, sTime):
+        """Check if the datetime object contains the same time value
+        in microseconds.
+
+        If sTime is type int or type long, then only convert dTime to
+        microseconds. Else, convert both dTime and sTime to
+        microseconds. Then, compare the two after casting them to
+        long.
+        """
+
+        t = mktime(dTime.timetuple()) + 1e-6 * dTime.microsecond
+        if isinstance(sTime, (int, long)):
+            self.assertEqual(long(t*1000), sTime)
+        else:
+            t1 = mktime(sTime.timetuple()) + 1e-6 * sTime.microsecond
+            self.assertEqual(long(t*1000), long(t1*1000))
+
+
+    def check_iteration(self, iterations, newiterations):
+        """Check if the iteration objects are the same.
+        """
+        for iteration, newiteration in zip(iterations, newiterations):
+            self.assertEqual(iteration.index, newiteration.index)
+            self.check_dict(iteration.attr_keyval,
+                            newiteration.attr_keyval)
+            self.check_dict(iteration.perf_keyval,
+                            newiteration.perf_keyval)
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/tko/parse.py b/tko/parse.py
index 640c02e..6f8bba9 100755
--- a/tko/parse.py
+++ b/tko/parse.py
@@ -157,6 +157,18 @@
 
     # write the job into the database
     db.insert_job(jobname, job)
+
+    # Serializing job into a binary file
+    try:
+        from autotest_lib.tko import tko_pb2
+        from autotest_lib.tko import job_serializer
+
+        serializer = job_serializer.JobSerializer()
+        serializer.serialize_to_binary(job, os.path.join(path, "job.serialize"))
+    except ImportError:
+        tko_utils.dprint("DEBUG: tko_pb2.py doesn't exist. Create by "
+                         "compiling tko/tko.proto.")
+
     db.commit()
 
 
diff --git a/tko/tko.proto b/tko/tko.proto
new file mode 100644
index 0000000..7f1af37
--- /dev/null
+++ b/tko/tko.proto
@@ -0,0 +1,52 @@
+message keyval {
+    required string name = 1;
+    required string value = 2;
+}
+
+message job {
+    required string dir = 1;
+    repeated test tests = 2;
+    required string user = 3;
+    required string label = 4;
+    required string machine = 5;
+    required int64 queued_time = 6;
+    required int64 started_time = 7;
+    required int64 finished_time = 8;
+    required string machine_owner = 9;
+    required string machine_group = 10;
+    required string aborted_by = 11;
+    required int64 aborted_on = 12;
+    repeated keyval keyval_dict = 13;
+}
+
+message kernel {
+    required string base = 1;
+    repeated patch patches = 2;
+    required string kernel_hash = 3;
+}
+
+message patch {
+    required string spec = 1;
+    required string reference = 2;
+    required int64 hash = 3;
+}
+
+message iteration {
+    required int64 index = 1;
+    repeated keyval attr_keyval = 2;
+    repeated keyval perf_keyval = 3;
+}
+
+message test {
+    required string subdir = 1;
+    required string testname = 2;
+    required string status = 3;
+    required string reason = 4;
+    required kernel kernel = 5;
+    required string machine = 6;
+    required int64 started_time = 7;
+    required int64 finished_time = 8;
+    repeated iteration iterations = 9;
+    repeated keyval attributes = 10;
+    repeated string labels = 11;
+}
