My python code:
def _init_cmd_logger(self):
# Init streamer
stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(message)s')
stream_handler.setFormatter(formatter)
# Configure logger
cmd_output_logger = logging.getLogger(self._ansible_command)
cmd_output_logger.propagate = False
cmd_output_logger.handlers = []
cmd_output_logger.addHandler(stream_handler)
return cmd_output_logger
def _live_output_manage(self, popen):
stdout = [] # Var with std out
stderr = [] # Var with std err
# Print outout while executing
while True:
reads = [popen.stdout.fileno(), popen.stderr.fileno()]
ret = select.select(reads, [], [])
for filed in ret[0]:
if filed == popen.stdout.fileno():
read = popen.stdout.readline().strip()
if read != '':
self._cmd_output_logger.info(read)
self._logger.debug(read)
stdout.append(read)
if filed == popen.stderr.fileno():
read = popen.stderr.readline().strip()
if read != '':
self._cmd_output_logger.error(read)
self._logger.error(read)
stderr.append(read)
# A None value indicates that the process hasnt terminated yet
if popen.poll() is not None:
break
# A None value indicates that the process has terminated correctly
return_code = popen.wait()
return return_code, stdout, stderr
The Code works fine, until we try to send to sys.stdout
a process with more than 1000 lines.
We are thinking that the python process doesn't have enough time to finish it (I/O writes), before the next call to self._cmd_output_logger.info(read)
Our solution was insert time.sleep(*)
after logger.info()
. But we are not sure about the issue. Or if we could have a better solution
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I am a total newbie in ML,and I am currently trying to create a pipeline for my dataBut the thing is, when I ran it,I received error:
In C++, i take a int typed variable and pass it's address to pythonThe address is hexadecimal and passed to python as string
I'm pretty new to coding, so forgive me if this is super obvious