How to use _check_pid method in localstack

Best Python code snippet using localstack_python

manager.py

Source:manager.py Github

copy

Full Screen

...41 def setup(self, refMarker, camera=VideoStream.JETSONCAMERA, mode=MODE_TRACKING, debug=False, dictionnary=aruco.DICT_4X4_100):42 """43 Send Init command to the Worker Process on the specific logger proxy creation44 """45 if self._check_pid():46 self._send(Command(self.SETUP, InitMsg(refMarker, camera, mode, debug, dictionnary)))47 ret = self._recv(timeout=5)48 if ret:49 self.logger(INFO, 'Setup sucessful !')50 return True51 self.logger(INFO, 'Setup fail !')52 return False53 def startTracking(self):54 if self._check_pid():55 self._send(Command(self.START_TRACKING, None))56 ret = self._recv(timeout=1)57 if ret:58 self.logger(INFO, 'Starting success !')59 return True60 self.logger(INFO, 'Starting fail !')61 return False62 def stopTracking(self):63 if self._check_pid():64 self._send(Command(self.STOP_TRACKING, None))65 ret = self._recv(timeout=1)66 if ret:67 self.logger(INFO, 'Stopping success !')68 return True69 self.logger(INFO, 'Stopping fail !')70 return False71 def recalibrate(self):72 if self._check_pid():73 self._send(Command(self.RECALIBRATE, None))74 ret = self._recv(timeout=1)75 if ret:76 self.logger(INFO, 'Recalibration success !')77 return True78 self.logger(INFO, 'Recalibration fail !')79 return False80 def getPos(self):81 if self._check_pid():82 self._send(Command(self.GET_POS, None))83 return self._recv(timeout=1)84 else:85 return [(-1000, -1000),(-1000, -1000)]86 def getFrame(self):87 if self._check_pid():88 self._send(Command(self.GET_FRAME, None))89 return self._recv(timeout=1)90 else:91 return None92 def getWheatherVaneOrientation(self):93 if self._check_pid():94 self._send(Command(self.GET_WHEATHERVANE_ORIENTATION, None))95 return self._recv(timeout=1)96 else:97 return ORIENTATION_NONE98 def show(self):99 try:100 self.display.show(self.getFrame())101 except KeyboardInterrupt:102 self.display.stop()103 except:104 pass105 def start(self):106 """107 Start Worker Process108 """109 try:110 self.logger(INFO, 'Tracking Worker Starting Success !')111 self.worker.start()112 except:113 self.logger(INFO, 'Tracking Worker Starting Fail !')114 def stop(self):115 """116 Stop Worker Process117 """118 try:119 self.worker.terminate()120 except:121 pass122 def _check_pid(self):123 """124 Check For the existence of a unix pid.125 """126 try:127 if self.worker.pid is not None:128 os.kill(self.worker.pid, 0)129 else:130 return False131 except OSError:132 return False133 else:134 return True135 def _recv(self, timeout=None):136 """...

Full Screen

Full Screen

logger.py

Source:logger.py Github

copy

Full Screen

...17import os18import logging19import logging.handlers20from typing import *21def _check_pid(func):22 def check(self,*args, **kwds):23 if self.logger is None:24 self.set_logger()25 pid = os.getpid()26 if self._pid != pid:27 self._pid = pid28 self.reset_logger()29 func(self,*args, **kwds)30 return check31class SocketLogger:32 _pid:int = None33 __logger:logging.Logger = None34 def __init__(35 self, name:str, level:int=logging.NOTSET, host="localhost",...

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 localstack 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