Best Python code snippet using autotest_python
job.py
Source:job.py
...216 self.parser.add_option('-e', '--email',217 help='A comma separated list of '218 'email addresses to notify of job completion',219 default='')220 def _parse_meta_host_labels(self, label):221 """Parse the label part of the meta_host definition222 if it has a wild card it gets expanded into a list223 of all matching labels, e.g.: 2*label* becomes224 2*label1 2*label2 2*label3225 """226 if label.endswith('*'):227 labels = self.execute_rpc('get_labels',228 name__startswith=label.rstrip('*'))229 if len(labels) == 0:230 self.failure('No labels matching %s' % label, item=label,231 what_failed='Failed to find labels')232 return [l['name'] for l in labels]233 else:234 return [label]235 def _parse_hosts(self, args):236 """ Parses the arguments to generate a list of hosts and meta_hosts237 A host is a regular name, a meta_host is n*label or *label.238 These can be mixed on the CLI, and separated by either commas or239 spaces, e.g.: 5*Machine_Label host0 5*Machine_Label2,host2 """240 hosts = []241 meta_hosts = []242 for arg in args:243 for host in arg.split(','):244 if re.match('^[0-9]+[*]', host):245 num, host = host.split('*', 1)246 meta_hosts += int(num) * self._parse_meta_host_labels(host)247 elif re.match('^[*](\w*)', host):248 meta_hosts += self._parse_meta_host_labels(249 re.match('^[*](\w*)', host).group(1))250 elif host != '' and host not in hosts:251 # Real hostname and not a duplicate252 hosts.append(host)253 return (hosts, meta_hosts)254 def parse(self, parse_info=[]):255 host_info = topic_common.item_parse_info(attribute_name='hosts',256 inline_option='machine',257 filename_option='mlist')258 job_info = topic_common.item_parse_info(attribute_name='jobname',259 use_leftover=True)260 oth_info = topic_common.item_parse_info(attribute_name='one_time_hosts',261 inline_option='one_time_hosts')262 label_info = topic_common.item_parse_info(attribute_name='labels',...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!