mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-07 13:41:24 +00:00
fw/target: detect module variations in TargetInfo
- Add modules entry to TargetInfo - When retrieving TargetInfo from cache, make sure info modules match those for the current target, otherwise mark info as stale and re-generate.
This commit is contained in:
parent
75878e2f27
commit
2f231b5ce5
@ -608,6 +608,12 @@ The available attributes of the class are as follows:
|
|||||||
The name of the target class that was uised ot interact with the device
|
The name of the target class that was uised ot interact with the device
|
||||||
during the run E.g. ``"AndroidTarget"``, ``"LinuxTarget"`` etc.
|
during the run E.g. ``"AndroidTarget"``, ``"LinuxTarget"`` etc.
|
||||||
|
|
||||||
|
``modules``
|
||||||
|
A list of names of modules that have been loaded by the target. Modules
|
||||||
|
provide additional functionality, such as access to ``cpufreq`` and which
|
||||||
|
modules are installed may impact how much of the ``TargetInfo`` has been
|
||||||
|
populated.
|
||||||
|
|
||||||
``cpus``
|
``cpus``
|
||||||
A list of :class:`CpuInfo` objects describing the capabilities of each CPU.
|
A list of :class:`CpuInfo` objects describing the capabilities of each CPU.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
--!VERSION!1.3!ENDVERSION!
|
--!VERSION!1.4!ENDVERSION!
|
||||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||||
CREATE EXTENSION IF NOT EXISTS "lo";
|
CREATE EXTENSION IF NOT EXISTS "lo";
|
||||||
|
|
||||||
@ -78,6 +78,7 @@ CREATE TABLE Targets (
|
|||||||
oid uuid NOT NULL,
|
oid uuid NOT NULL,
|
||||||
run_oid uuid NOT NULL references Runs(oid),
|
run_oid uuid NOT NULL references Runs(oid),
|
||||||
target text,
|
target text,
|
||||||
|
modules text[],
|
||||||
cpus text[],
|
cpus text[],
|
||||||
os text,
|
os text,
|
||||||
os_version jsonb,
|
os_version jsonb,
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE targets ADD COLUMN modules text[];
|
||||||
|
|
@ -984,7 +984,7 @@ class RunDatabaseOutput(DatabaseOutput, RunOutputCommon):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def _db_targetfile(self):
|
def _db_targetfile(self):
|
||||||
columns = ['os', 'is_rooted', 'target', 'abi', 'cpus', 'os_version',
|
columns = ['os', 'is_rooted', 'target', 'modules', 'abi', 'cpus', 'os_version',
|
||||||
'hostid', 'hostname', 'kernel_version', 'kernel_release',
|
'hostid', 'hostname', 'kernel_version', 'kernel_release',
|
||||||
'kernel_sha1', 'kernel_config', 'sched_features', 'page_size_kb',
|
'kernel_sha1', 'kernel_config', 'sched_features', 'page_size_kb',
|
||||||
'system_id', 'screen_resolution', 'prop', 'android_id',
|
'system_id', 'screen_resolution', 'prop', 'android_id',
|
||||||
|
@ -221,6 +221,7 @@ class CpuInfo(Podable):
|
|||||||
def get_target_info(target):
|
def get_target_info(target):
|
||||||
info = TargetInfo()
|
info = TargetInfo()
|
||||||
info.target = target.__class__.__name__
|
info.target = target.__class__.__name__
|
||||||
|
info.modules = target.modules
|
||||||
info.os = target.os
|
info.os = target.os
|
||||||
info.os_version = target.os_version
|
info.os_version = target.os_version
|
||||||
info.system_id = target.system_id
|
info.system_id = target.system_id
|
||||||
@ -313,12 +314,13 @@ def cache_target_info(target_info, overwrite=False):
|
|||||||
|
|
||||||
class TargetInfo(Podable):
|
class TargetInfo(Podable):
|
||||||
|
|
||||||
_pod_serialization_version = 4
|
_pod_serialization_version = 5
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_pod(pod):
|
def from_pod(pod):
|
||||||
instance = super(TargetInfo, TargetInfo).from_pod(pod)
|
instance = super(TargetInfo, TargetInfo).from_pod(pod)
|
||||||
instance.target = pod['target']
|
instance.target = pod['target']
|
||||||
|
instance.modules = pod['modules']
|
||||||
instance.abi = pod['abi']
|
instance.abi = pod['abi']
|
||||||
instance.cpus = [CpuInfo.from_pod(c) for c in pod['cpus']]
|
instance.cpus = [CpuInfo.from_pod(c) for c in pod['cpus']]
|
||||||
instance.os = pod['os']
|
instance.os = pod['os']
|
||||||
@ -343,6 +345,7 @@ class TargetInfo(Podable):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(TargetInfo, self).__init__()
|
super(TargetInfo, self).__init__()
|
||||||
self.target = None
|
self.target = None
|
||||||
|
self.modules = []
|
||||||
self.cpus = []
|
self.cpus = []
|
||||||
self.os = None
|
self.os = None
|
||||||
self.os_version = None
|
self.os_version = None
|
||||||
@ -362,6 +365,7 @@ class TargetInfo(Podable):
|
|||||||
def to_pod(self):
|
def to_pod(self):
|
||||||
pod = super(TargetInfo, self).to_pod()
|
pod = super(TargetInfo, self).to_pod()
|
||||||
pod['target'] = self.target
|
pod['target'] = self.target
|
||||||
|
pod['modules'] = self.modules
|
||||||
pod['abi'] = self.abi
|
pod['abi'] = self.abi
|
||||||
pod['cpus'] = [c.to_pod() for c in self.cpus]
|
pod['cpus'] = [c.to_pod() for c in self.cpus]
|
||||||
pod['os'] = self.os
|
pod['os'] = self.os
|
||||||
@ -413,3 +417,7 @@ class TargetInfo(Podable):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _pod_upgrade_v4(pod):
|
def _pod_upgrade_v4(pod):
|
||||||
return TargetInfo._pod_upgrade_v3(pod)
|
return TargetInfo._pod_upgrade_v3(pod)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _pod_upgrade_v5(pod):
|
||||||
|
pod['modules'] = pod.get('modules') or []
|
||||||
|
@ -92,9 +92,18 @@ class TargetManager(object):
|
|||||||
@memoized
|
@memoized
|
||||||
def get_target_info(self):
|
def get_target_info(self):
|
||||||
info = get_target_info_from_cache(self.target.system_id)
|
info = get_target_info_from_cache(self.target.system_id)
|
||||||
|
|
||||||
if info is None:
|
if info is None:
|
||||||
info = get_target_info(self.target)
|
info = get_target_info(self.target)
|
||||||
cache_target_info(info)
|
cache_target_info(info)
|
||||||
|
else:
|
||||||
|
# If module configuration has changed form when the target info
|
||||||
|
# was previously cached, it is possible additional info will be
|
||||||
|
# available, so should re-generate the cache.
|
||||||
|
if set(info.modules) != set(self.target.modules):
|
||||||
|
info = get_target_info(self.target)
|
||||||
|
cache_target_info(info, overwrite=True)
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
def reboot(self, context, hard=False):
|
def reboot(self, context, hard=False):
|
||||||
|
@ -90,8 +90,8 @@ class PostgresqlResultProcessor(OutputProcessor):
|
|||||||
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
||||||
"update_run": "UPDATE Runs SET event_summary=%s, status=%s, timestamp=%s, end_time=%s, duration=%s, state=%s WHERE oid=%s;",
|
"update_run": "UPDATE Runs SET event_summary=%s, status=%s, timestamp=%s, end_time=%s, duration=%s, state=%s WHERE oid=%s;",
|
||||||
"create_job": "INSERT INTO Jobs (oid, run_oid, status, retry, label, job_id, iterations, workload_name, metadata, _pod_version, _pod_serialization_version) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);",
|
"create_job": "INSERT INTO Jobs (oid, run_oid, status, retry, label, job_id, iterations, workload_name, metadata, _pod_version, _pod_serialization_version) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);",
|
||||||
"create_target": "INSERT INTO Targets (oid, run_oid, target, cpus, os, os_version, hostid, hostname, abi, is_rooted, kernel_version, kernel_release, kernel_sha1, kernel_config, sched_features, page_size_kb, system_id, screen_resolution, prop, android_id, _pod_version, _pod_serialization_version) "
|
"create_target": "INSERT INTO Targets (oid, run_oid, target, modules, cpus, os, os_version, hostid, hostname, abi, is_rooted, kernel_version, kernel_release, kernel_sha1, kernel_config, sched_features, page_size_kb, system_id, screen_resolution, prop, android_id, _pod_version, _pod_serialization_version) "
|
||||||
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
||||||
"create_event": "INSERT INTO Events (oid, run_oid, job_oid, timestamp, message, _pod_version, _pod_serialization_version) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s",
|
"create_event": "INSERT INTO Events (oid, run_oid, job_oid, timestamp, message, _pod_version, _pod_serialization_version) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s",
|
||||||
"create_artifact": "INSERT INTO Artifacts (oid, run_oid, job_oid, name, large_object_uuid, description, kind, is_dir, _pod_version, _pod_serialization_version) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
"create_artifact": "INSERT INTO Artifacts (oid, run_oid, job_oid, name, large_object_uuid, description, kind, is_dir, _pod_version, _pod_serialization_version) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
||||||
"create_metric": "INSERT INTO Metrics (oid, run_oid, job_oid, name, value, units, lower_is_better, _pod_version, _pod_serialization_version) VALUES (%s, %s, %s, %s, %s, %s , %s, %s, %s)",
|
"create_metric": "INSERT INTO Metrics (oid, run_oid, job_oid, name, value, units, lower_is_better, _pod_version, _pod_serialization_version) VALUES (%s, %s, %s, %s, %s, %s , %s, %s, %s)",
|
||||||
@ -190,6 +190,7 @@ class PostgresqlResultProcessor(OutputProcessor):
|
|||||||
self.target_uuid,
|
self.target_uuid,
|
||||||
self.run_uuid,
|
self.run_uuid,
|
||||||
target_pod['target'],
|
target_pod['target'],
|
||||||
|
target_pod['modules'],
|
||||||
target_pod['cpus'],
|
target_pod['cpus'],
|
||||||
target_pod['os'],
|
target_pod['os'],
|
||||||
target_pod['os_version'],
|
target_pod['os_version'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user