How to use nonfinished_pidfile_ids method in autotest

Best Python code snippet using autotest_python

monitor_db_functional_test.py

Source:monitor_db_functional_test.py Github

copy

Full Screen

...96 pidfile_id = self.pidfile_from_path(working_directory, pidfile_name)97 self._set_pidfile_exit_status(pidfile_id, 0)98 def finish_active_process_on_host(self, host_id):99 match = 'hosts/host%d/' % host_id100 for pidfile_id in self.nonfinished_pidfile_ids():101 if pidfile_id._working_directory.startswith(match):102 self._set_pidfile_exit_status(pidfile_id, 0)103 break104 else:105 raise KeyError('No active process matched %s' % match)106 def _set_pidfile_exit_status(self, pidfile_id, exit_status):107 assert pidfile_id is not None108 contents = self._pidfiles[pidfile_id]109 contents.exit_status = exit_status110 contents.num_tests_failed = 0111 def was_last_process_killed(self, pidfile_type, sigs):112 pidfile_id = self._last_pidfile_id[pidfile_type]113 return sigs == self._pids_to_signals_received[pidfile_id]114 def nonfinished_pidfile_ids(self):115 return [pidfile_id for pidfile_id, pidfile_contents116 in self._pidfiles.iteritems()117 if pidfile_contents.exit_status is None]118 def running_pidfile_ids(self):119 return [pidfile_id for pidfile_id in self.nonfinished_pidfile_ids()120 if self._pidfiles[pidfile_id].process is not None]121 def pidfile_from_path(self, working_directory, pidfile_name):122 return self._pidfile_index[(working_directory, pidfile_name)]123 def attached_files(self, working_directory):124 """125 Return dict mapping path to contents for attached files with specified126 paths.127 """128 return dict((path, contents) for path, contents129 in self._attached_files.get(working_directory, [])130 if path is not None)131 # DroneManager emulation APIs for use by monitor_db132 def get_orphaned_autoserv_processes(self):133 return set()134 def total_running_processes(self):135 return sum(pidfile_id._num_processes136 for pidfile_id in self.nonfinished_pidfile_ids())137 def max_runnable_processes(self, username, drone_hostnames_allowed):138 return self.process_capacity - self.total_running_processes()139 def refresh(self):140 for pidfile_id in self._unregistered_pidfiles:141 # intentionally handle non-registered pidfiles silently142 self._pidfiles.pop(pidfile_id, None)143 self._unregistered_pidfiles = set()144 def execute_actions(self):145 # executing an "execute_command" causes a pidfile to be created146 for pidfile_id in self._future_pidfiles:147 # Process objects are opaque to monitor_db148 process = object()149 self._pidfiles[pidfile_id].process = process150 self._process_index[process] = pidfile_id...

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:

YouTube

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?

Helpful

NotHelpful