-
-
Save Pk13055/a96bca24ba4bec25c619231f1b2555a3 to your computer and use it in GitHub Desktop.
Revisions
-
tvst revised this gist
Oct 8, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,6 @@ def signal_handler(signal_number, stack_frame): # Runs all Python files, but exclude this script to avoid a loop. this_file = os.path.abspath(__file__) for basename in os.listdir(folder): fname = os.path.join(folder, basename) -
tvst revised this gist
Oct 5, 2019 . No changes.There are no files selected for viewing
-
tvst created this gist
Oct 5, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ import os import signal import subprocess import sys # Parse command-line arguments. if len(sys.argv) > 1: folder = os.path.abspath(sys.argv[1]) else: folder = os.path.abspath(os.getcwd()) # Set up a signal handler so we can stop all Streamlit instances with Ctrl-C. processes = [] def signal_handler(signal_number, stack_frame): for process in processes: process.kill() signal.signal(signal.SIGTERM, signal_handler) signal.signal(signal.SIGINT, signal_handler) if sys.platform == 'win32': signal.signal(signal.SIGBREAK, signal_handler) else: signal.signal(signal.SIGQUIT, signal_handler) # Runs all Python files, but exclude this script to avoid a loop. this_file = os.path.abspath(__file__) print(this_file) for basename in os.listdir(folder): fname = os.path.join(folder, basename) if fname.endswith('.py') and fname != this_file: process = subprocess.Popen(['streamlit', 'run', fname]) processes.append(process) # Block this script until all processes terminate. for process in processes: process.wait()