def kill_backgroud_process(): """Kill the running backgound process""" cwd = os.getcwd() path = os.path.join(cwd, "etc/scripts/kill_processes.sh") # out_directory = output_folder + "/logs/" cmd = list() cmd.append(path) print("killing background processes") executor.create_job(cmd, background=True) print("killing background processes finished")
def collect_metric(deviceId, interval, output_folder, metric_file_name): """This function creates a thread that will execute the script to collect system metrics""" cwd = os.getcwd() script_path = os.path.join(cwd + "/etc/scripts/collect_gpu_metrics.sh") out_directory = output_folder cmd = list() cmd.append(script_path) cmd.append(str(deviceId)) # Device Id cmd.append(str(interval)) # Monitoring Interval cmd.append(out_directory) # Directory for the output cmd.append(metric_file_name) # File name prefix for the experiment print("Collecting metrics , folder " + output_folder + " file- " + metric_file_name) executor.create_job(cmd, background=True) print("Collecting metrics finished")
def run_application(self): cmd = self.get_application_command() self.logger.info("Running: {} application".format(self.application) + " cmd-> " + cmd) try: e = executor.create_job(cmd, background=False, shell=True) except: self.logger.error("Execution of the command failed, cmd -> " + cmd) return e