How to use determine_machine_group method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...22 queued_time = tko_utils.get_timestamp(keyval, "job_queued")23 started_time = tko_utils.get_timestamp(keyval, "job_started")24 finished_time = tko_utils.get_timestamp(keyval, "job_finished")25 machine = cls.determine_hostname(keyval, dir)26 machine_group = cls.determine_machine_group(machine, dir)27 machine_owner = keyval.get("owner", None)28 aborted_by = keyval.get("aborted_by", None)29 aborted_at = tko_utils.get_timestamp(keyval, "aborted_on")30 return {"user": user, "label": label, "machine": machine,31 "queued_time": queued_time, "started_time": started_time,32 "finished_time": finished_time, "machine_owner": machine_owner,33 "machine_group": machine_group, "aborted_by": aborted_by,34 "aborted_on": aborted_at, "keyval_dict": keyval}35 @classmethod36 def determine_hostname(cls, keyval, job_dir):37 host_group_name = keyval.get("host_group_name", None)38 machine = keyval.get("hostname", "")39 is_multimachine = "," in machine40 # determine what hostname to use41 if host_group_name:42 if is_multimachine or not machine:43 tko_utils.dprint("Using host_group_name %r instead of "44 "machine name." % host_group_name)45 machine = host_group_name46 elif is_multimachine:47 try:48 machine = job.find_hostname(job_dir) # find a unique hostname49 except NoHostnameError:50 pass # just use the comma-separated name51 tko_utils.dprint("MACHINE NAME: %s" % machine)52 return machine53 @classmethod54 def determine_machine_group(cls, hostname, job_dir):55 machine_groups = set()56 for individual_hostname in hostname.split(","):57 host_keyval = models.test.parse_host_keyval(job_dir,58 individual_hostname)59 if not host_keyval:60 tko_utils.dprint('Unable to parse host keyval for %s'61 % individual_hostname)62 elif 'labels' in host_keyval:63 # Use `model` label as machine group. This is to avoid the64 # confusion of multiple boards mapping to the same platform in65 # wmatrix. With this change, wmatrix will group tests with the66 # same model, rather than the same platform.67 labels = host_keyval['labels'].split(',')68 board_labels = [l[8:] for l in labels...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?