Skip to content

Commit a71b0ee

Browse files
authored
Add device type (public, private) and id (#6579)
Adding 2 new fields in the job report: * `is_private_instance` * and `instance_arn`. AFAICT, this field is only available for private devices and it contains the device ID showing on AWS --------- Signed-off-by: Huy Do <[email protected]>
1 parent 75ba52b commit a71b0ee

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tools/device-farm-runner/run_on_aws_devicefarm.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ class DeviceFarmReport:
429429
@dataclass
430430
class JobReport(DeviceFarmReport):
431431
os: str
432+
instance_arn: Optional[str]
433+
is_private_instance: bool
432434

433435

434436
class ReportProcessor:
@@ -555,6 +557,16 @@ def _to_job_report(
555557
result = report.get("result", "")
556558
counters = report.get("counters", "{}")
557559
os = report.get("device", {}).get("os", "")
560+
561+
fleet_type = report.get("device", {}).get("fleetType", "")
562+
is_private_instance = True if fleet_type == "PRIVATE" else False
563+
564+
# NB: When running on a private device, AWS set the field instanceArn pointing
565+
# to that device
566+
instance_arn = report.get(
567+
"instanceArn", report.get("device", {}).get("arn", "")
568+
)
569+
558570
return JobReport(
559571
arn=arn,
560572
name=name,
@@ -566,6 +578,8 @@ def _to_job_report(
566578
counters=counters,
567579
infos=infos,
568580
os=os,
581+
instance_arn=instance_arn,
582+
is_private_instance=is_private_instance,
569583
)
570584

571585
def _to_run_report(self, report: Dict[str, Any], infos: Dict[str, str] = dict()):

0 commit comments

Comments
 (0)