Example #1
0
    def from_json(db_path, job, target):
        """
        Task factory.
        """
        data = job['targets'][target]
        benchmark = data['benchmark']
        oracle_path = os.path.expanduser(data['path'])
        db = connect_to_database(db_path)
        oracle = load_oracle(oracle_path)
        try:
            seed = data['seed']
        except KeyError:
            try:
                seed = clutil.extract_prototype(oracle)
            except clutil.PrototypeException as e:
                raise clutil.PrototypeException(
                    str(e) + " '{}'".format(oracle_path))

        task_args = [db_path, benchmark, seed, oracle]
        if config.is_host():
            return host_task(*task_args)
        else:
            return device_task(*task_args)
Example #2
0
 def test_is_host(self):
     config.is_host()