Best Python code snippet using autotest_python
launchers.py
Source:launchers.py
...9def slurm_launcher(commands, max_slurm_jobs, *args, **kwargs):10 for cmd in commands:11 block_until_running(max_slurm_jobs, getpass.getuser())12 subprocess.call(cmd, shell=True)13def get_num_jobs(user):14 # returns a list of (# queued and waiting, # running)15 out = subprocess.run(16 ["squeue -u " + user], shell=True, stdout=subprocess.PIPE17 ).stdout.decode(sys.stdout.encoding)18 a = list(filter(lambda x: len(x) > 0, map(lambda x: x.split(), out.split("\n"))))19 queued, running = 0, 020 for i in a:21 if i[0].isnumeric():22 if i[4].strip() == "PD":23 queued += 124 else:25 running += 126 return (queued, running)27def block_until_running(n, user):28 while True:29 if sum(get_num_jobs(user)) < n:30 time.sleep(0.2)31 return True32 else:33 time.sleep(10)...
setup_build.py
Source:setup_build.py
...6 def initialize_options(self):7 super().initialize_options()8 self.logger_name = "fluidsim"9 self.num_jobs_env_var = "FLUIDDYN_NUM_PROCS_BUILD"10 def get_num_jobs(self):11 if PARALLEL_COMPILE:12 return super().get_num_jobs()13 else:14 # Return None which would in turn retain the `self.parallel` in its15 # default value...
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!!