import urllib import json import random import re import time from urllib.parse import urlparse from config import config from worker import WorkerThread, WorkerItemStatus from server import app from db import db import statistics from sample_bots import sample_bots worker = WorkerThread() worker.daemon = True worker.start() def run_commands(working_dir, commands): output = [] for command in commands: print(command) output.append('-' * 80) output.append(working_dir + '> ' + ' '.join(command)) result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding="utf-8",