Skip to content

Commit

Permalink
update : merge를 위한 디렉토리 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
leemg1476 committed Apr 4, 2023
1 parent 98b336e commit 88e69d9
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added AI-Server/output.txt
Empty file.
File renamed without changes.
53 changes: 53 additions & 0 deletions AI-Server/tmp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import subprocess
import time
import logging
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
#
#
# class ConsoleOutputEventHandler(FileSystemEventHandler):
# def __init__(self, expected_output):
# super().__init__()
# self.expected_output = expected_output
# self.prev_output = ""
#
# def on_modified(self, event):
# with open(event.src_path) as f:
# output = f.read()
# if self.expected_output in output and self.expected_output != self.prev_output:
# logging.info(f"{self.expected_output}가 출력됩니다")
# self.prev_output = self.expected_output
#
#
# def monitor_console_output(command, expected_output):
# logging.info(f"{command} 명령어를 실행합니다")
# with open("output.txt", "w") as f:
# subprocess.call(command, stdout=f, shell=True)
#
# logging.info(f"{expected_output} 출력을 모니터링합니다")
# event_handler = ConsoleOutputEventHandler(expected_output)
# observer = Observer()
# observer.schedule(event_handler, ".", recursive=False)
# observer.start()
#
# try:
# while True:
# time.sleep(1)
# except KeyboardInterrupt:
# observer.stop()
# observer.join()
#
#
# logging.basicConfig(level=logging.INFO)
# monitor_console_output("python www.py", "2")
import subprocess

cmd = "python www.py"
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8')
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:
break
if output:
print(output.strip())

5 changes: 5 additions & 0 deletions AI-Server/www.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from tqdm import tqdm

# with open("output.txt", "w") as f:
for i in tqdm(range(100000000)):
pass
3 changes: 0 additions & 3 deletions tmp.py

This file was deleted.

0 comments on commit 88e69d9

Please sign in to comment.