Best Python code snippet using autotest_python
resources.py
Source:resources.py
...603 if input_dict['aborted'] != True:604 raise exceptions.BadRequest('"aborted" can only be set to true')605 query = models.HostQueueEntry.objects.filter(pk=self.instance.pk)606 models.AclGroup.check_abort_permissions(query)607 rpc_utils.check_abort_synchronous_jobs(query)608 self.instance.abort(thread_local.get_user())609class QueueEntryCollection(resource_lib.Collection):610 queryset = models.HostQueueEntry.objects.order_by('-id')611 entry_class = QueueEntry612class HealthTask(resource_lib.InstanceEntry):613 _permitted_methods = ('GET',)614 model = models.SpecialTask615 @classmethod616 def add_query_selectors(cls, query_processor):617 query_processor.add_field_selector('host', field='host__hostname')618 @classmethod619 def from_uri_args(cls, request, task_id):620 instance = models.SpecialTask.objects.get(id=task_id)621 return cls(request, instance)...
rpc_utils.py
Source:rpc_utils.py
...178 {'hosts' : 'Host(s) failed to meet job dependencies: ' +179 ', '.join(failing_hosts)})180def _execution_key_for(host_queue_entry):181 return (host_queue_entry.job.id, host_queue_entry.execution_subdir)182def check_abort_synchronous_jobs(host_queue_entries):183 # ensure user isn't aborting part of a synchronous autoserv execution184 count_per_execution = {}185 for queue_entry in host_queue_entries:186 key = _execution_key_for(queue_entry)187 count_per_execution.setdefault(key, 0)188 count_per_execution[key] += 1189 for queue_entry in host_queue_entries:190 if not queue_entry.execution_subdir:191 continue192 execution_count = count_per_execution[_execution_key_for(queue_entry)]193 if execution_count < queue_entry.job.synch_count:194 raise model_logic.ValidationError(195 {'' : 'You cannot abort part of a synchronous job execution '196 '(%d/%s), %d included, %d expected'...
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!!