Best Python code snippet using fMBT_python
AESocket.py
Source:AESocket.py
...62 signal.signal(signal.SIGSEGV, self._exitHandler)63 '''64 Private Methods65 '''66 def _exitHandler(self, signum, frame):67 '''68 Kill AERenderCore Processes for the specified project.69 70 The aerendercore process isn't directly tied to aerender.71 It is spawned by launchd.72 73 So to find which aerendercore process correlates to each render74 we sort through open files, the log files are most always open.75 By default, these carry the name of the project.76 We search for these to associate each aerendercore process77 with it's project.78 '''79 # Wait a few seconds to make sure aerendercore has enough time to load the log file80 time.sleep(10)...
reload.py
Source:reload.py
...34 observer = Observer()35 self.observers.append(observer)36 observer.schedule(self, path=path, recursive=True)37 observer.start()38 def _exitHandler(self):39 for observer in self.observers:40 observer.stop()41 def on_any_event(self, event):42 extension = event.src_path.split('.')[-1].lower()43 if extension in self.allowed_extensions:44 event_type = event.event_type45 event_path = event.src_path46 event_relpath = event_path47 for path in self.paths:48 abspath = os.path.abspath(path)49 if event_relpath.startswith(abspath):50 event_relpath = os.path.relpath(event_relpath, abspath)51 break52 if self.last_event + self.minimum_wait < time.time():...
worker.py
Source:worker.py
1# ##### BEGIN GPL LICENSE BLOCK #####2#3# BitWrk - A Bitcoin-friendly, anonymous marketplace for computing power4# Copyright (C) 2013-2020 Jonas Eschenburg <jonas@bitwrk.net>5#6# This program is free software: you can redistribute it and/or modify7# it under the terms of the GNU General Public License as published by8# the Free Software Foundation, either version 3 of the License, or9# (at your option) any later version.10#11# This program is distributed in the hope that it will be useful,12# but WITHOUT ANY WARRANTY; without even the implied warranty of13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# GNU General Public License for more details.15#16# You should have received a copy of the GNU General Public License17# along with this program. If not, see <http://www.gnu.org/licenses/>.18#19# ##### END GPL LICENSE BLOCK #####20import atexit, bpy.app, os.path, subprocess21WORKER_PROC = None22worker_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "blender-slave.py")23def _exithandler():24 global WORKER_PROC25 p, WORKER_PROC = WORKER_PROC, None26 if p is not None:27 p.terminate()28 29def worker_alive():30 global WORKER_PROC31 if WORKER_PROC is None:32 return False33 if WORKER_PROC.poll() is not None:34 # process has exited35 WORKER_PROC = None36 return False37 return True38def can_start_worker(settings):39 if worker_alive():40 return False41 return os.path.isfile(worker_path)42def start_worker(settings):43 global WORKER_PROC44 if worker_alive():45 return46 if settings.use_custom_python_executable:47 python_path = settings.custom_python_executable48 else:49 python_path = bpy.app.binary_path_python 50 args = [51 python_path,52 worker_path,53 "--blender", bpy.app.binary_path,54 "--bitwrk-host", str(settings.bitwrk_client_host),55 "--bitwrk-port", str(settings.bitwrk_client_port),56 "--max-cost", str(settings.complexity),57 "--device", str(settings.worker_device),58 ]59 if settings.trusted_render:60 args += ["--trusted"]61 print("Starting worker:", args)62 WORKER_PROC = subprocess.Popen(args)63 atexit.register(_exithandler)64 65def can_stop_worker():66 return worker_alive()67def stop_worker():68 global WORKER_PROC69 if not worker_alive():70 return71 print("Terminating worker")72 p, WORKER_PROC = WORKER_PROC, None73 p.terminate()74 atexit.unregister(_exithandler)...
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!!